Click here to Skip to main content
15,883,731 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
$id=$_REQUEST['id'];
if($id == ""){
$id = "Home";
$ext = ".txt";
$path = "pages/";
$file = $_SERVER['/home/a7120106/public_html/'] . ($path . $id . $ext);
$contents = file($file);
$string = implode($contents);
echo $string;
}
else{
$file = $_SERVER['/home/a7120106/public_html/'] . ($path . $id . $ext);
$contents = file($file);
$string = implode($contents);
echo $string;
}


This is my code. When I try to load a page other than home for example: Videos. Which by the way exists, I get this:

Warning: file(videos) [function.file]: failed to open stream: No such file or directory in /home/a7120106/public_html/index.php on line 40
Warning: implode() [function.implode]: Argument must be an array in /home/a7120106/public_html/index.php on line 41

I am trying to load content from a text file onto the page using id tags.

Please help, Cheers
Posted
Updated 16-Jul-11 14:58pm
v3

1 solution

It's okay I have fixed the problem.
 
Share this answer
 
Comments
Dr.Walt Fair, PE 16-Jul-11 23:43pm    
Any hints as to what the problem was?
Codemonkey3 30-Jul-11 5:36am    
The problem was that I forgot to re-declare the id variable using the $_GET command in the else statement

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900