Results 1 to 5 of 5

Thread: How to detect if page is site root in template?

  1. #1
    New user
    Join Date
    07-19-10.
    Location
    Russia
    Posts
    26

    Default How to detect if page is site root in template?

    By default the fe_page.tpl adds $this->class to body class="
    I want to set special class to body if it's site root.

    For example, if user on the index.html body has an "index" in class attribute, else it has nothing.

  2. #2
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to detect if page is site root in template?

    You can use global $objPage to check the alias or id I think.
    global $objPage;
    if($objPage->alias == whatever)
    Code:
    global $objPage;
    print_r($objPage);
    will show you the Page object vars available

  3. #3
    New user
    Join Date
    07-19-10.
    Location
    Russia
    Posts
    26

    Default Re: How to detect if page is site root in template?

    Hmm..I thought that there is some predefined function or property in $this object in the template, isn't it?

  4. #4
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to detect if page is site root in template?

    Code:
    print_r($this);
    will show you what is passed.

  5. #5
    New user
    Join Date
    07-19-10.
    Location
    Russia
    Posts
    26

    Default Re: How to detect if page is site root in template?

    Quote Originally Posted by ramjet
    Code:
    print_r($this);
    will show you what is passed.
    Ok, thanks. I've already done the task with GLOBAL as you shown.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •