0

I am trying to output the heading "Related Articles" only once before all the blog submissions. The way I have it coded below, it's outputting heading in every entry. I've put it in multiple places and no luck. Any help is much appreciated.

        <div id="main">
            <section class="section">
                <div class="container">
                    <div class="row">
                        <div class="col-md-8 col-md-offset-2">

                            {!-- IF PREMIUM PAGE > ONLINE EXERCISES --}
                            {if last_segment == 'online-exercises'}{!--***--}
                                <ul id="online-exercises-list">
                                    {exp:channel:entries channel="blog" limit="200" orderby="title" sort="asc" }

                                        {if no_results}
                                            {exp:channel:categories}
                                                {if last_segment ==  category_url_title}
                                                <h1>{blog_content}</h1>
                                                {/if}
                                            {/exp:channel:categories}
                                            <h2>No Items in this category</h2>
                                            <h3>Sorry, but here are no listings under this category at this time.</h3>
                                        {/if}

                                        <li><a href="/blog/article/{url_title}" title="{title}">{title}</a></li>

                                    {/exp:channel:entries}
                                </ul>

                            {!-- OTHERWISE, SHOW STANDARD CATEGORY ENTRIES --}
                            {if:else}

                                {exp:channel:entries channel="blog" limit="7" paginate="bottom" }

                                    {if category_description == "y"}
                                        <article class="description-block">
                                            <div class="text-block">
                                                <div class="text-holder">
                                                   {blog_content}
                                                </div>
                                            </div>
                                        </article>
                                    {if:else}


                                        {if no_results}
                                            {exp:channel:categories}
                                                {if last_segment ==  category_url_title}
                                                <h1>{category_name}</h1>
                                                {/if}
                                            {/exp:channel:categories}
                                            <h2>No Items in this category</h2>
                                            <h3>Sorry, but here are no listings under this category at this time.</h3>
                                        {/if}

<div class="row">
    <h1 class="style">Related Articles</span></h1>
</div>  

                                        <article class="post-block">
                                            <h2><a href="/blog/article/{url_title}">{title}</a></h2>
                                            <div class="info">
                                                <span class="author">by {author}</span>
                                                <span class="date">{entry_date format=" %F %d, %Y"}</span><br />
                                                {!--<span>in {categories}<a href="/blog/category/{category_url_title}/">{category_name},</a> {/categories}
                                                </span>--}
                                            </div>
                                            <div class="text-block">
                                                {if "{blog-videos:total_rows search:blog-videos_active='=y'}" > '0'}
                                                    {blog-videos search:blog-videos_active='=y' limit="1"}
                                                        <div class="placeholder alignleft">
                                                        {if blog-videoupload != ""}
                                                            <a href='/blog/article/{url_title}'>
                                                                {if blog-videos_thumb != ''}
                                                                    {exp:ce_img:single src="{blog-videos_thumb}" max_height="120" max_width="200" crop="yes" cache_dir="/cache" alt="{blog-images_title}"}
                                                                {if:else}
                                                                    <img src="/themes/site_themes/site/graphics/playvid.png" height='120' width='200' alt="playvid" />
                                                                {/if}
                                                            </a>
                                                        {if:else}
                                                            {exp:antenna url='{blog-videos_url}' max_width="570" cache_minutes="120" wmode="transparent|opaque|window"}
                                                                <a href="/blog/article/{url_title}"><img src="{video_thumbnail}" height="120" width="200" alt="{video_title}" /></a>
                                                            {/exp:antenna}
                                                        {/if}
                                                        </div>
                                                    {/blog-videos}
                                                {if:else}
                                                    {blog-images search:blog-images_active='=y' limit="1"}
                                                        <div class="placeholder alignleft">
                                                            {if '{blog-images_file}' != ''}
                                                                <a href="/blog/article/{url_title}">{exp:ce_img:single src="{blog-images_file}" height="200" width="200" crop="yes" cache_dir="" alt="{blog-images_title}"}</a>
                                                            {if:else}
                                                                <a class="float-right" href="/blog/article/{url_title}">{exp:ce_img:single src="{blog-images_after}" height="100" width="50" crop="yes" cache_dir="/cache" alt="{blog-images_title}"}</a>
                                                                <a class="float-right" href="/blog/article/{url_title}">{exp:ce_img:single src="{blog-images_before}" height="100" width="50" crop="yes" cache_dir="/cache" alt="{blog-images_title}"}</a>
                                                            {/if}
                                                        </div>
                                                    {/blog-images}
                                                {/if}
                                                <div class="text-holder">
                                                    {exp:eehive_hacksaw allow="" chars="275"  }
                                                        <p>{blog_content}</p>
                                                    {/exp:eehive_hacksaw}
                                                </div>
                                            </div>

                                        </article>
                                        <div class="read-more"><a href="/blog/article/{url_title}">READ MORE<img src="{site_url}themes/site_themes/site/images/more-arrow.png" alt="more arrow" /></a></div>
                                        <hr style="clear:both; width: 100%;"/>
                                    {/if}

                                {/exp:channel:entries}

                            {/if}

                        </section>
            </div>
1

Use a conditional statement to only output the heading on the first row:

{if count == "1"}
<div class="row">
    <h1 class="style">Related Articles</span></h1>
</div>  
{/if}
| improve this answer | |
  • I already tried that too and nothing shows up at all using {if count == "1"} – frshjb373 May 14 '14 at 17:00
  • 1
    It will, you just need to declutter your template and find the error - you have a lot going on. Strip it down to just a single channel:entries tag and you'll find it works, then slowly add back everything else. – Derek Hogue May 14 '14 at 18:03
  • You don't even need quotes around the 1. {if count == 1} works fine. – kmgdev May 14 '14 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.