So this is what I want to do.
I want to be able to have my left navigation bar in another file.
So let's say you have
<div id="navigation">
#include "leftbar.php"
</div>
and... leftbar.php would include the following:
<a href="link1.html">Link 1</a>
<a href="link2.html">Link 2</a>
etc. etc.
Do you understand?
So that way let's say I decide to change a menu item I don't have to go through and change every page on my website. Can anyone help?
Regards
Seperating content from design
Moderator: General Moderators
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re: Seperating content from design
you can do this with two step
step 1 : create left.php
<a href="index.html?alt=link1">Link 1</a>
<a href="index.html?alt=Link2">Link2</a>
with this above code
step 2:index.php u have to include:
<?php
if(isset($_GET['alt']))
{
if($_GET['alt']=="link1")
{
include('Link1');
}
if($_GET['alt']=="Link2")
{
include('Link2');
}
}
try this
step 1 : create left.php
<a href="index.html?alt=link1">Link 1</a>
<a href="index.html?alt=Link2">Link2</a>
with this above code
step 2:index.php u have to include:
<?php
if(isset($_GET['alt']))
{
if($_GET['alt']=="link1")
{
include('Link1');
}
if($_GET['alt']=="Link2")
{
include('Link2');
}
}
try this
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re: Seperating content from design
Hi thanks for the quick reply but why would you need that conditional statement? And why would left.php be linking to twojeetu2009 wrote:you can do this with two step
step 1 : create left.php
<a href="index.html?alt=link1">Link 1</a>
<a href="index.html?alt=Link2">Link2</a>
with this above code
step 2:index.php u have to include:
<?php
if(isset($_GET['alt']))
{
if($_GET['alt']=="link1")
{
include('Link1');
}
if($_GET['alt']=="Link2")
{
include('Link2');
}
}
try this
index.php pages? When you say include('Link2') would I have to make a Link2.php. Help!
By the way I'm not stupid with coding, just not understanding those particular functions. Feel free to direct me to further reading.
Regards