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.

problem with title_permalink

March 17, 2012 5:18pm

Subscribe [2]
  • #1 / Mar 17, 2012 5:18pm

    Side Six

    37 posts

    Hi folks,

    I’m sure I’m overlooking something obvious but I can’t get the {title_permalink="" to work on a client's site. I'm using it in two places.

    The first is in the sidebar to show recent posts. Here is the code:

    {exp:channel:entries orderby="date" sort="desc" limit="5"}
    <ul>
        <li><a href="http://{title_permalink=channel/news}">{title}</a></li>
    </ul>
    {/exp:channel:entries}

    It only returns one title even though there are more articles than that in the news channel

    The second way I’m using this is on the blog’s index.  Here’s the code:

    {exp:channel:entries channel="news" limit="6" status="Featured|open" paginate="bottom"}
        <header>
         <h2><a href="http://{title_permalink=news/article}">{title}</a></h2>
    <p>    </header><br />
        <span class="date">{entry_date format="%F %d, %Y"}</span><br />
       <article><br />
         {news_excerpt}<br />
         <a href="http://{title_permalink=news/article}">Continue reading »</a><br />
         {paginate}<br />
         <!-- Page {current_page} of {total_pages} pages {pagination_links} --><br />
         <div id="paginate"><br />
         {if previous_page}<br />
         <a href="http://{auto_path}">Previous Page</a>  <br />
         {/if}     <br />
         {if {current_page} != '1'   AND  "{current_page}" != "{total_pages}"  } | {/if}     <br />
         {if next_page}<br />
         <a href="http://{auto_path}">Next Page</a><br />
         {/if}</div><br />
        {/paginate}</p>
    
    <p>   </article><br />
       {/exp:channel:entries}

    When I click on either the title or the “continuing reading” link in any of the articles, I get directed to the most recent article in the news channel.

    This is happening in both the development site on my computer and on the live site at Media Temple.

    Any suggestions?

  • #2 / Mar 17, 2012 9:36pm

    glenndavisgroup

    436 posts

    Hi Side Six,

    For the first code block you are missing the channel=”” parameter. This is why you are only getting 1 entry to display. It should look like this:

    {exp:channel:entries channel="news" orderby="date" sort="desc" limit="5"}
    <ul>
        <li><a href="http://{title_permalink=channel/news}">{title}</a></li>
    </ul>
    {/exp:channel:entries}

    As for the second code block I’m not sure I understand what the issue is?

    Thank you,

    Mike

  • #3 / Mar 18, 2012 12:42am

    Side Six

    37 posts

    Thanks Mike,

    I knew the first one had to be something obvious but I’ve been working so many hours on the site, I’m seeing what should be there and not what isn’t.

    The second one is more of a problem.  On the development site I have two entries in the news channel.  Story A and Story B we’ll call them. Story A will represent the most recent entry in the news channel.  When I click on the title link for Story A or the continue reading link in Story A on the blog’s index page, I am taken to the article page for Story A.  When I click on the title link for Story B or on the continue reading link in Story B on the blog’s index page, I am taken to the article page for Story A.  In other words the title-permalink is resolving to the most recent entry in the news channel regardless of where it is located.  Is that more clear?

    Edit:

    I just cut and pasted your corrected code, cleared the caches on my site, and the sidebar only shows one entry from the news channel even though there are actually two. 

    You can see what I mean on the live server here.

  • #4 / Mar 18, 2012 1:30pm

    Dan Decker

    7338 posts

    Hi Side Six,

    I just cut and pasted your corrected code, cleared the caches on my site, and the sidebar only shows one entry from the news channel even though there are actually two.

    For that, make sure you include the dynamic=“no” parameter in your sidebar channel entries tag. That will prevent it from working off of information in the URL.

    For your other remaining issue, we really could use a look at your article template. There is likely something in the channel entries tag there that is gumming this up.

    Cheers,

  • #5 / Mar 18, 2012 1:44pm

    Side Six

    37 posts

    Hi Dan,

    Here is the code that is currently in my sidebar and it is still only returning one of the entries in the news channel:

    {exp:channel:entries channel="news" orderby="date" sort="desc" limit="5" dynamic="no"}
      <ul>
        <li><a href="http://{title_permalink=channel/news}">{title}</a></li>
      </ul>
    {/exp:channel:entries}

    Here is the template code for the article page

    {embed="includes/head" entry_title="{exp:channel:entries channel="news" limit="1" dynamic="no" status="Featured|Open"}{title}{/exp:channel:entries}"}
    <body>
    <!--[if lt IE 9]>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a><![endif]-->
    {embed="includes/masthead"}
     <div id="main-container">
      <div id="main" class="wrapper clearfix">
      
    <!-- Start Two Columns -->
     <div id="copy-wrapper"> 
      {exp:channel:entries channel="news" limit="1" dynamic="no" status="Featured|Open"}
      <article class="hentry">
        <header>
          <h2 class="entry-title">{title}</h2>
          <time class="updated" datetime="2010-08-07T11:11:03">{entry_date format="%F %d, %Y"}</time>
          
              By <span class="fn">{author}</span>
          
        </header>
         <figure>
              {exp:channel_images:images entry_id="{entry_id}"}
            {image:url:medium}
            <figcaption>{image:description}</figcaption>
        {/exp:channel_images:images}
        {if image:no_images}{/if}
          </figure>
        <div class="entry-content">
         {news_body}
        </div> <!-- end entry-content -->
        {exp:channel_videos:videos entry_id="{entry_id}"}
            <h3>{video:title}</h3>
    <p>        {video:embed_code}<br />
        {/exp:channel_videos:videos}<br />
      </article><br />
      {/exp:channel:entries}<br />
      <br />
      <section id="comments"><br />
       {exp:forms:form form_name="speak_out" display_error="inline"}<br />
        </p><h3>{forms:label}</h3>
    <p>      {forms:fields}<br />
             {forms:field}<br />
        {/forms:fields}<br />
       {/exp:forms:form}</p>
    
    <p>     </section><br />
     </div> <!-- end copy-wrapper --></p>
    
    <p>{embed="includes/sidebar"}<br />
       <br />
      </div> <!-- #main --><br />
     </div> <!-- #main-container --><br />
    <!-- end Two Columns --><br />
    {embed="includes/footer"}

    Could it be a setting somewhere in the control panel.  It’s odd that the same thing is happening on both the dev and live server.  I deleted the news channel on the dev server and recreated it, but that didn’t change anything.

  • #6 / Mar 18, 2012 2:47pm

    Boyink!

    5011 posts

    Make sure your other entries have an open status and a publish date that is in the past.

  • #7 / Mar 18, 2012 4:06pm

    Side Six

    37 posts

    Make sure your other entries have an open status and a publish date that is in the past.

    Hi Mike,

    They do.  And I’ve been reading your book and Ryan’s trying to figure out why it isn’t working.  So far no luck.

  • #8 / Mar 18, 2012 4:09pm

    Boyink!

    5011 posts

    If you strip out that sidebar code and put it in it’s own template does it work?

  • #9 / Mar 18, 2012 8:31pm

    Side Six

    37 posts

    Nope it doesn’t, Mike.  It’s like there is only one entry in the channel for some reason.  Which is why the title_permalink only resolves to the most recent entry. It’s making me want to find another platform.  This would have to happen on the mayor’s site.  LOL

    Could I have somehow downloaded a corrupt version of EE?

  • #10 / Mar 18, 2012 8:40pm

    Boyink!

    5011 posts

    And you’re sure status is open, publish dates are in past?  They show in the edit tab just fine?  No url-titles appearing in the url, dynamic off?

    If you quick implement another channel / enter content and point the code at that instead does it work?

  • #11 / Mar 18, 2012 9:04pm

    Side Six

    37 posts

    Hi Mike,

    I’ll try the last one again.  Yes to the rest.  Funny thing, I deleted the channel and entries on my development server.  Then created a new channel and got the same result. 

    I’m assuming the code above is okay since no one has said otherwise?

  • #12 / Mar 18, 2012 9:07pm

    Boyink!

    5011 posts

    Make sure to strip all the presentation code out.

    {exp:channel:entries channel="news" orderby="date" sort="desc" limit="5" dynamic="no"}
      <ul>
        <li><a href="http://{title_permalink=channel/news}">{title}</a></li>
      </ul>
    {/exp:channel:entries}

    This will create 5 unordered lists with one item each.

    Re-arrange it like this:

    <ul>
    {exp:channel:entries channel="news" orderby="date" sort="desc" limit="5" dynamic="no"
        <li><a href="http://{title_permalink=channel/news}">{title}</a></li>
    {/exp:channel:entries}
     </ul>
  • #13 / Mar 18, 2012 9:13pm

    Side Six

    37 posts

    Re-arrange it like this:

    <ul>
    {exp:channel:entries channel="news" orderby="date" sort="desc" limit="5" dynamic="no"
        <li><a href="http://{title_permalink=channel/news}">{title}</a></li>
    {/exp:channel:entries}
     </ul>

    Makes a lot more sense that way. Doh!  And it should have worked.  But sadly no difference. 

    http://frank4mv.com

  • #14 / Mar 18, 2012 9:14pm

    Boyink!

    5011 posts

    Just make sure to check the source code when issues come up. Sometimes a display issue hides content.

  • #15 / Mar 18, 2012 9:39pm

    Side Six

    37 posts

    Just make sure to check the source code when issues come up. Sometimes a display issue hides content.

    I’m not sure what you mean by a display issue.  But I agree on checking the code.  this one is driving me nuts because as far as I can tell the code is good.  Of course, when you’re working on anything you get so close you sometimes see what should be there rather than what is there.  Which is why I came to the forum.  Fresh eyes as it were. 

    So I set up a new channel, added in two articles, and get the exact same results.  The title_permalink is only resolving to the most current article.

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

ExpressionEngine News!

#eecms, #events, #releases