Forum Moderators: coopster

Message Too Old, No Replies

Dummy in Need of Direction

will a php include do this?

         

old_expat

9:04 am on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to have a series of links in div1[box]. Depending on which link is clicked, I would like to load a corresponding include in div2[box], rather than reload the page .. or is that a dumb idea?

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

nshack31

10:55 am on Jan 3, 2005 (gmt 0)

10+ Year Member



hi try this...

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>

old_expat

12:13 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi nshak31

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>

DaButcher

12:52 pm on Jan 3, 2005 (gmt 0)

10+ Year Member



Put this inside of the content div:


<?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...