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.....
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Right basically, I have a php include statement in my html document. The include is working as such, it is pulling in the file and displaying it. The include file is basically my navbar, with links. What is happening is that all the other content within the index file is being turned into a hyper link, all pointing to the last item within the ul/li.
Here is my include statement:
php include ("/var/www/elements/navbar.html"); ?>
Here is my navbar.html file:
<ul>
<li><a href="http://www.upndown.co/home">Home</li>
<li><a href="http://www.upndown.co/about">About</li>
<li><a href="http://www.upndown.co/blog">Blog</li>
<li><a href="http://www.upndown.co/hardware">Hardware</li>
<li><a href="http://www.upndown.co/contact">Contact</li>
</ul>
You are missing closing tags on your links
add </a>
<ul>
<li>Home</li>
<li>About</li>
<li>Blog</li>
<li>Hardware</li>
<li>Contact</li>
</ul>
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>
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 got a simple PHP code like this one:
<div id="master">
<div id="info">
<?php include 'division.php';
echo $winrate;
?>
</div>
<div id="lastmatches">
<?php include 'lastmatches.php';?>
</div>
</div>
</body>
As you see i want to echo $winrate, but $winrate is a variable that comes from lastmatches.php. So it will never work. Some has got an idea to echo $winrate in the div info? Im stuck and i hope you guys can help me out!
Thanks in advance!
You need to include lastmatches.php before to define $winrate.
But if this file outputs some content then you will want to use the caching system to output the right content at the right place.
<div id="master">
<div id="info">
<?php include 'division.php';
// begin cache
ob_start();
include 'lastmatches.php';
// end cache
$lastmatchescontent = ob_get_clean();
echo $winrate;
?>
</div>
<div id="lastmatches">
<?php echo $lastmatchescontent; ?>
</div>
</div>
</body>
i suggest you to follow MVC approach, if you do not want to use framework u can do something like this: https://github.com/LPodolski/basic_php_templating
this will allow code to be more readable, by separating concerns of generating output from getting data from db, parsing it etc
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
This is what's happening in my boostrap menu. When I click any item in the dropdown the child is selected (class="active") but the parent is not. So, if the dropdown is closed you can't see in the menu the selected page.
<ul class="nav navbar-nav navbar-right">
<li class="my-class">Home</li>
<ul role="menu" class=" dropdown-menu">
<li class="active">Brokerage</li>
<li class="my-other-class">Consulting</li>
</ul>
</li>
<li class="my-class">Contact Us</li>
</ul>
I'm trying to do it with this but it's not working:
$('li').click(function() {
$(this).parents().addClass('.active');
});
Any help? Thanks.
You shouldn't put the . in the class name you pass to addClass. Also, parents() selects all its ancestors. If you just want the direct parent, use parent() (without 's').
$(this).parent().addClass('active');
You have some mistakes in your jQuery:
$('li').click(function() {
$(this).parent().addClass('active');
});
1.) It is parent() in your case, not parents().
2.) addClass('active')is correct, not addClass('.active').
Bootply Example
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