PHP - Internal linking in a page
| From: | Paul Ottar Tornes | Date: | Thu, 31 Oct 2002 22:27:56 +0000 |
| Subject: | PHP - Internal linking in a page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122344@lists.php.net to get a copy of this message | ||
Hi!
I started to learn PHP yesterday, and I have just entered a little problem.
In my index.php file. I have this line:
<? if ($page== '') { $page="main.php" ; } else { $page=$page.""; }
include ($page); ?>
wich controles the main page locaton, just like frames. It makes the files appear in the middle of
the site.
Now over to the problem:
I am making a newsscript with PHP and PostgreSQL. I have now gotten PHP to extract the news from the
database.
I am using numbers as ID for each post. 1, 2 ,3, 4, 5, 6 and so on.
I use them to make a READ MORE link on the news posts.
I am calling my "READ MORE"-page for main2.php, this contains PHP code that finds the
story thats connected to the given number. and I use this to make it appear: <a
href="main2.php?id=row['id']> sort of speak..
The problem:
This link gives me the story:
http://maloyportalen.no/~critical/maloy/main2.php?id=7
But that makes it go on a seperate page.
And this link does not work at all:
http://maloyportalen.no/~critical/maloy/index.php?page=main2.php?id=7
It returns this error:
Warning: Failed opening 'main2.php?id=7' for inclusion
(include_path='.:/usr/share/pear') in /home/critical/public_html/maloy/index.php on line
21
Line 21 is the following:
<? if ($page== '') { $page="main.php" ; } else { $page=$page.""; }
include ($page); ?>
How can I write it so I can use:
http://maloyportalen.no/~critical/maloy/index.php?page=main2.php?id=7
Regards
Paul Ottar Tornes.