Jump to content

Links pull info from separate php file to main table


Dhaling2011

Recommended Posts

From what I know, PHP code blocks can be broken apart to shove over types of codes inside.  In your case it's HTML.  I believe one of your conditioning statements isn't being finished off, and I think this is what's causing your problems.  My major concern is whether or not this type of include process actually works.  I attempted it earlier today in place of the scripts I had told you about in the origins of this post, and was unsuccessful.  I could get a page to be included when the script first ran, but not no change on links.  I may have not given it a fair shake, because I aim to use the proper tools for the designed job.  I don't know what your site plans are, but from what I've seen, there's no need to use php solely for the intent of dynamically changing the contents of an area.  There are other tools for that.

 

That being said, I will try to help you figure this out using your original methodology.  But in order to do that, could you please post your entire index.php.

Link to comment
Share on other sites

Thank you for your help! The reason why I wanted php is because I am planning on doing more php later on.. I do know I have the fallback of the Dynamic menu..which worked. But I really thought this would :( Here is my entire index page..

<html>
<head>
<?php
while (!isset($_GET['link'])){
$link="main";
}

?>

<title>tester3</title>

</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (tester3.psd) -->
<table id="Table_01" width="813" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td colspan="3">
		<img src="images/index_01.gif" width="733" height="1" alt=""></td>
	<td colspan="2" rowspan="4">
		<img src="images/top3.gif" width="80" height="229" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/top1.gif" width="125" height="227" alt=""></td>
	<td colspan="2">
		<img src="images/top2.gif" width="608" height="89" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/title.gif" width="608" height="138" alt=""></td>
</tr>
<tr>
	<td colspan="3">
		<img src="images/index_06.gif" width="733" height="1" alt=""></td>
</tr>
<tr>
	<td colspan="5">
		<img src="images/profit.gif" width="813" height="39" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_08.gif" width="202" height="1" alt=""></td>
	<td colspan="2" rowspan="2" background='images/main.gif' WIDTH=590 height='100%' align='center' valign='top'><b>


<?php
 ($link == "hours"){
include('hours.php');
} elseif ($link == "location"){
include('location.php');
} elseif ($link == "about"){
include('about.php');
} elseif ($link == "members"){
include('members.php');} 
} elseif ($link == "staff"){
include('staff.php');
} elseif ($link == "songs"){
include('songs.php');
} elseif ($link == "members"){
include('members.php');
elseif ($link == "faq"){
include('faq.php');
elseif ($link == "contact"){
include('contact.php');
elseif ($link == "fund"){
include('fund.php');
elseif ($link == "newsletter"){
include('newsletter.php');
} else {
include('main.php');
}
?>




	</td>
	<td rowspan="2" background='images/right.gif' WIDTH=21 height='100%' align='center' valign='top'></td>
</tr>
<tr>
	<td colspan="2" background='images/menu.gif' WIDTH=202 height='100%' align='center' valign='top'><b>


<a href='?link=main'>Home</a>
<br>
<a href='?link=hours'>Hours</a>
<br><a href='?link=location'>Location</a>
<br><a href='?link=about'>About</a><br>
<a href='?link=members'>Members</a><br>
<a href='?link=staff'>Staff</a><br>
<a href='?link=songs'>Songs</a><br>
<a href='?link=newsletter'>Newsletter</a><br>
<a href='?link=fund'>Fundraiser</a><br>
<a href='?link=Contact Us'>Contact Us</a><br>
<a href='?link=faq'>FAQ</a><br>





	</td>
</tr>
<tr>
	<td colspan="5">
		<img src="images/index_12.gif" width="813" height="50" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/spacer.gif" width="125" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="77" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="531" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="59" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="21" height="1" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>

 

Link to comment
Share on other sites

ok. found your error.

 

to include in the head

<?php 
if (!isset($_GET['link'])){
$link="about";
?>

 

and in the place you want it to call the page:

<?php
include('about.php');
}elseif ($link == "about"){
include('about.php');
} elseif ($link == "news"){
include('news.php');
} elseif ($link == "admin"){
include('admin.php');
} elseif ($link == "focus"){
include('focus.php');
} else {
include('about.php');
}
?>

 

The problem was you weren't defining what page to include initially.  look at the first line of the second code block.

 

Edit. Never mind the page name changes. i put it on my server to test and used my own links.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.