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.

Display entries based on category name in url

December 20, 2007 4:52am

Subscribe [3]
  • #1 / Dec 20, 2007 4:52am

    ronin

    8 posts

    URL: http://www.sitename.com/templategroup/template/category/categoryname

    {exp:weblog:entries weblog={weblog}}
            <div class="container">                
                    <div id="post" class="content">
                        <h2><a href="http://{url_title_path={weblog}/entry/}">{title}</a></h2>
    <p>                    <ul class="category"><br />
                        {categories}<br />
                            <li><a href="http://">{category_name}</a></li><br />
                        {/categories}<br />
                        </ul><br />
                        {summary}<br />
                        <div class="meta"><br />
                            </p><h3><a href="http://{url_title_path={weblog}/entry/}">Read the article</a></h3>
    <p>                    </div><br />
                    </div><br />
                </div><br />
            {/exp:weblog:entries}


    Somehow the entries are showing but not being filtered by the category name.

    I checked, i do not have a template group or template named “category”.

    Any idea?

  • #2 / Dec 20, 2007 11:53am

    PXLated

    1800 posts

    Your category code is just going to list the categories an individual post is assigned to.
    ——-
    There doesn’t have to be an individual template for category as the URL tells EE that you want to just list certain posts assigned to the category in the URL…In the URL example you show, the word “category” (segment_3) is the trigger word that tells EE that you want to just list entries for a category. The “categoryName” is the name of the actual category you want to display. They will display using any multi-entry template you want or specify. Typically it’s the index (home) template.
    Now, that said, using category and categoryName are options you need to setup/specify in Admin. The standard… templateGroup/template/C10 ...uses the category ID.

  • #3 / Dec 20, 2007 12:06pm

    ronin

    8 posts

    I understand that we do not need an individual template for category. I am just doing that because I wanted a different kind of layout but this is beside the point.

    I have already specified in the Admin to use “category” as keyword and to use category names instead of ID. But it is still not filtering.

    But it works if i use the category ID (like “C1”) , the system seems to be ignoring the “category” keyword in the url.

    Is there a way to use the category names? Any idea?

  • #4 / Dec 20, 2007 12:37pm

    PXLated

    1800 posts

    I understand that we do not need an individual template for category.

    But you mentioned that you couldn’t find such an animal, hence my response. It wasn’t clear you understood that.

    I have already specified in the Admin to use “category” as keyword and to use category names instead of ID

    So,just to make sure,  the check box is Yes for category url titles and the trigger word you specified is “category”

    But it is still not filtering. But it works if i use the category ID (like “C1”) . Is there a way to use the category names?

    If you have those set correctly, it should work. Category ID will always work even if you specify category names.

    Do you have a url we can take a look at.


    PS: I’m off to meetings for the day, hopefully someone else will pick this up.

  • #5 / Dec 20, 2007 12:45pm

    ronin

    8 posts

    But you mentioned that you couldn’t find such an animal, hence my response. It wasn’t clear you understood that.

    Ahh.. okay. I was just stating it to make it clear that the “category” doesn’t not conflict with any existing template or groups named “category”. Sorry for the confusion.

  • #6 / Dec 21, 2007 11:52am

    ronin

    8 posts

    I amended the tag

    {exp:weblog:entries weblog="{weblog}" orderby="date" sort="desc"  disable="member_data|trackbacks"}

    And somehow it works now. Not sure exactly why though, maybe one of the parameters triggered it.

  • #7 / Dec 21, 2007 12:00pm

    Boyink!

    5011 posts

    I’d guess it was getting the quotes around the weblog variable.

  • #8 / Dec 23, 2007 2:52pm

    ronin

    8 posts

    You’re probably right!

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

ExpressionEngine News!

#eecms, #events, #releases