Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a list of links and the content of links are in that page, how can I link to a place of the page?
for example:
<div id="div1">
content content content content content
</div>
<div id="div2">
content content content content content
</div>
<div id="div3">
content content content content content
</div>
How can I link to div3
Make use of the id for div3 like this:
Link to div3
<div id="div1">
content content content content content
</div>
<div id="div2">
content content content content content
</div>
<div id="div3">
content content content content content
</div>
Here you can read more about it.
Use an anchor to refer to your div ID.
Link to div3
You can find some documentation here: http://webdesign.about.com/od/beginningtutorials/a/aabg020899a.htm
link to name1
<a name="name1">Name1</a>
Is the original structure from netscape.
Both of these work today.
<ul>
<li> 1
<li> 2
</ul>
<div style="height:100%" id="name1">Name1</div>
<div style="height:100%" ><a name="name2">Name2</a></div>
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
CLARIFICATION: Being that I've never used PHP, it was unclear how to format the PHP file, so that when you include it in the index, then header(nav bar) would show up. No posts explained why I had to change my index.html to index.php to make it work. And again, being that I haven't used PHP, I was under the impression that changing the extension meant that I would have to convert my HTML code to PHP commands. I was trying to avoid having to change my whole code around. That's where the confusion was.
I was going to delete the question once I got it figured out. Then again, I'm sure I'm not the only person that may run into this while making their first website.
SOLUTION. Save only the nav code in html language with a PHP extension (header.php). Change index/home file from .html to a .php extension (don't have to modify any code. but accepts the include prompt). Then, include the header.php in your index.php. Same goes for your footer. Thanks for the help everyone.
*ORIGINAL POST: Through another post, I was told it would be easier to use a nav/footer on multiple pages by using PHP.
I created a file and tried including it and it is not displaying. I'm not sure what I am doing wrong.
There is some CSS in my nav bar as well, do I need to import the css file in the PHP file? or does the index.html file automatically attach to the included (php) file.
PHP Code:
<?php
echo '<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>';
?>
HTML Code (include):
<body>
<?php include '/header.php';?>
....other code....
</body>
If there's a problem with the PHP file, if I'm missing something, can someone show an explain please?
no need to add <?php ?> code in the header file just keep it as it is :
Create a new file named header.php and add this code to it
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
Include header.php anywhere you want
Remove the <?php tag from your code. As you generated html output. <?php tags are used to generate output by php.
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>
If you want to use php tags, than you have to write the code in this way:
<?php
echo '
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>
';
?>
Your problem is most likely the pathing of you include. Often you'd need to specify from the server root, and not just /header.php.
To specify your including-path, you could specify the root like this
include $_SERVER['DOCUMENT_ROOT']."/header.php";
You can also set the default include path in your php.ini file, thus making the $_SERVER['DOCUMENT_ROOT'] an automatic process, that can be done with running this code, that will alter your php.ini file.
ini_set('include_path', '/usr/lib/pear');
As others have pointed out, you don't need the contents of your /header.php to be echoed out as it's pure HTML. Anything that's included will be included the way it is, so having the contents of /header.php as pure HTML just makes for better practice, as it's easier to read.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a website in which I use just html, but I'd like to add one location where I would edit things like the nav and the footer. Then it would be instantly updated across the whole site.
So, for example, I'd like to put:
<nav>
<div class="nav-wrapper">
Logo
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
</div>
</nav>
Into
<?php echo $nav;?>
Any help would be greatly appreciated! =)
Add the html that you want to show into a file. For eg:
add this to menu.html
<nav>
<div class="nav-wrapper">
Logo
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
</div>
</nav>
Now include this page in other HTML pages wherever you want to call it like below
<?php
include 'menu.html';
?>
I like Lal's answer. I would change include 'menu.html'; with include_once 'menu.php'; The idea is that you will can add some php variables if you need them on some point.....
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have several questions about php content in Iframe.
I want to create some navigation links and target the Iframe. Is there an easy way to do?
Do you think I can only do this with Ajax or Ahah ?
This is what I ve tried so far, but it does not work.
Here is my code.
// HERE ARE NAVIGATION LINKS
<header>
<h1>Välkommen till Min Sida</h1><br>
<nav>
HOME
ABOUT ME
CONTACT
SUBSCRIBE
</nav>
</header>
// HERE IS MY IFRAME WHERE I WANT TO OPEN MY PHP FILES
<div class='content' >
<iframe>
<?php
$go = #$_GET["go"];
switch($go){
// IF I CLICK ON "WELCOME" FROM THE NAVIGATION BAR, OPEN THIS LINK IN My IFRAME
case "welcome";
include("welcome.php");
break;
// IF I CLICK ON "ABOUT" FROM THE NAVIGATION BAR, THIS LINK IN MY IFRAME
case "about";
include("newarrivals.php");
break;
// AS "DEFAULT", SHOW THIS IN THE IFRAME
default;
echo
<figure>
<img src="figure.png" alt="Figure 1" style="max-width:80%; height:auto;">
<figcaption> <h6> Illustration: Mehmet Akb. </h6> </figcaption>
</figure>
break;
}
?>
</iframe>
</div>
</div>
</body>
You can use javascript to reload iframe
Move your iframe content to icontent.php
Add some ID into iframe <iframe id="contentFrame"></iframe>
Change your link action
HOME
ABOUT ME
CONTACT
SUBSCRIBE
Create this javascript function
function goto(url) {
document.getElementById("contentFrame").contentWindow.location.replace(url);
}
If your Iframe has a name, you can use target property to determine the iframe name such as
<iframe name="topframe"></iframe>
<a href="xxx" target="topframe">
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've such piece of code:
<xsl:template match="bottom">
<div class="l1">
<div class="l2">
<div class="fl100">
<div align="center">
<div class="mw" align="center">
<div class="footer">
<div class="f1">$-BOTTOM_COPY-$</div>
<div class="f2">
$-BOTTOM_CONTACTS-$
</div>
<div class="f3">
$-BOTTOM_LINKS-$
</div>
<div class="f4">
$-BOTTOM_STUDY-$
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I cannot understan where from $-BOTTOM_CONTACTS-$, $-BOTTOM_LINKS-$ etc variables are.
I'm new in xsl, and searched every src files, but didn't find any declaration of define in php code.
Any idea?
It looks to me as if someone has included these bits of text (like $-BOTTOM_STUDY-$) as a target for replacement with something specific. Either they intended them to be replaced in the stylesheet before running the transformation, or they intended them to be replaced in the output file after running the transformation. But as far as XSLT is concerned, they are just strings to be copied from the stylesheet to the result document.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want to display the image of posts in other div then content's one.
I mean like this.
<div class="latest-posts">
<div class="latest-posts-info">
<div class="title"><h1>HERE IS TITLE<h1></div>
<div class="text">HERE IS CONTENT</div>
Read more...
<div class="clear"></div>
</div>
<div class="latest-posts-img">HERE I WANT THE IMAGE</div>
<div class="clear"></div>
</div>
While was adding a post in wp admin, i noticed its the only way, displaying image IN content.
Thanks
Check out this page : http://codex.wordpress.org/Function_Reference/the_post_thumbnail
<div class="latest-posts-img"> <?php the_post_thumbnail( $size, $attr ); ?> </div>
You can try to add a custom template for this post using this function:
http://codex.wordpress.org/Function_Reference/wp_get_attachment_image