yoda87 Posted January 26, 2012 Share Posted January 26, 2012 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! Quote Link to comment https://forums.phpfreaks.com/topic/255840-php-dynamic-index-and-homepage/ Share on other sites More sharing options...
Proletarian Posted January 26, 2012 Share Posted January 26, 2012 I'm not sure what you're trying to achieve from your vague description. Elaborate. Quote Link to comment https://forums.phpfreaks.com/topic/255840-php-dynamic-index-and-homepage/#findComment-1311533 Share on other sites More sharing options...
bspace Posted January 27, 2012 Share Posted January 27, 2012 do you mean you want to have some code in content.php which displays an image only when the containing page is /index.php look up $_SERVER['PHP_SELF'] Quote Link to comment https://forums.phpfreaks.com/topic/255840-php-dynamic-index-and-homepage/#findComment-1311571 Share on other sites More sharing options...
Ivan Ivković Posted January 27, 2012 Share Posted January 27, 2012 if(!empty($_GET)){ // Load content. }else{ // Put a welcoming image. } Quote Link to comment https://forums.phpfreaks.com/topic/255840-php-dynamic-index-and-homepage/#findComment-1311599 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.