ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Some help?

July 21, 2010 4:05pm

Subscribe [2]
  • #1 / Jul 21, 2010 4:05pm

    Digitaal Dier

    75 posts

    Ok guys, I can’t quite seem to get my head around the entire template_group/template vs channels/entries thoughtprocess. I’ve set up the following template groups:

    - Home
    - Cases
    - Weblog

    Home is set to default, and the index template has my frontpage in it, which gathers some entries from the channels “cases” and “weblog”, all going smoothly so far. What I can’t quite seem to get my head around, is the following:

    I want a case to show by the url http://www.domain.com/cases/design-for-client (already have htaccess up and running for clean urls). I’m not quite sure what I would put in which template, and then how to link to it. Because as far as I can work out, I’d have to make a template called “case” in the group “cases” in order to accomodate the “detail-template” if you will. Am I mis-understanding something here?

    Thanks!

  • #2 / Jul 21, 2010 4:27pm

    Lisa Wess

    20502 posts

    Have you read The Importance of Semantics? It explains a lot of this interaction and how it works.

  • #3 / Jul 21, 2010 4:38pm

    Digitaal Dier

    75 posts

    Yeah I have, also read some of the UserGuide, but I just can’t seem to get my head around it. Even if I would be ok with a case-url looking like: http://www.domain.com/cases/case/website-for-client, I don’t quite understand what to put into the “case” template under the “cases” template_group… A normal exp:channel:entries expression would trigger the listing of several entries, no? Or would it understand that the “cases” channel-entry should go into the exp:channel:entries for the channel cases? I’m probably just missing one piece of logic, but this is such a huge departure from the normal CMSes I use (MODx Revo, CMS Made Simple) that it’s hard for me to get.

  • #4 / Jul 21, 2010 4:53pm

    Lisa Wess

    20502 posts

    Hi, already - using your example:

    cases = template group
    case = template
    website-for-client = URL title

    then you can use the same template to output multiple cases, so you don’t need a template per case.

    If you visit the template at /cases/case it would by default output a list of entries based on your parameters.  If you add the URL title it will automatically limit itself to that entry.

  • #5 / Jul 21, 2010 4:55pm

    Digitaal Dier

    75 posts

    Ok, I think I understand… So where i wanted to show the case “website-for-client” EE would put that in the exp:channel:entries for the channel in question, but what if I want to show a list of other posts below that? Would I have to use an embed tag?

  • #6 / Jul 21, 2010 5:00pm

    Lisa Wess

    20502 posts

    You could either use conditionals to show the full entry then a list of other entries, or use a second channel entries tag with dynamic=“no” (so it doesn’t cue from the URL) and url_title=“not {segment_3}” so it doesn’t include the initial post.

  • #7 / Jul 22, 2010 4:01pm

    Digitaal Dier

    75 posts

    Hmm… I’m still having some trouble. Most of this is working quite nicely, except for getting posts by category.

    I have a template-group called blog (and a corresponding channel), in which there’s an index template, an “entry” sub-template, and a template called category. I thought that by calling the URL http://www.digitaaldier.nl/blog/category/development I should get all posts marked with the category “development”... It’s however showing all posts… Am I missing something again?

  • #8 / Jul 23, 2010 8:07am

    tidy

    196 posts

    Categories are handled automatically, so you actually don’t need that category template - remove/rename it.
    The word category in a URL is a special trigger that tells EE to show a category instead of all posts.

    So if you load up your blog index template without a category bit tagged on, it will show all posts.
    http://www.digitaaldier.nl/blog/

    But if you load it up with category/categoryname (or category/C1 etc if using category ids instead of names)
    it should just show posts from that category:
    http://www.digitaaldier.nl/blog/category/development (assuming there is a category with url title development)

    You can use the channel categories tag to list out links to all your categories automatically too:

    {exp:channel:categories weblog="blog"}
    <a href="http://{path=blog/index}">{category_name}</a>
    {/exp:channel:categories}
  • #9 / Jul 24, 2010 12:54pm

    Digitaal Dier

    75 posts

    Categories are handled automatically, so you actually don’t need that category template - remove/rename it.
    The word category in a URL is a special trigger that tells EE to show a category instead of all posts.

    So if you load up your blog index template without a category bit tagged on, it will show all posts.
    http://www.digitaaldier.nl/blog/

    But if you load it up with category/categoryname (or category/C1 etc if using category ids instead of names)
    it should just show posts from that category:
    http://www.digitaaldier.nl/blog/category/development (assuming there is a category with url title development)

    You can use the channel categories tag to list out links to all your categories automatically too:

    {exp:channel:categories weblog="blog"}
    <a href="http://{path=blog/index}">{category_name}</a>
    {/exp:channel:categories}

    Thanks for the advice. I’ve been doing some cleaning up (learning as I go), removed the “category” template in the template-group “weblog”, but I still can’t get it to work.

    If I call http://www.digitaaldier.nl/weblog/category/development, I simply get all posts I have, even though I’m certainly I should only get one. I’ve also made sure that only the exp:channel:entries call I want to show the posts doesn’t have dynamic=“no”. I’m kind of at loss here. Any thoughts?

  • #10 / Jul 26, 2010 6:15am

    tidy

    196 posts

    Can you paste your channel entries tag?

    Also, just to check, in Admin > Channel Admin > Global preferences, do you have ‘use category url titles in links’ set to yes and category url indicator set to category?

  • #11 / Jul 26, 2010 6:20am

    Digitaal Dier

    75 posts

    Thanks for the tip. I forgot to set the triggers, but now it still won’t work. The channel-entries HTML is:

    {exp:channel:entries channel="weblog" orderby="date" limit="{embed:showlimit}" dynamic="no"}
                    <div class="weblog">
                        <div class="grid_1 weblog">
                            <div class="date">
                                <div class="container">
                                    <span class="date-d">{entry_date format="%d"}</span>
    
                                    <span class="date-m">{entry_date format="%M"}</span>
                                </div>
                            </div>
                        </div>
                        <div class="grid_6 weblog blog-entry">
                            <h3>{title}</h3>
    <p>                        {blog-introtext}<br />
                            {if blog-bodytext != ""}» <a href="http://{url_title_path=%27weblog/artikel%27}" title="Lees het hele artikel '{title}'">Lees verder…</a>{/if}<br />
                        </div><br />
                    </div><br />
                    <div class="cl"></div><br />
                    {/exp:channel:entries}

    Edit
    Dammit… found it… thought I’d removed dynamic=no, but apparently I didn’t. Sorry guys, false alarm!

  • #12 / Jul 26, 2010 6:24am

    tidy

    196 posts

    glad you got it working - it takes a while to get used to the EE way, but once it clicks things will seem much easier.
    unless you always want to see the same list of entries regardless of url e.g. in a sidebar etc, you would generally not put dynamic=“no” in your tag (by leaving it out dynamic is automatically set to yes)

  • #13 / Jul 26, 2010 6:26am

    Digitaal Dier

    75 posts

    Yeah I accidentally didn’t remove dynamic=no 😊 Thanks for the help guys! 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases