chordsoflife Posted March 2, 2008 Share Posted March 2, 2008 Hey all- I'm trying to follow this guide, and it's not working very well. The goal is to make a very basic content management system. Right now I'm trying to "Switch content with PHP variables". Here is my code: [pre] <div class="menu" style="text-align:center;"> <a href="index.php?page=content">Link #1</a> | <a href="">Link #2</a> | <a href="">Link #3</a> </div> <div class="body"> <?php require_once ("$page.html"); ?> </div> [/pre] That's in my index.php file, and my content.html file is just a bunch of text. The errors I'm getting are: Warning: require_once(.html) [function.require-once]: failed to open stream: No such file or directory on line 16 (The require_once line) Fatal error: require_once() [function.require]: Failed opening required '.html' (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') hewlp! Quote Link to comment https://forums.phpfreaks.com/topic/94045-includecms-help/ Share on other sites More sharing options...
wildteen88 Posted March 2, 2008 Share Posted March 2, 2008 You should use $_GET['page'] rather than $page when retrieving the page variable from the url. Quote Link to comment https://forums.phpfreaks.com/topic/94045-includecms-help/#findComment-481774 Share on other sites More sharing options...
chordsoflife Posted March 2, 2008 Author Share Posted March 2, 2008 I'll wrestle with getting that to work for a while. Much appreciated. I'm just starting in the world of php, so I apologize if what I'm asking is very basic. The general set up is correct though, right? It should work? Edit: Amazing! That didn't take much wrestling at all. PHP is amazing. I wish I knew what was happening though. I get the jist. In due time I suppose, just like everything else. Quote Link to comment https://forums.phpfreaks.com/topic/94045-includecms-help/#findComment-481778 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.