Listing Page Getting No Output

Brian Rivet's Avatar

Brian Rivet

30 Apr, 2012 05:37 PM

Hi,

I'm having an issue with a template I'm working on and I'm wondering if you could help. I'm using Structure 3.2.3 on EE 2.4.0.

I have a page that I've set to be a listing page for my products channel, but I'm not using it as a traditional listing page. I want it to display the latest product entry if they just go to the page, but then if they click on a specific product, it uses the same template. For example I want "www.domain.com/products" and "www.domain.com/products/product-structure-url" to use the same template. I basically set it up as a listing because each product will be displayed by itself and I wanted my client to easily be able to add/edit from the structure panel.

The problem I'm having is that when I go to "www.domain.com/products", the Channel Entries tag is giving me no output. It works fine if I go to a specific product ("www.domain.com/products/product-structure-url"), and if I set dynamic=no" it parses the channel entry tag and brings up the latest entry, but then that's the only entry that will ever display.

I'm mainly looking to see if the fact that I'm using it as a listing page and a detail is the problem and if so, can you recommend how to fix it, or if it is not a structure issue at all and more a general EE issue. Here's my template code:

My template basically looks like this:

{exp:channel:entries channel="products" limit="1"} Template HTML code
{/exp:channel:entries} Additional html code

Right now, if I go to "www.domain.com/products" all I get is the additional html that is outside of the channel entries tag, but if I go to "www.domain.com/products/product-structure-url", the template works fine. Is this a structure problem, or a EE problem?

Thanks, I know it's not the clearest explanation,

Brian

  1. Support Staff 2 Posted by Travis Schmeisser on 30 Apr, 2012 05:52 PM

    Travis Schmeisser's Avatar

    You need dynamic="no" on the initial load/listing screen, basically any time you're calling an entry or multiple entries not associated with the current URL. You may want to set some conditionals to show one channel tag if the other segments are empty and TW detail if they're not.

    You're not using template_group/template are you? That's not needed with Structure and your URLs seem a bit weird with an extra segment. If you use {page_url} within a channel tag calling that listings entries you'll see where it goes.

    Does this help?

  2. 3 Posted by Brian Rivet on 30 Apr, 2012 06:29 PM

    Brian Rivet's Avatar

    Hi Travis.

    I'm not using template group/template. The product page that is set to be a listing page has a structure URL of "products" then the individual product pages each have their own Structure URL, so I don't think there's an extra segment. Basically what I'm trying to do is instead of showing a listing of the products on the listing page, just show the latest entry. I thought that if I didn't specify an entry id and the limit is set to 1, it just brings up the latest entry in the channel, correct? I wasn't sure if having it set as a structure listing page affects that functionality at all. I am asking because if I put the same template code into a template and access it as template group/template it works.

    I can try to use a conditional, but if I set it to dynamic="no" then it only brings up the latest entry and nothing else regardless of the fact that the specific product's structure URL is in segment 2.

    If you want to see the specific pagesI'm referring to, here are the URLs:
    "Listing Page" http://lmcases.ehclients.com/products

    detail page:
    http://lmcases.ehclients.com/products/cisco-cts500-32-monitor-case/

    Like I said, I'm aiming to have the listing page just bring up the latest entry like it was a detail page. Almost like a first child redirect except it's going to the latest listing.
    I thought that would happen automatically since I didn't specify an entry id with a parameter.

    Thanks for your help,

    Brian

  3. Support Staff 4 Posted by Travis Schmeisser on 30 Apr, 2012 06:46 PM

    Travis Schmeisser's Avatar

    It works mostly like normal templates. You say it's working on the main screen but not the detail? I think that's why you need conditionals. Have just the latest in the main screen but another conditional for details where you do not have the dynamic param and just the channel param. This will pull the right entry via the URL. Give that a go and let me know. About to hop on a plane, so won't be able to follow up for 6 hours or so.

  4. 5 Posted by Brian Rivet on 30 Apr, 2012 10:55 PM

    Brian Rivet's Avatar

    Thanks Travis. I tried out using a conditional to resolve the issue and was able to make it work.

    Thanks!

    Brian

  5. Support Staff 6 Posted by Travis Schmeisser on 30 Apr, 2012 11:19 PM

    Travis Schmeisser's Avatar

    Awesome!

Comments are currently closed for this discussion. You can start a new one.