Results 1 to 3 of 3

Thread: if this page use this template...

  1. #1
    User
    Join Date
    04-27-10.
    Posts
    134

    Default if this page use this template...

    Hi,

    I'm wondering if it's possible to have a 'page based if function' in a template.
    I am using the videobox extension and want to have a different template for the homepage and the media page.
    On the home page there will be a smaller media box in the right column, sort of a featured media item with a video.
    On the media page I would like the same video displayed but standard size.
    The purpose would be so the client doesn't have to enter in the video twice for the 2 different sizes.

    I was thinking, if it were possible to have the template check if it was on the homepage then it would use part of the template that had set dimensions, if on any other page, then to use the dimensions set in the backend. (or backstage as my friend refers to it )

    Have I explained enough?

    Thanks

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: if this page use this template...

    If it's something that can be done by defining multiple page layouts, I would try that first.

    Specifically for the "Page-Based If" part...

    Code:
    <?php
    // This is inside your template
    global $objPage;
    // You can do it by alias
    if( $objPage -> alias == 'myAlias' ) {  }
    // Or by title
    if( $objPage -> title == 'myTitle' ) {  }
    // Or maybe by ID
    if( $objPage -> id == theId ) {  }
    // Or even by CSS Class
    if( $objPage -> cssClass == 'myClass' ) {  }
    ?>
    Brian

  3. #3
    User
    Join Date
    04-27-10.
    Posts
    134

    Default Re: if this page use this template...

    Thanks for that - Very helpful. Works Perfect, exactly what I wanted. I can now have 1 videobox youtube video at 2 different sizes now on different pages.

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
  •