View Full Version : Hmmmm... PHP +REP
Hey, can anyone link me to an easily understood php include tutorial, how to target it =)
What do you mean, how to target it?
Dentafrice1
19-02-2007, 08:18 PM
<?php
include "file.php";
?>
OR
<?php
include ("file.php");
?>
Or
<?php
include 'file.php';
?>
Or
<?
include "file.php";
?>
or
<?
include ("file.php");
?>
<?
include 'file.php';
?>
or
<?
$page = file_get_contents($page);
echo $page;
?>
Lol, one way would of been good enough :P
Dentafrice1
19-02-2007, 10:18 PM
I know I was just bored and wanted to show all the ways to include something :P
Denta, I know how to include a file but how to target the include like so when you click on 'News' the include changes from including the main to 'news'
Isolde
20-02-2007, 12:56 PM
google it ?
You could just use the $_GET function
<?php
$page = $_GET['page'];
switch($page){
default:
include('main.html');
break;
case "news":
include('news.html');
break;
}
?>
If i understood you, thats what you mean.
You'd go to
index.php?page=news
to load news.html
or just index.php
to load main.html
If you mean change the included page without page load, you'd have to use AJAX.
yeah, that's it, thomas :) thanks! would I have to edit any of that code?
Well you'd obviously have to put it in the right part of your layout code and to add another page to it you would change it to:
<?php
$page = $_GET['page'];
switch($page){
default:
include('main.html');
break;
case "news":
include('news.html');
break;
case "anotherpage":
include("anotherpage.html");
break;
}
?>
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.