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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.