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.

Disappearing Channel Entry

June 04, 2012 10:02am

Subscribe [4]
  • #1 / Jun 04, 2012 10:02am

    Stuart

    31 posts

    I have the following code for a news page:

    {header}
                <section>
                    <article id="inner_left">
    
                    </article>
                    <article id="inner_headline">
                     <h2>NEWS</h2>
    <p>                </article><br />
      <article id="inner_right"><br />
      {if segment_2 == ''}<br />
                     {exp:channel:entries channel="news" disable="categories|member_data|pagination|category_fields" orderby="date" sort="asc"}<br />
        <h1>{title}</h1><br />
        </p><h3>{entry_date format="%F %d, %Y"}</h3>
    <p>    <hr><br />
        {summary}<br />
        <a href="http://{title_permalink=">Read more…</a><br />
       {/exp:channel:entries}<br />
      {/if}<br />
      {if segment_2}<br />
      <br />
       {exp:channel:entries channel="news" disable="categories|member_data|pagination|category_fields"}<br />
        <h1>{title}</h1><br />
        </p><h3>{entry_date format="%F %d, %Y"}</h3>
    <p>    {body}<br />
        <a href="/news/">Back to news.</a><br />
       {/exp:channel:entries}<br />
      <br />
      {/if}<br />
      </article><br />
                </section><br />
    {footer}

    The footer is a snippet that also contains a channel entry. Everything works fine until I click the “Read more…” link in the above code. When the second conditional fires, the channel entry in the snippet disappears.

    Snippet:

    <footer>
                  <article id="find_petsmart">
                        <ul>
                            <li><a href="#" target="_blank" rel="noopener">Store Locator</a></li>
                        </ul>
                    </article>
                    <article id="organix">
                        <ul>
                            <li><a href="#" target="_blank" rel="noopener">Learn More</a></li>
                        </ul>
                    </article>
                    <article id="tour">
                         <ul>
                           {exp:channel:entries channel="bentley_on_tour" disable="categories|member_data|pagination|category_fields" orderby="start_date" sort="asc" limit="3"}
        <li>{start_date format="%m/%d/%y"} | <a href="/meet_bentley/bentley_on_tour">{tour_location}</a></li>
       {/exp:channel:entries}
                        </ul>
                    </article>
                </footer>
            </div>
       </div>
    </body>
    </html>

    Not sure what I’m missing here.

  • #2 / Jun 04, 2012 11:40am

    mark186282

    290 posts

    it looks like a problem with your href of your anchor tag:

    <a href="http://{title_permalink=">Read more…</a>

    http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#title-permalink

    You’ll want your template group and template in the permalink tag such as:

    {!-- replace "archives" with whatever your template is called --}
    <a href="http://{title_permalink=news/archives}">Read more…</a>

     

  • #3 / Jun 04, 2012 11:53am

    Stuart

    31 posts

    Thanks. Corrected the permalink error, but the other problem still remains.

  • #4 / Jun 04, 2012 12:32pm

    Kurt Deutscher

    827 posts

    In one of the 2 channel tags you have orderby=“date” sort=“asc”. I would add that to the second also, to make sure they are both sorting entries the same way. The default is “descending”, so right now, each tag is sorting differently. This may not fix things, but would be good to rule out.

    Hm… seems your tag in the footer is also sorting differently than the other two. So I would confirm that they are all sorting the way you need them too.

    There was a bug/behavior a while back that would include “closed” entries in a orderby=“date” and that could cause some issues like you are having.

  • #5 / Jun 04, 2012 12:40pm

    Stuart

    31 posts

    Thanks Kurt. I tried all that as well. I’ll look into your last suggestion though.

  • #6 / Jun 04, 2012 3:13pm

    Stuart

    31 posts

    Solved. Needed to add dynamic=“no” to my footer channel entry.

  • #7 / Jun 05, 2012 11:04am

    Shane Eckert

    7174 posts

    Hey Swerve,

    Nice work! Glad to see you are back in business.

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases