I used to use this bit of code here:
<?php if (file_exists("$p.php")) { include("$p.php"); } else { include("welcome.php"); }?>
which basically tells the server that if the file in question exists, include it in the content section (or wherever the above code was placed in the page). If it didn't, simply put the page 'welcome.php' in that content area as a means of telling the user an error had occurred. This worked great for a while, but now it doesn't seem to anymore. I'm curious if it has something to do with advances made in the language, which is possible I suppose, but I don't know, and I don't actually know the language, so it's really hard to troubleshoot. Anyway...if you've got scripting experience, you'll notice the above code calls for a variable called 'p.php', which was defined in the site's links like so:<a href="?p=pages/home">home</a>Again, it used to work, and I've tried it for this site, but it's just not working right. I've tried cutting out the if statement and just flat including the pages and that works, everything works correctly except for the include-in-content-area and link-to-using-variable parts (basically, the php part of the page is the faulty part).
So far, I've tried variations on the above code, using a switch function and linking it that way using this article, but nothing seems to work. I've researched at both the w3schools.com and the php.net websites, and still no solution. So posting on forums is my next step.
I haven't done any serious web work in a year or two, and this project is the first that needs to actually be live, usable and working soon, so I need this to work. I don't know PHP in any real way except the research I've done into this problem and the little contact I've had after teaching myself HTML and CSS for the last few years.
That said, help will definitely be appreciated, just be clear, because I'll probably need a good explanation of whatever the answer is if it's at all complicated.
