[Solved] Conditional Content and Meta Refresh not working

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
jaslorax
Forum Members
Forum Members
Posts: 25
Joined: Thu Jan 14, 2010 12:34 am

[Solved] Conditional Content and Meta Refresh not working

Post by jaslorax »

I have a site that passes an outbound link through a redirect page so I can track (with Google Analytics) hits to a sister site. Sometimes the sister site is unavailable. I would like to make an EAS (Emergency Alert System of sorts) based on a news article. Basically if the article is active, then display the article, if not then redirect as normal. I do not want to use a js redirect because I need this to work with the most basic of dependencies . . .

My problem is: the conditional statement recognizes when an article is present and displays content accordingly, but when it is absent nothing gets displayed - not even the alternate content.

Code: Select all

<!-- pageAttribute: NotSearchable -->
{process_pagedata}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<__html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex,nofollow">
{capture assign='EAS_Redirect' name='EAS_Redirect'}
{cms_module module='news' category='Ticketing-EAS' summarytemplate='EAS' number="1"}
{/capture}

{if !empty($EAS_Redirect)}
<!--No Redirect-->
{else}
<!--This is simply an intermediate page to allow us to count hits to the ticketing system.-->
<meta http-equiv="REFRESH" content="0; url=https://sister-site">
{/if}
</head>
</__body>

{capture assign='EAS_Content' name='EAS_Content'}
{cms_module module='news' category='Ticketing-EAS' summarytemplate='EAS' number="1"}
{/capture}

{if !empty($EAS_Content)}
{$EAS_Content}
{else}
Please wait while ticketing loads . . .
<!--
{content}
-->
{/if}

{global_content name='analytics'}
<__body>
</__html>
Last edited by jaslorax on Tue May 03, 2011 8:16 pm, edited 1 time in total.
User avatar
jaslorax
Forum Members
Forum Members
Posts: 25
Joined: Thu Jan 14, 2010 12:34 am

Solution

Post by jaslorax »

Page Template:

Code: Select all

<!-- pageAttribute: NotSearchable -->
{process_pagedata}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<__html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex,nofollow">
{capture assign='EAS_Redirect' name='EAS_Redirect'}
{cms_module module='news' category='Ticketing-EAS' summarytemplate='EAS' number="1"}
{/capture}

{if $EAS_On == True}
<!--No Redirect-->
{else}
<!--This is simply an intermediate page to allow us to count hits to the ticketing system.-->
<meta http-equiv="REFRESH" content="0; url=https://sister-site">
{/if}
</head>
</__body>

{capture assign='EAS_Content' name='EAS_Content'}
{cms_module module='news' category='Ticketing-EAS' summarytemplate='EAS' number="1"}
{/capture}

{if $EAS_On == True}
{$EAS_Content}
{else}
Please wait while ticketing loads . . .
<!--
{content}
-->
{/if}

{global_content name='analytics'}
<__body>
</__html>
News Summary Template:

Code: Select all

{foreach from=$items item=entry}
{if $entry->content}
{assign var="EAS_On" value="True"}
<div class="EAS robots-nocontent">
<p class="EAS robots-nocontent">
{eval var=$entry->content}
</p>
</div>
{/if}
{/foreach}
Post Reply

Return to “Modules/Add-Ons”