All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

3rd level template group

lukemh 2 Apr 2012 20:35 question, complete

most complex pages end up doing:

 
{if segment_3 == "podcasts"}

{exp:channel....

{/if}

{if segment_3 == "articles"}

{exp:channel....

{/if}


It would be great to provide a tag for a low variable group and the right variable (template snippit) would be loaded from that group based on a url segment.

that would be awesome.

Thanks.

Replies

  1. Low 3 Apr 2012 07:44

    Not sure I follow 100%, but do you mean something like this?

    {exp:low_variables:foo group="1" filter="{segment_3}"}


    ...which would output a variable in group 1 based on the filter given?

  2. lukemh 3 Apr 2012 14:49

    I wrote a massive reply, and accidentally closed the tab, loosing it all. :(

    in effect, yes, I would like to be able to load templates very early like snippits for the purpose of splitting a template up into smaller more manageable sections based on the url segment data - but you a right this is a like a filter or regex search for a variable.

    standard embed is too late, and I want them early like a straight replace like snippits.

    i assume you will have to do a url segment mapping in your addon because the low variable snippit loading would be before the template parser fills in that param?

    To be honest my ideal would be to have them be actual templates in the template manager like this template group:

    ├── library
    │ ├── entry.php
    │ ├── entry_article.php
    │ ├── entry_podcast.php
    │ └── index.php

    entry.php would contain the tag to load a subtemplate early like a snippit based on the url (no if statements).

    hope that helps.
    thanks for your great work low.

  3. Low 4 Apr 2012 10:44

    I think what you're looking for is a solution like using one template to figure out what other single template you need to embed. Kind of like a routing mechanism for a single template group.

    You could do this with either php in your template or something like Switchee, is my guess.

  4. lukemh 4 Apr 2012 15:38

    Yes, but i dont want to use standard embeds, redirects, or have to hard code all possibilities ( i could use segment_3 i suppose - but then I would have to use embed and not snippets.)

    I think I will need to build it myself. thanks for all your help Low.