CGblog - if expired

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
seanus
Forum Members
Forum Members
Posts: 17
Joined: Fri Oct 07, 2011 4:26 am

CGblog - if expired

Post by seanus »

Hi all,

I have done a search of the forum and havent come up with anything yet.

What i want to do is when a blog article for a specific category expires it show some other text.

The section im using it for is a weekly promotions area. So i would love to set a promotions and let it expire after a week and have some text show up like "Please check back soon". Untill a new promotions is put up.

Is there anyway to achieve this??
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: CGblog - if expired

Post by applejack »

Use {capture}

Code: Select all

{capture assign=blogtmp}{CGBlog etc etc}{/capture}
{if $blogtmp}
{$blogtmp}
{else}
Do something else
{/if}
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: CGblog - if expired

Post by applejack »

Or use capture in the summary template or do a conditional statement in it or use counter or index to check whether or not the foreach loop actually loops. Check smarty.net
cb2004
Power Poster
Power Poster
Posts: 317
Joined: Wed Jul 04, 2007 3:39 pm

Re: CGblog - if expired

Post by cb2004 »

Paste your summary template and I will help you out.
seanus
Forum Members
Forum Members
Posts: 17
Joined: Fri Oct 07, 2011 4:26 am

Re: CGblog - if expired

Post by seanus »

I actually found something in the share your tags... a UDT called "count news items" works perfectly for what i want. Not sure if its the best solution but it works for me.

Code: Select all

{$count_news_items}
{if $itemcount != 0}
{foreach from=$items item=entry}
<h2>{$entry->title|escape} - {$entry->postdate|cms_date_format}</h2>
{eval var=$entry->content}
{if !empty($entry->fieldsbyname.promotions->value)}
<div id="promotion">
<a href="{$entry->file_location}/{$entry->fieldsbyname.promotions->value}"><img src="{$entry->file_location}/thumb_{$entry->fieldsbyname.promotions->value}" /></a>
</div>
{/if}
{/foreach}
{else}
<h2>Product Promotions</h2>
<p>There are currently no in-store promotions running. Please check back at a later date for new product promotions</p>
{/if}
Post Reply

Return to “Modules/Add-Ons”