Linking pages to templates

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
vell
Forum Newbie
Posts: 3
Joined: Mon Feb 09, 2009 1:57 pm

Linking pages to templates

Post 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.
User avatar
Frozenlight777
Forum Commoner
Posts: 75
Joined: Wed May 28, 2008 12:59 pm

Re: Linking pages to templates

Post by Frozenlight777 »

I'm not quite sure what you're asking but I'm guessing you want something like an iframe?
vell
Forum Newbie
Posts: 3
Joined: Mon Feb 09, 2009 1:57 pm

Re: Linking pages to templates

Post 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.
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: Linking pages to templates

Post by Ziq »

Can you post your code? and maybe some errors...
vell
Forum Newbie
Posts: 3
Joined: Mon Feb 09, 2009 1:57 pm

Re: Linking pages to templates

Post 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
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: Linking pages to templates

Post 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 ");
Post Reply