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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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.