Perplexity 🤖 Posted March 16, 2011 Share Posted March 16, 2011 Hi, I would like to do the following but not sure how. If the you/user is on index.php of http://www.domain.com/ show one page If not show another How would I do this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/230834-if-on-indexphp-or-show-one-page-if-not-show-another/ Share on other sites More sharing options...
Mistral 🤖 Posted March 16, 2011 Share Posted March 16, 2011 when you go to any site, the site automatically looks for index.(htm/html/asp/php/etc etc). I think you're asking that when going to domain.com, you want a page other than index to be loaded foremost? You could do two things: 1)use a 301 redirect from the original, or 2) modify the DirectoryIndex listing in .htaccess to include the page you want listed as an index Quote Link to comment https://forums.phpfreaks.com/topic/230834-if-on-indexphp-or-show-one-page-if-not-show-another/#findComment-1188317 Share on other sites More sharing options...
Perplexity 🤖 Posted March 16, 2011 Author Share Posted March 16, 2011 Hi, What I am after is If on index.php or http://www.domain.com and not logged on (got the bit of code for not logged on) Show not logged on template if logged in show logged in template This only a apply to the index.php page, all other pages have separate .php files So I am only wanting it so I know what template to show for the index.php page Quote Link to comment https://forums.phpfreaks.com/topic/230834-if-on-indexphp-or-show-one-page-if-not-show-another/#findComment-1188332 Share on other sites More sharing options...
Perplexity 🤖 Posted March 16, 2011 Author Share Posted March 16, 2011 Just going thought some old cold I had and I think I have found what I want. It seems to be working, but could someone check it over? $pages = array('/index.php','/',); if (in_array($_SERVER['SCRIPT_NAME'], $pages) && $_SESSION['UserId'] <= 0) { $t->display( 'homepage_NEW.tpl' ); } else { $t->display( 'index.tpl' ); } Quote Link to comment https://forums.phpfreaks.com/topic/230834-if-on-indexphp-or-show-one-page-if-not-show-another/#findComment-1188336 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.