PDA

View Full Version : Easier than PHP Includes?



tekni
28-11-2006, 05:48 PM
Is there an easier way to do it that PHP Includes?

It takes too much with loads of links tbh.

Luckyrare
28-11-2006, 06:23 PM
PHP includes is one of the most simple functions in PHP, I dont see how you could make it anymore easier mate.


<?php
include("header.inc");
?>
Main content here
<?php
include("footer.inc");
?>

Tomm
28-11-2006, 06:31 PM
Not hard:



switch ($_GET['page']) {
case "home":
include('home.php');
break;
case "about":
include('about.php');
break;
case "contactus":
include('contact.php');
break;
}


Just a quick page example.

tekni
28-11-2006, 06:31 PM
No, I didn't mean like that :P.

I ment without using PHP.

Tomm
28-11-2006, 06:32 PM
No, I didn't mean like that :P.

I ment without using PHP.

AJAX is even more complicated than PHP includes.

Even iframes require more code lol.

It does not get anymore simpler!

tekni
28-11-2006, 06:38 PM
I'm trying to use expandable iframes*

* - Sorry for swearing.

uber
28-11-2006, 06:52 PM
LOL
http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

Josh-H
28-11-2006, 07:43 PM
LOL
http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

Expandable iframes, now thats a new one!

tekni
28-11-2006, 07:49 PM
Expandable iframes, now thats a new one!
It's do-able with some JS code ;)

Splinter
28-11-2006, 08:51 PM
SSI ... in .shtml

<!--#include virtual="/file.html" -->

but php is much easier..

Heinous
28-11-2006, 09:14 PM
AJAX is even more complicated than PHP includes.

Even iframes require more code lol.

It does not get anymore simpler!
Quoting because of sheer truth.

If you wanted no protection at all, you could do:


include("$_GET[p].php");

Agnostic Bear
29-11-2006, 12:57 PM
If your thinking of php navigation, just use this:


<?
if (isset($_GET['page']) && file_exists(''.$_GET[page].'.php')) // if ?page=blah is set, and it exists......
{
include("{$_GET["page"]}.php"); // .....Include the page......
}
else // ......or.......
{
include("welcome.php"); // .......Include the 404 page
}
?>

Simple.

Want to hide these adverts? Register an account for free!