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.

Weblog, showing entries only for the current category?

November 06, 2008 11:43am

Subscribe [2]
  • #1 / Nov 06, 2008 11:43am

    aaronvegh

    9 posts

    This should be a simple question. I’ve got a bunch of products organized by category. Now, for reasons that are out of scope for this post, I had to use PHP to create my navigation, but I think I have that working correctly. Those links lead to my product_category template with URLs that look like this:

    http://localhost/mdrsite/index.php/mdr/product_category/reception_desk_laminate

    However, on my product_category template, it displays all products, regardless of the category! My code for the product_category template looks like this:

    {exp:weblog:entries weblog:"products"}
                             {title}<br>
                             {description}
                             <a href="http://{path=mdr/product_page}">Details</a>
    
                {/exp:weblog:entries}

    My understanding is that the weblog module parses the URL for the current category, displaying those that match. Hence, the “category” parameter is for showing categories that are NOT the current category. Obviously, I’ve no need for that parameter here.

    Any advice would be appreciated!
    Cheers,
    Aaron.

  • #2 / Nov 06, 2008 11:46am

    aaronvegh

    9 posts

    Okay, immediate update. I was playing with the URLs to try using category IDs rather than the cat_url_title:

    http://localhost/mdrsite/index.php/mdr/product_category/C10

    That works. I would much prefer to be showing the cat_url_title than the ID number; any notion how to do that?

    Thanks!
    Aaron.

  • #3 / Nov 06, 2008 12:04pm

    Mark Bowen

    12637 posts

    Hi Aaron,

    If you go to :

    Admin->Weblog Administration->Global Weblog Preferences

    there is a preference in there called :

    Use Category URL Titles In Links?

    which I believe should do what you are after.

    Hope that helps.

    Best wishes,

    Mark

  • #4 / Nov 06, 2008 12:12pm

    aaronvegh

    9 posts

    Thanks for the tip! I’ve switched it up, but I now take note of the option after that: Category URL Indicator. I need to choose a word (the default there is “category”), that appears in the URL. I note in the User Guide that the word appears like this:

    http://localhost/mdrsite/index.php/mdr/product_category/category/laminate_desks

    However, this doesn’t seem to work. Once again, it shows all products, and still, the category ID works. Is there a problem with my cache? Or do I have to do something else to make this work?

    Thanks,
    Aaron

  • #5 / Nov 06, 2008 12:22pm

    Mark Bowen

    12637 posts

    You may need the limit=“1” parameter in your weblog tag as well. Try this instead :

    {exp:weblog:entries weblog:"products" limit="1"}
    {title}<br>
    {description}
    <a href="http://{path=mdr/product_page}">Details</a>
    {/exp:weblog:entries}

    Hopefully that will help.

    Best wishes,

    Mark

  • #6 / Nov 06, 2008 12:40pm

    aaronvegh

    9 posts

    Hi there,
    That didn’t work; I understand that the limit parameter controls how many items will be displayed. In this case, there are, say, 10 products that I want to show in this category, but all of them, from all categories, are displaying.

    So I guess I’m using ID numbers, eh?

    Thanks,
    Aaron.

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

ExpressionEngine News!

#eecms, #events, #releases