html combined with php include - any good alternative?

page 1 of 1 8 total items

Cancel

I have a html site and to display the content I use a php include. That means, if you klick on the links the content will appear in the area that is set up with the include (see below).
Well, after changing my webspace provider this system does not work anymore. Does anyone know a method how to display the content anyway without changing the other files (file.php)? You know, I have too many files to rewrite them and make them compatible with the system. So the files must stay and the links must remain like this:

Code:
index.php?site=file

Code:
(...)
if (!isset($site)) { $site="start"; }
if (file_exists($site.".php")) { include($site.".php"); } else { echo " <b><center></center></b> "; }
?>

Would be great if someone could help.

Cancel

Instead of using if/else statements, use a switch statement. Heres a link to a tutorial writting on the subject: http://xangelo.com/tutorials.php?tid=7

  • Nov 20, 2005
Cancel

Thank you for your support but I tried it out and got the following thing:

parse error, unexpected T_STRING

Unfortunately it doesn't seem to work. I adjusted home.php in the code to start.php like I needed it and id to site.

Cancel

I suggest you look to a more tech savvy forum then MT for help on PHP. I can't really help you since I know next to nothing about PHP, but Neowin members will be easily able to help you. ^^

  • Nov 24, 2005

yamazaki

yamazaki

what the ??

Cancel

ok, first the code you provide is not secure at all. dont ever include a file by passing the variable from url.
you can try using switch instead
[code]
<?php

$site = $_GET["site"];

switch($site)
{
case 'about':
include "about.php";
break;

case 'works':
include "works.php";
break;

default:
include "index.php";
break;
}
?>
[/php]

let me know if you need any help

Signature
	Image

signature by: k1ru ^_~ thanks alot girl
thanks to k1ru for the signature ^_~

xshintax

Gif files are Compu$erve

Cancel

I don't think I understand. Is it because your new host doesn't have PHP? If that's the case use SSI maybe... Or ASP if you are using Windows (server)...

Wtf is your problem?!?

Why the f*** do I need to use proprietary filetypes in my signature and avatar? Stupid Minitokyo... STUPID COMPU$ERVE! Use png instead.

  • Dec 02, 2005

yamazaki

yamazaki

what the ??

Cancel

if his new host doesnt support php, then he wouldnt even get this error in the first place

parse error, unexpected T_STRING

Signature
	Image

signature by: k1ru ^_~ thanks alot girl
thanks to k1ru for the signature ^_~

xshintax

Gif files are Compu$erve

Cancel

Oh yeah, XP.

Wtf is your problem?!?

Why the f*** do I need to use proprietary filetypes in my signature and avatar? Stupid Minitokyo... STUPID COMPU$ERVE! Use png instead.

  • Dec 03, 2005

page 1 of 1 8 total items

Back to Computers & Internet | Active Threads | Forum Index

Only members can post replies, please register.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read more.