Forum Moderators: coopster
I know nothing about php but have been at the tutorials .. although knowing where to start (Please don't say, "At the beginning, stupid!") is difficult.
I assume the pages need to be prepared for php and named ******.php
Can the include be a snippet?
Any good example one can point me to?
Thanks
Call this file say index.php
<?
$page_title = "Home";
$content ="<p>This text well go in the box!</p>";
include("default_template.php");
?>
then create one called default_template.php
And include your template in this file placing the <?= $content;?> where you want the text to appear eg...
<html>
<head>
<?= $page_title;?>
</head>
<body>
<p>welcome to my default template, this is used on every page</p>
<p>
<?= $content;?></p>
</body>
</html>
I understand that part .. sort of, but I want to have:
link1
link2
link3
in one location
and when those links are clicked, call
<?= $content1;?>
<?= $content2;?>
<?= $content3;?>
I know this isn't right, but ..
----------------------------
<?
$page_title = "Home";
$content ="<p>I have 3 sections!</p>";
include("default_template.php");
?>
then create one called default_template.php
And include your template in this file placing the <?= $content;?> where you want the text to appear eg...
<html>
<head>
<?= $page_title;?>
</head>
<body>
<p>welcome to my page. Tese are my various sections</p>
<div1>These are my sections
<a href="content1">Section1</a><br>
<a href="content2">Section2</a><br>
<a href="content3">Section3</a>
</div>
<div2>
<?= $section[1,2,3];?></div>
</body>
</html>
<?php
IF(!$main) {
$main = "Home";
}
if(!stristr($main, "/")) {
if (is_file($main . ".php")) {
include($main . ".php");
}
else {
echo "404 - Not found";
}
}
else {
echo "What do you think you are doing?";
}
?>
Then, you simply link as:
<a href="?main=Info" title="Information">Info</a>
This means that you have to have a page called Info.php
Home.php will in this example be the default page.
I dont use this "crap" anymore..
If you are interested in flat-files, you can see a nice tutorial on www.evolt.org about searchfriendly urls.
[evolt.org...]
[evolt.org...]
ps. you *have* to update with the part II...