PHP Side bar

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NeoSsjin
Forum Newbie
Posts: 2
Joined: Thu Oct 09, 2003 12:37 pm
Contact:

PHP Side bar

Post by NeoSsjin »

It's like when you are the main site you see the main site gfx pic on the right. When you click a section on the top right Reviews for example you will be taken to the reviews section he ofcourse uses PHP Include but as the page goes there not only the content changes but the side bar too instead of showing their pic it shows another pic saying Reviews. I'm sure it's a more advanced PHP Include than the one I use. So please if you know how it works please reply here. And Here is a site that uses what I want to use: http://evo3.anime-cubed.net/

Thanks neoSS
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Your web page..

Code: Select all

<html>
<body>
<?php
$theImage = "reviews.gif";
include("sidebar.php");
?>
</body>
</html>
Your include file..

Code: Select all

<?php
//include the image
echo ('<img src="images/'.$theImage.'">');
?>
------------------------------

The files you include() into your web pages can read any variables you've set in the main page.

Hope that helps.
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

If I'm understanding you correctly, you want a sidebar. It doesnt necessarily have to be php. Note the html used:

Code: Select all

<html>
<body><body bgcolor="black">
<table width="245" border="1" align="right" cellpadding="0" cellspacing="0" bordercolor="#666666" bgcolor="#000000">
  <tr> 
    <td><img src="splash.jpg" width="245" height="539" border="0" usemap="#Map"></td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="14,275,237,293" href="index2.php">
</map>
</body>
</html>
As you can see, the table is aligned to the right. Thats where it gets the right part. Then you can just replace the picture with yours, and change the rectange select size to whatever. That should about do it for ya
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

I would suspect that the script includes html in php rather than php in html.

Standard practice is to declare a bunch of $vars with php, then include an html template where they are echo'd out.

If the two pages you mentioned share the same html template, perhaps a php script sets an $image_name var - a different image in different pages. In the html template, you'd have something like

<img src="<?php echo $image_name; ?>" />

Who knows how they did it, but that's the way I'd recommend viewing the problem: define a bunch of vars, echo them in a template. Php scripts define the dynamic bits, static parts of the page are defined in the html.
NeoSsjin
Forum Newbie
Posts: 2
Joined: Thu Oct 09, 2003 12:37 pm
Contact:

Post by NeoSsjin »

Gen-ik is the most close I think the only thing left is what URL shall I type so the content and the bar on side will be changed. Something like this: http://evo3.anime-cubed.net/index2.php? ... dexnav.txt.
Post Reply