Page 1 of 1

Linking pages to templates

Posted: Mon Feb 09, 2009 2:03 pm
by vell
Hello all

Ill start off by saying im still fairly new to PHP, so if i sound stupid im sorry.

Its a small question really, i need to know how to link new HTML/PHP pages to my template without haveing to reload the whole page.

Bascially lets say i have a section of my template called "main" and i want the contents of my "about" page to show in this section without loading a new page. How would i go about doing this?

Hope that makes sense, any help would be great.

Re: Linking pages to templates

Posted: Mon Feb 09, 2009 2:47 pm
by Frozenlight777
I'm not quite sure what you're asking but I'm guessing you want something like an iframe?

Re: Linking pages to templates

Posted: Mon Feb 09, 2009 2:53 pm
by vell
Well i just wanted to link one of my .php pages to my template...something like

<?php echo <a href"...", target="main">...</a>; ?>

i tryed this code but dosent seem to work.

Re: Linking pages to templates

Posted: Mon Feb 09, 2009 2:56 pm
by Ziq
Can you post your code? and maybe some errors...

Re: Linking pages to templates

Posted: Mon Feb 09, 2009 3:00 pm
by vell
Sure

<div id="sidebar1">
<h3><img src="nav2.jpg" width="144" height="50" /></h3>
<p><a href="index.php">Home</a></p>
<?php echo <a href="Pages\register.php" target="mainContent">Sign In</a>; ?>
<p>My Profile</p>
<p>Friends</p>
<p>Top Movies</p>
<p>About</p>
<p>Contact Us</p>
</div>

this is the first link im doing so the others have not been done yet, when i use this code i get the error:

Parse error: syntax error, unexpected '<' in /mounted-storage/index.php on line 146

Re: Linking pages to templates

Posted: Mon Feb 09, 2009 3:39 pm
by Ziq
Do you read some books about PHP or manuals?

Code: Select all

 
<?php echo '<a href="Pages/register.php" target="mainContent">Sign In</a>'; ?>
 
You should use quotes (' or ");