Jump to content

mynameisham

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mynameisham's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks KrisNz! I copied/pasted your code and then tweaked it a bit and now everything's working like a dream. Thanks so much for all you guys' help! Topic solved
  2. Thanks! I'll definitely try that when I get a chance. And I'm a complete newb to php, so what do you mean by making sure $page doesn't have a malicious value? It's on my own personal site, if that affects anything.
  3. I'm trying to build a template site of sorts that will open it's different links with an include in the middle div. I've been trying for days to get it to work, and I can't find any help online about my particular situation. Here's a sample of the code I'm trying to use: <div id="header"><a href="index.php?page=random">Random Link</a><a href="index.php?page=better">Better Link</a> </div> <div id="main"> <?php @ include ("$page.htm"); ?> </div> <div id="footer"> </div> I know it's a problem that when it tries to load the page initially, it won't have any value for the variable and will just kill the process. But if I hardcode a value in for the variable, naturally the links still wouldn't work. Can anyone tell me what I'm doing wrong?
  4. Sorry for the double post, but I meant to include that the links have never worked. The only way the php displays the site I want it to is if I hardcode a value for the variable into the site somewhere, which then takes away from the modular nature I'm going for. I took out the hardcoded $page="main" tag, because I knew that was just keeping my links from working, but it still didn't fix anything. And once my links are working, how do I give the $page variable a default value of "main" so that it will load the main site on the first visit? I know the reason the links don't work right is because the code stops when it's looking for a value for $page on that initial load, and it returns a value of nothing. Thus, the html translation ends there and the code my links relied on to function isn't even on the page. But if I hardcode a value into the site, when the links reopon index.php, the value of $page is overwritten by the hardcode. I'm at a catch 22 it seems!
  5. <?php $page="main"; ?> <div id="page" align="center"> <div id="header"> <img src="images/header.jpg" border="0" usemap="#Map" /> <map name="Map"> <area shape="rect" coords="0,0,800,93" href="index.php?page=main"> <area shape="rect" coords="57,113,203,161" href="index.php?page=gallery"> <area shape="rect" coords="214,112,419,155" href="index.php?page=reel"> <area shape="rect" coords="428,116,580,160" href="index.php?page=resume"> <area shape="rect" coords="593,112,746,152" href="index.php?page=contact"> </map> </div> <div id="middle"><br /><br /> <div id="body"> <?php @ require_once ("$page.htm"); ?> </div> </div> <div id="footer" align="left"> </div> </div> This is the code I'm using to attempt to make the links in the header open a different page with include. At first the code would just stop rendering right before the require tag, but after I added in the first php code to define the variable $page as main at first, it would at least render the entire page correctly. Now, however none of the links work. They change the address in the address bar to index.php?page=gallery, but the div never changes to the gallery page. Any ideas on what I might be doing wrong?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.