Control you blank pages Print
By Patrick LEFÈVRE published on 2011 12 22
Version française disponible ici
In some case, you have to control temporary the content page even if this content is empty. Imagine your client wants a new brand blog section on his website. You work hard to add it. All works fine but your client still hasn’t written anything. And it is likely that the wait is still long. Visitors who access the blog could therefore see nothing!
Textpattern is a CMS based on articles publishing. So we can test if the page is populated and if not display a waiting message or anything else.
In your page template, add (or change it) with this few lines:
<txp:if_article_list><txp:php>$count_article = safe_count('textpattern', 'Section = "blog" and Status = "4"');if( $count_article == 0 ) {echo parse ('<h2>Waiting</h2><p>We are really sorry, but it seems that there are no articles for the moment.</p><p>Please, comme back later.</p><p>We apologize for inconvenience.</p>');} else {echo parse('<txp:article limit="3" listform="articles_list" />');}</txp:php><txp:else /><txp:article limit="1" form="article_individual" /></txp:if_article_list>
Related Articles
Compress your CSS & javascript files - Publié le 2012.01.09 By Patrick LEFÈVRE.
Your comment forms in French or any other languages - Publié le 2011.12.24 By Patrick LEFÈVRE.
Hide your sections for non admin users - Publié le 2011.09.28 By Patrick LEFÈVRE.
Split your links list into columns - Publié le 2011.12.14 By Patrick LEFÈVRE.
Pat_tile, a plugin for your articles title - Publié le 2013.04.26 By Patrick LEFÈVRE.
Access to all article archives
