I have a script that uses query to determine if a particular entry is open or closed. based on that entry, it then displays a list of blog entry excerpts. if that particular entry id has a status of closed, it displays the list with one category hidden. Otherwise it shows all categories.
Everything on this works fine except for the pagination. I cannot get it to appear inside the conditional, and when it is outside of the conditional, it just shows the same few blog excerpts on every page.
Below is my code:
{exp:query sql="SELECT status FROM exp_channel_titles WHERE entry_id = '46'"}
{if status == 'closed'}
{exp:channel:entries channel="blog" disable="member_data" limit="3" paginate="bottom" order_by="desc" category="not 4"}
{if no_results}
<p>No results available</p>
{/if}
<div class="entry"><article>
<div class="header"><header>
<hgroup>
<h2 class="category">{categories}{category_name}{/categories}</h2>
<h1>{title}</h1>
</hgroup>
<p><span class="date">{entry_date format="%F %d, %Y"}</span> / <span class="author">{author}</span></p>
</header></div> <!-- /.header -->
{if blog_image}
<p><img src="{blog_image}" alt="{title}"></p>
{/if}
{blog_excerpt}
<a href="{url_title_path='blog/entry'}" class="more">read more ></a></p>
</article></div> <!-- /.entry -->
<div class="moreEntries">
{paginate}
{if previous_page}
<a href="{auto_path}" class="prev">< Newer Posts</a> |
{/if}
{if next_page}
<a href="{auto_path}" class="next">Older Posts ></a>
{/if}
{/paginate}
</div> <!-- /.moreEntries -->
{/exp:channel:entries}
{if:else}
{exp:channel:entries channel="blog" disable="member_data" limit="3" paginate="bottom" order_by="desc"}
{if no_results}
<p>No results available</p>
{/if}
<div class="entry"><article>
<div class="header"><header>
<hgroup>
<h2 class="category">{categories}{category_name}{/categories}</h2>
<h1>{title}</h1>
</hgroup>
<p><span class="date">{entry_date format="%F %d, %Y"}</span> / <span class="author">{author}</span></p>
</header></div> <!-- /.header -->
{if blog_image}
<p><img src="{blog_image}" alt="{title}"></p>
{/if}
{if event_location}
<p><strong>{event_location}</strong><br>
{blog_month} {blog_day}, {blog_year} - {blog_event_time}}</p>
{/if}
{blog_excerpt}
<a href="{url_title_path='blog/entry'}" class="more">read more ></a></p>
</article></div> <!-- /.entry -->
<div class="moreEntries">
{paginate}
{if previous_page}
<a href="{auto_path}" class="prev">< Newer Posts</a> |
{/if}
{if next_page}
<a href="{auto_path}" class="next">Older Posts ></a>
{/if}
{/paginate}
</div> <!-- /.moreEntries -->
{/exp:channel:entries}
{/if}
{/exp:query}
Thanks for any help you can offer!