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.

New to 2.0: how to use segment variable for category along with entry id?

February 25, 2010 7:31pm

Subscribe [1]
  • #1 / Feb 25, 2010 7:31pm

    erfi75

    34 posts

    Hello,

    [Edit: moved to: ]http://ellislab.com/forums/viewthread/147417/]

    I recently upgraded to 2.0 and am trying to reconstruct some semblance of my old galleries via channels. I figured out how to get the categories to display using the following:

    {exp:channel:categories channel="gallery1" style="linear"}
    
    <a href="http://{path=pikchaz/testingchannel}">{category_image}</a>
    
    <strong><a href="http://{path=pikchaz/testingchannel}">{category_name}</a></strong>
    
    
    <span class="quiet">{if category_description}{category_description}{/if}</span>
    
    
    
    {/exp:channel:categories}

    Then, I tried to recreate a “recently added” display where each thumbnail is linked to that photo’s full-size display in the template “pikchaz/testingchannel”. Here’s what I tried:

    {exp:channel:entries  channel="gallery1"  orderby="date"  limit="5" }
    
        <a href="http://{entry_id_path=pikchaz/testingchannel}">{img_thumb}</a>
    
    {/exp:channel:entries}

    This ALMOST does what I want, but it is ignoring my categories (with the result that the testingchannel template just goes through all the images in the channel, rather than limiting itself to the category of the thumb a user clicked).

    I’ve read a lot of the support forums and documentation, and I think I need to use segment variables so that instead of getting a link like /pikchaz/testingchannel/46 I can get a link like /pikchaz/testingchannel/C6/46 (where C6 is a category and 46 is the entry id for the image).

    Does this make sense, or is there another approach to accomplishing a four-part URL with the last two parts being generic variables?

    You can see what’s happening at: http://www.ericfichtl.org/index.php/pikchaz/index/

    Thanks in advance. I’m stuck on this.

    Eric

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

ExpressionEngine News!

#eecms, #events, #releases