Hello all. I am Jordan, and I am a beginner with PHP. Bare with me.
Ok, so my website is http://killinginthename.com. I use Wordpress for my blog. I also use a dynamic include to call my pages for my website. The index.php for my website is this:
[php]<?php get_header(); ?>
<div id="container">
<div id="content">
<div id="content">
<?php if (isset($_GET['x'])) {
if (strpos($_GET['x'], "/")) {
$dir = substr(str_replace('..', '', $_GET['x']), 0, strpos($_GET['x'], "/")) . "/";
$file = substr(strrchr($_GET['x'], "/"), 1);
if (file_exists($dir.$file.".php")) {
include($dir.$file.".php");
} else {
include("default.php");
}
} else {
if (file_exists(basename($_GET['x']).".php")) {
include(basename($_GET['x']).".php");
} else {
include("default.php");
}
}
} else {
include("default.php");
} ?>
</div><!-- #content -->
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>[/php]
Ok, so I have my pages and all, but I want to use more dynamic includes to make kinda a CMS type thing for my content. Like, for my tutorials, I want to use a dynamic include to call the category of the tutorial, and then the tutorial file.
I tried to do this, but it didn’t work. I made a new folder in the root directory called test. I made an index.php file and a categories.php file. I wanted the categories page to show when no other pages are showing. Kinda as the default page.
How do I use an include to link together the two includes? Because there is already an include to call my other pages. PHP still confuses me a bit. W3schools.com has been helping.