Jump to content

If on index.php or / show one page if not show another?


CBG

Recommended Posts

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

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

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' );
}

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.