Jump to content

PHP dynamic index and homepage


yoda87

Recommended Posts

Hello everyone, i have this page in my website called "index.php":

    <?php include("include/open_conn.php");?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>name site</title>
    </head>
    <body>
    <div id="container">
    <?php include("include/header.php");?>
    <?php include("include/content.php");?>
    <?php include("include/footer.php");?>
    </div>
    </body>
    </html>
    <?php include("include/close_conn.php");?>

 

The content change dinamically with this code "content.php":

    $pages_dir = 'pages';
    if (!empty($_GET['menu']))
    {
    $pages = scandir($pages_dir, 0);
    unset($pages[0], $pages[1]);
    $menu = $_GET['menu'];
    if (in_array($menu.'.php', $pages))
    {
    include($pages_dir.'/'.$menu.'.php');
    }

 

So, when i change the page the url will be " index.php?menu=nameofmypage ". But now i want to put an image only in my index.php page, a sort of welcome to the users, but with this codes the image will appear in all the other page because i change only the content.

I know that i could create a page named "home.php" and do all i want, but i want to change the first page that the user see when he types the address of my website.

 

thank you!

Link to comment
https://forums.phpfreaks.com/topic/255840-php-dynamic-index-and-homepage/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.