guitarboy8d6 Posted April 21, 2006 Share Posted April 21, 2006 ok I'm fairly new at php and have been trying to do a site for my mom that she can edit on her own. So I created a file par.php that holds several diffrent includes mainly for style stuff, and content. One of my thing in there is this<?$page[home]="index.php";$page[services]="services.php";$page[health]="health";$page[eff]="effciency.php";$page[about]="aboutus.php";$page[contact]="contact.php";$display=$_GET['page'];file_get_contents ($display);?>I have the browser send a uri of [a href=\"http://www.flairandheat.com/par.php?page=contact\" target=\"_blank\"]http://www.flairandheat.com/par.php?page=contact[/a] to try and open the contents of the contact page. But I get the following Error.Warning: file_get_contents(contact): failed to open stream: No such file or directory in /home/flairandheat.com/www/flairandheat.com/phpsite/par.php on line 17contact.php is in the directory and if you browse to it, you basicly see some text that I want to be displayed where I placed the script.I have a links file that is included on everypage that looks like this.<div class="nav"> <a href="index.php">home</a> | <a href="par.php?page=services">services</a> | <a href="health.php">health</a> | <a href="efficiency.php">efficiency</a> | <a href="aboutus.php">about us</a> | <a href="par.php?page=contact">contact us</a></div>The only file that exestist though is contact.php because I didn't want to go through the trouble of making all the pages if I couldn't get this to work.I am basicly looking for a way to get par.php to display the contents of the files set in the array. I'm not sure were to go to get it working right. I am open to any suggestions that people have and if you can kinda explain why it works that would be great too. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 21, 2006 Share Posted April 21, 2006 <?$page[home]="index.php";$page[services]="services.php";$page[health]="health";$page[eff]="effciency.php";$page[about]="aboutus.php";$page[contact]="contact.php";file_get_contents ($page[$_GET['page']]);?> Quote Link to comment Share on other sites More sharing options...
guitarboy8d6 Posted April 22, 2006 Author Share Posted April 22, 2006 I copy and pasted dirertly to there and it still gives me the same error.Warning: file_get_contents©: failed to open stream: No such file or directory in /home/flairandheat.com/www/flairandheat.com/par.php on line 15 Quote Link to comment Share on other sites More sharing options...
Barand Posted April 23, 2006 Share Posted April 23, 2006 [code]<?php$page['home']="index.php";$page['services']="services.php";$page['health']="health";$page['eff']="effciency.php";$page['about']="aboutus.php";$page['contact']="contact.php";if (isset($page[$_GET['page']])) { $content = file_get_contents ($page[$_GET['page']]);}else { $content = '';}?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.