Results 1 to 8 of 8

Thread: Trail and redirect

  1. #1
    User
    Join Date
    07-08-10.
    Location
    Madrid, Spain
    Posts
    145

    Default Trail and redirect

    Hello

    I would like to know how should I do to define a CSS that concern only ul.level_2 li when the page is accessed through a redirect.

    I have set a menu and some first entries are "chapters" for wich there is no article. When I click one of these items the page redirect to the first sub nivel.
    In that case, the "trail" class doesn't appear in the parent (ul.leve_1 li).

    How could I solve it ?

    Is there an other method to manage this, rather than a redirect ?
    Any special class that I wouldn't have seen?
    Should I modify a templete (if so, wich one)?

    Thank's
    Eric
    Contao 2.8 -> 3.0
    Evizer Web Agency

  2. #2
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Trail and redirect

    You cannot target html elements with css based on the redirect. :? You should solve that in the nav_ template. If you copy the default into the templates folder (nav_default.tpl) and rename it, you can select the new template for your navigation module. The templates are parsed as php files so you can the add classnames to the menuitems based on the redirection :D

  3. #3
    User
    Join Date
    07-08-10.
    Location
    Madrid, Spain
    Posts
    145

    Default Re: Trail and redirect

    Thank's for the clue, but ...

    my level on PHP is not high enough to solve it. I suppose you were talking of nav_default.tpl, I read it but I don't know how to detect if the page come from a redirect page and how to code it.

    Anyone could help me to do it?

    Thank's
    Eric
    Contao 2.8 -> 3.0
    Evizer Web Agency

  4. #4
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Trail and redirect

    Actually, you do not need to be a PHP expert. Look into server variables and you can figure it out. add <?php print_r($_SERVER); ?> to the template and then you'll see the contents. There might be a refer item in there that is of help, though that is not always as reliable. If you have full controll over the url that the menu links to you can add GET variables in the url (page.html?prev_page=this.html). You can read them using the framework, or take a sneek peek in the $_GET global variable. I think that this information, and a little effort would do it

  5. #5
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: Trail and redirect

    Quote Originally Posted by Vera
    You cannot target html elements with css based on the redirect. :? You should solve that in the nav_ template. If you copy the default into the templates folder (nav_default.tpl) and rename it, you can select the new template for your navigation module. The templates are parsed as php files so you can the add classnames to the menuitems based on the redirection :D
    Reminds me of Medianomoly's post about "Increasing Contao's visibility & usage internationally" :D

  6. #6
    User
    Join Date
    07-08-10.
    Location
    Madrid, Spain
    Posts
    145

    Default Re: Trail and redirect

    Well, Vera.... thank you for your help but I really don't know what to code.
    For sure <?php print_r($_SERVER); ?> gives me a lot of information but I don't know what to do with it.

    I think I've got a solution much simplier. I'll affect a class to these "chapter" page and try to simulate the trail class...

    Regards
    Eric
    Contao 2.8 -> 3.0
    Evizer Web Agency

  7. #7
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: Trail and redirect

    Quote Originally Posted by evantro
    I would like to know how should I do to define a CSS that concern only ul.level_2 li when the page is accessed through a redirect.
    What effect are you trying to accomplish?

  8. #8
    User
    Join Date
    07-08-10.
    Location
    Madrid, Spain
    Posts
    145

    Default Re: Trail and redirect

    well i solved it. just wanted to avoid a background color...

    I just wanted the trail class be applied to an upper level when a page was load with a redirect.

    For example the page http://evizer.com/yogastudio/index.php/marta-mahou.html. The upper level "Profesoras" doesn't have any content and redirect to the sublevel.
    In this case, the menu is generated without the trail class. I had to define a class to theses pages to block the effect.

    Like this it work
    Eric
    Contao 2.8 -> 3.0
    Evizer Web Agency

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
  •