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.

Issues with pages and embedding templates

November 04, 2011 8:18am

Subscribe [3]
  • #1 / Nov 04, 2011 8:18am

    gelviis

    55 posts

    Hi there,

    I have a page at the URL

    <a href="http://www.example.com/sub/page">http://www.example.com/sub/page</a>

    The is page has two columns; page content and the right hand sidebar

    * The page content pulls in content from the “pages” channel
    * The right hand sidebar pulls in entries from the “news” channel

    If I view the page as a preview i.e…

    http://www.example.com/home/preview (where home is my template group and preview is my template)

    ...then I can see the news coming in from the sidebar (the page displays properly).

    If I then navigate to the URL I set for the page (http://www.example.com/sub/page) then the sidebar doesn’t pull in the news entries (i.e. title and date).

    So it works if I view it in the template, but not at the URL I specify.

    Is this a bug or am I doing something wrong?

    Thanks

    Gregor

    More info:

    v2.3.0 - Build: date 20111011

    Side bar code:

    {exp:channel:entries channel="news" status="open" limit="3"}
       <a href="http://{site_url}news/article/{url_title}">{title}</a>
       {entry_date format="%d %F"} | {author}
      {/exp:channel:entries}
  • #2 / Nov 04, 2011 10:17am

    Robin Berger

    23 posts

    Hi gregormck,

    You cant using

    {site_url}news/article/{url_title}

    because you want render dynamic URI

    Try using this

    {exp:channel:entries channel="news" status="open" limit="3"}
       <a href="http://{url_title_path=news/article}">{title}</a>
       {entry_date format="%d %F"} | {author}
    {/exp:channel:entries}

    EE will render dynamic URI for you!

    Another choice, the best way you should insert dynamic=“no”, because with this parameter your sidebar will not be effected with URI in current entry:

    {exp:channel:entries channel="news" status="open" limit="3" dynamic="no"}
       <a href="http://{url_title_path=news/article}">{title}</a>
       {entry_date format="%d %F"} | {author}
    {/exp:channel:entries}

    Hope this help!

  • #3 / Nov 04, 2011 8:27pm

    Dan Decker

    7338 posts

    Hi there gregormck,

    I think if you set the dynamic= parameter on your sidebar template’s channel entries tag, you’ll get what you are looking for. What you are seeing here is that both templates are looking to the URL for information about what entries to display. The sidebar isn’t finding anything in its channel based on the URL, and is therefore returning no results. Setting dynamic=“no” for that channel will tell ExpressionEngine to ignore the URL and just use the information provided in the tag parameters.

    {exp:channel:entries channel="news" status="open" limit="3" dynamic="no"}
       <a href="http://{site_url}news/article/{url_title}">{title}</a>
       {entry_date format="%d %F"} | {author}
      {/exp:channel:entries}

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases