Hi All,
I'm a newbie in PHP. Im working as SQL DBA and thought of creating a website for it.
My plan is to have a single layout and the articles, scripts should be in loaded inside the layout only even if we specify link directly in Browser URL.
I've managed to create a layout with all the menus. So the URL looks like as below
www.mysite.com/index.php?page=script
When the above url is used it will correctly load the script page inside the layout and i've hardcoded the values for the variable in the index page as below.
</script>
<? $pages = Array(
'abtus' => 'abtus.php',
'articles' => 'articles.php',
'home' => 'home.php',
'scripts' => 'scripts.php',
'tips' => 'tips.php',
'forums' => 'forums/index.php',
'stats' => 'stats.php',
'sugg' => 'suggestions.php',
'error' => '',
);
if (isset($_GET['page']) && array_key_exists($_GET['page'],$pages)) {
include($pages[$_GET['page']]);
}
else {
include('home.php');
} ?>
Inside the script page im calling database to provide the links of all my articles and scripts. Here is the problem im unable to solve, I want the URL to be displayed as shown above for all the articles and scripts from the database. I can't hardcode all the links as above into the index page to avoid increase in page size.
Can any one explain me how to do this with an example. :mad:
Thanks for understanding.
Regards,
Sagar