Jump to content

Archived

This topic is now archived and is closed to further replies.

mrwilson

Simple Link Question

Recommended Posts

Hello.  This has to be so easy its embarrasing. 
I am trying to follow this example here [url=http://www.alistapart.com/stories/phpcms/]http://www.alistapart.com/stories/phpcms/[/url], the Swtching content with PHP variables section.

I have followed the instructions on that page and have created the pages required. (very VERY simple pages).
I have created the body and menu sections as required and changed the body include to
<div class="body">
<?php @ require_once ("$page.php"); ?>
</div>

I then created the menus as shown on the link above as in below.

<a href="template.php?page=dogs">The Dog page</a><br />
<a href="template.php?page=cats">The cat page</a>

When I put it all together, absolutly nothing happens except the URL address above changes and shows that I am now on either the cat or dog page.  My question is, is there something I need to include in the code on the $page.php page to give the switch a place to reside?  According to the example, the whole page should be replaced.  Or am I misunderstanding the whole concept?

The trial page I have made is here.  [url=http://lunarcafe.com/tryme/template.php]http://lunarcafe.com/tryme/template.php[/url]

Than you for taking the time to read this.  After reading the code you guys are dealing with I am almost embarrased to post this.  My server does have PHP on it, I have several other PHP pages that work fine.  I just dont know how to use this type of switching.

Share this post


Link to post
Share on other sites
try

<div class="body">
<?php
$page = $_GET['page'];
@ require_once ("$page.php");
?>
</div>

Share this post


Link to post
Share on other sites

×

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.