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 Template for Single Article?

November 01, 2011 1:37pm

Subscribe [2]
  • #1 / Nov 01, 2011 1:37pm

    stefan1

    8 posts

    I am a bit Lost.

    I am creating my newsroom, which will have three or four unordered lists listing the most recent posts in a few categories.

    Then when user clicks on a single article, it will take them to a page to view just that article (single post…)

    Do I need to make a template for this?
    If so do I set up the tag pair as follows?

    {exp:channel:entries channel="news" limit="1"}
        <h2>{title}</h2>
    <p>    {body}<br />
    {/exp:channel:entries}

    Basically setting the limit to one?

    To sum it up, I dont quite understand the play between an archive template and a single template???

  • #2 / Nov 01, 2011 2:36pm

    John St-Amand

    865 posts

    Yes, that’s essentially how it’s done.  You CAN do it with a single index template doing the work by setting a bunch of conditionals, but it slows performance so a separate template for “view” is probably best.

  • #3 / Nov 01, 2011 2:45pm

    lincolnpixel

    83 posts

    Hi Stefan

    I am a bit Lost.

    I am creating my newsroom, which will have three or four unordered lists listing the most recent posts in a few categories.

    Then when user clicks on a single article, it will take them to a page to view just that article (single post…)

    Do I need to make a template for this?
    If so do I set up the tag pair as follows?
    {exp:channel:entries channel="news" limit="1"}

    {title}

      {body}
    {/exp:channel:entries}

    Basically setting the limit to one?

    To sum it up, I dont quite understand the play between an archive template and a single template???

    You can use a single template to display both the listing of entries and the individual entry. On EEinsider there is an article with this approach Simpler URLs with a Single Template

    http://eeinsider.com/articles/simpler-expressionengine-urls-with-a-simple-template/

    Check the tip

  • #4 / Nov 01, 2011 2:54pm

    stefan1

    8 posts

    Hey guys thanks for the help and the link, I am reading it now.

  • #5 / Nov 01, 2011 4:26pm

    John St-Amand

    865 posts

    If you haven’t done so already, reading Train-ee.com‘s free tutorial “building a small business website” is a fantastic primer for working in EE.

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

ExpressionEngine News!

#eecms, #events, #releases