Need help with php includes

Hey all
This may be very basic, but I have looked everywhere and couldn’t figure it out.
I have a site I am working on, and I am using php includes for my menu. The menu is a horizontal menu at the bottom of the website. 250px tall. I want to add a “more” link that will make the php include expand from 250px tp 500 px. Is this even possible?
If not, I would even be happy with the “more” link being a drop down (except going up) going about 500px tall.

Is this possible?

I really appreciate it.

There are a couple ways to do this but it depends on how yo want it to work. If you are trying to do it without a page refresh then you will need to use javascript to affect the div the menu is in. If you want to use a page refresh and php then you will need to store the selection of the user in a session var or a db so that it holds true after the page refresh and from then on.

Describe more of how you want it to happen and for how long the menu should be taller, either one page or for everypage after they click the link.

I appreciate your reply.
I would much rather go the js route over the db route if possible…

But a little more clarification on what I want to do…for my first option, I would like a link at theright of the php include(it will be the last link, so that’s no problem) and I want it to say expand. When clicked, the include will expand to 500 PX without a refresh if possible. Then, when it expands, the link will change and say “less” or something similar. When that is clicked, it will reduce back to 250 PX. It would be even better if I could have a mouse out code for when they move their mouse away from the include, it will go back to 250 PX.

My second option would be a more link that just expands like the drop down and will not refresh the page. Then when their mouse leaves the drop down (or in this case, a drop up because the inside is floating at the bottom), it will go back to normal.

If you want, I would be more than happy to create an image when I get home of what I am trying to achieve.

Thank you again.

So something like this http://jsfiddle.net/uSc72/
If you have not used jquery before you will need to setup a couple things in the head of your page to make this work.

<!DOCTYPE html>
<html>

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled 1</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> // Need to link to the jquery library if you don't have a copy of it already.
<style>
#expand {
	width: 100%;
	height: 250px;
	background-color: black;
}
</style>
<script>
$('#expand_link').click(function(){
    $('#expand').css('height', '200px');  
    return false;
});

$('#expand').mouseleave(function(){
    $('#expand').css('height', '100px');
});
</script>
</head>
<body>
<div id="expand"><a href="#" id="expand_link">Expand container</a></div>
</body>

</html>

I am familiar with query so that won’t be an issue.
I won’t be able to try the code until tomorrow night, but it will actually make the whole php include expand? Also, I didn’t mention this, but when “expand” is clicked, I want the more content to show up. But that shouldn’t be an issue I don’t think. Will try it soon.

Thank you! I’m excited to give it a try.

hey
something isnt working for me. If you dont mind, will you PM me so I can send you my test site and you can have a look?

thank you much

The code works great!
I actually do not need to use it in the php include like I was thinking. This will work perfectly.

Thanks again!

Glad you got it to work!

I really wish I has 25 posts so I could give you + karma. I’ll be around here though, so when I get 25, I’ll leave it for you.

Sponsor our Newsletter | Privacy Policy | Terms of Service