A little help with Include PHP

DarkDragonLord

New Member
Messages
782
Reaction score
0
Points
0
Hi guys, i always used a code to make my links in my webpage. But i dont know why it just dont work anymore.
Help anyone?



In the index.php where is the layout, the place i want to show the content i add this: (the $ddl was $page but since $ is just an array, then i can put any name)

PHP:
<?php if(isset($ddl)) { include ("$ddl.html");} else { include ("main.html"); } ?>

(main.html is the home/starter 'content')

THEN, the link would be:
HTML:
<a href="index.php?ddl=rospr" target="_self" title="Custom RO Sprites">Sprites</a>

then, when i click in link, the place where i added the php include, would change and put the rospr.html content. The thing is: ISNT working anymore. Did i misstyped anything ? i was testing here at x10 but just stay the main.html, do not change to the page i call in the link.

THANKS, who make this thing work, i'll give a cookie.

Cya
DDL
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Can you try this and tell me if it works.

PHP:
<?php if(isset($_GET[ddl])) { include ($_GET[ddl].".html");} else { include ("main.html"); } ?>

That should, in fact, make it work.
 

DarkDragonLord

New Member
Messages
782
Reaction score
0
Points
0
The php god has spoken :O
Ya, that worked really nice!

Thanks xDDD~

Btw, i was trying edit but since its updating forums, the edit just give me internal server error.

There is any way to include a 404 error when none $ddl or main.html are not found? to not show this:
PHP:
Warning: include(roscreen.html) [function.include]: failed to open stream: No such file or directory in /home/darkdrag/public_html/test/index.php on line 188

Warning: include() [function.include]: Failed opening 'roscreen.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/darkdrag/public_html/test/index.php on line 188

So, i'llmake a 404.html and when someone put the link wrongly (like index.php?ddl=rosrp instead of rospr) it shows the 404 not that bunch of include errors?


Thanks again.

btw, you are updating forums so i cant give you the points o_O i just noticed now >.< when come back i'll give ya

DDL
 
Top