i have links in the left part of my page....now, what i want to do is when i click the links, the content of that link will be called to the right part of the default page....and i think it is much easier to do this than manually making another page for the corresponding links....is there a way i can do this??what style should i use in php...
many thanks...
links help....php
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
Code: Select all
if (isset($_GET['page2display']))
{
if ($_GET['page2display'] == "something")
{
// print the relevant page
}
}here are some codes
where can i insert the above code of malcolmboston?
many thanks malcolmboston..
Code: Select all
<table width="e;100%"e; border="e;0"e; cellspacing="e;0"e; cellpadding="e;0"e;>
<!--spacer-->
<tr valign="e;top"e;>
<td width="e;20%"e;> </td>
<td width="e;79%"e;> </td>
<td width="e;1%"e;> </td>
</tr>
<!--end of spacer-->
<tr valign="e;top"e;>
<!--directory menu-->
<td width="e;20%"e;>
<table width="e;100%"e; border="e;0"e; cellpadding="e;0"e; cellspacing="e;0"e;>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
<tr align="e;center"e;>
<td height="e;35"e; background="e;images/submenu.jpg"e; class="e;submenu"e;><a href="e;"e; class="e;under"e;>Link</a></td>
</tr>
</table>
</td>
<!--end of directory menu-->
<!--body of menu-->
<td width="e;79%"e;>
<table width="e;100%"e; border="e;0"e; cellpadding="e;0"e; cellspacing="e;0"e;>
<tr>
<td width="e;1%"e;></td>
<td width="e;95%"e;>
<?
include('somepage.php');
?>
</td>
</tr>
</table>
</td>
<!--end body of menu-->
<td width="e;1%"e;> </td>
</tr>
</table>many thanks malcolmboston..
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
seeing as your interested ill go a little more indepth, ok you have the links on your lef, sayb the page is called index.php just for simplicity, first define some common functions, this isnt the best way but once you have this sorted you can start streamlining
for eg, you have in your "HTML view"
in content put
also when defining links use the format
this is an incredibly simple solution, further work needs developing on this like sanitizing $_GET vars etc, but its a good starting point
Hope this helps you mate
Code: Select all
function DefineContentToShow ()
{
if($_GETї'page2display'] == "e;link1"e;)
{
print "e;the content for this link here"e;;
}
elseif ($_GETї'page2display'] == "e;link2"e;)
{
print "e;the content for this link here"e;;
}
else
{
// not defined, show generic intro
print "e;Generic Intro here"e;;
}
}Code: Select all
/---------------\ /-------------------------------\
| | | |
| link | content
| | | |
\---------------/ \-------------------------------/Code: Select all
<?php DefineContentToShow (); ?>Code: Select all
<a href=\"e;index.php?page2display=link1\"e;>First Link</a>
<a href=\"e;index.php?page2display=link2\"e;>Second Link</a>Hope this helps you mate