• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

php Include links

hey, I figured out an easy way to get this "include link" to work.

Your links look like this:
PHP:
<a href="?page=#">Page</a>

you stick this somewhere:

PHP:
if ($page=#)
{
$pageid=page.txt
}

then where you want the .txt to come up you put:
PHP:
include ('$pageid')


the # is a variable number. You just add another
PHP:
if ($page=#)
{
$pageid=page.txt
}
for every link you have.
 
I really don't get what you want... I already wrote the source code which is similar what you mentioned above except that one is in Perl.
 
When people say certain scripts are faster it is usually milliseconds apart and for a small site it would make even less of a difference
 
Dawizman... that is not an easy way to do it... that seems like a lot of work for something that simple.


Instead of all that $page_id = somepage.txt, why not just name the page what you were going to name the page_id? So then you just have:
PHP:
<? include "/path/to/your/stuff/$page" ?>
and then call it with index.php?page=whatever.ext. You can even name the pages just numbers, with no extention.
 
Yeah, some with my way... expect that with my way you don't hard code the file names, they are used by their names, and called like that.

You don't need $page1 = "somepage.php";

You can name somepage.php to 1 or something like that and call it like index.php?page=1 and have this in your index page:
PHP:
if ($page) { include "http://www.domain.com/whatever/$page"; } else { include "http://www.domain.com/whever/default_content"; }
Get it now?
 
yeah, I get it, I removed the part of the code that you disagreed with.

btw, sorry for my ignorance, I am new to the language.
 
Back
Top