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.

Single-entry URL giving Multiple entries

December 07, 2007 9:22am

Subscribe [3]
  • #1 / Dec 07, 2007 9:22am

    chiltonm

    16 posts

    This is how the URL ends:

    index.php/pfc/individual/1312/

    But it displays two entries.  Yes, there is a template called “individual”.  This is the code it uses:

    {exp:weblog:entries weblog="{master_weblog_name}" show_pages="no"}

    I thought EE interpreted the URL so that it only produced the one entry.  Am I wrong?

  • #2 / Dec 07, 2007 9:47am

    Ryan Irelan

    444 posts

    Can you post the rest of your template code, so we can see the output you’re going for?

    Also, as a general rule, I would always add the limit parameter with a value of 1 (limit=“1”) to this page even thought it’s an individual entry page. If someone comes to your site on a incorrect URL like http://example.com/index.php/pfc/individual/foo EE will display every entry it has. For large sites with a lot of entries this can be a serious performance issue.

  • #3 / Dec 07, 2007 10:49am

    chiltonm

    16 posts

    Here’s the code:

    {exp:weblog:entries weblog="{master_weblog_name}" show_pages="no"}
    
    <div class="entry">
    <a href="http://{link}">{title}</a>
    
    <b>{publicationauthor}, {publication}, {publicationdate format='%d %F %Y'}</b>
    
    {comment}
    
    <div class="rubric">
    Filed in: 
    {categories backspace="8"}
    
    {category_image} <a href="http://{path=pfc/index}">{category_name}</a> •
    
    {/categories}
    
    
    Filed on: {entry_date format='%d %F %Y'} • <a href="http://{permalink=">Comment({comment_total})</a></div>
    </div><!--entry-->
    
    {/exp:weblog:entries}
  • #4 / Dec 07, 2007 12:45pm

    Sue Crocker

    26054 posts

    What if you try:

    {exp:weblog:entries weblog="{master_weblog_name}" show_pages="no" limit="1"}
  • #5 / Dec 07, 2007 1:27pm

    chiltonm

    16 posts

    Yup, that works fine and, indeed, is the workaround I am currently using.

    It’s just that I’d rather not have to use the workaround.

  • #6 / Dec 07, 2007 2:28pm

    Sue Crocker

    26054 posts

    But it isn’t a workaround. It’s the way you do a single entry page. 😊 There’s a difference.

  • #7 / Dec 07, 2007 2:33pm

    Lisa Wess

    20502 posts

    Out of curiosity, if you remove

    show_pages="no"

    does it restrict to a single entry as expected?

  • #8 / Dec 07, 2007 4:22pm

    chiltonm

    16 posts

    This is what the documentation says:

    http://www.example.com/index.php/blog/comments/147/

    This URL tells EE to display the weblog entry number 147 using the “comments” Template in the “blog” Template Group. So, EE knows what to display and where/how to display it.

    I read that as EE picking up 147 (in this example) and nothing else.


    Lisa,  removing show_pages=“no” doesn’t seem to make any difference.

    I should point out that I am now using limit=1 and that’s working fine.  I thought you could get the same template to alternate between displaying single and multiple entries solely by altering the URL.  If that’s not how EE is supposed to work, fine.  If it is, and I can’t get it to work that way, well, that’s fine too because it’s not, in the great scheme of things, terribly important.

  • #9 / Dec 07, 2007 4:25pm

    Lisa Wess

    20502 posts

    It should work that way, childton.  Can you tell us your URL (the part after index.php) and what each part means? For instance, in that example:

    blog = template group
    comments = template name
    147 = entry id

    or even the full link to the page would be great?

    Also, I would encourage you to create a totally blank template, and place this in it:

    {exp:weblog:entries weblog="default_site" limit="10"}
    {title}
    
    {/exp:weblog:entries}

    view rendered template - that should show the last 10 entries.  Then append an existing entry id or url_title, and it should show only that entry; you can read more about that in The Importance of Semantics.

  • #10 / Dec 07, 2007 5:15pm

    chiltonm

    16 posts

    Well, I never.  I tried your experiment and it worked fine.  I think I can take things from here.

  • #11 / Dec 07, 2007 5:16pm

    Lisa Wess

    20502 posts

    Good to know, do post back if you need more help working through this. =)

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

ExpressionEngine News!

#eecms, #events, #releases