Control you blank pages Print

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:

  1. <txp:if_article_list>
  2. <txp:php>
  3. $count_article = safe_count('textpattern', 'Section = "blog" and Status = "4"');
  4. if( $count_article == 0 ) {
  5. echo parse ('
  6. <h2>Waiting</h2>
  7. <p>We are really sorry, but it seems that there are no articles for the moment.</p>
  8. <p>Please, comme back later.</p>
  9. <p>We apologize for inconvenience.</p>
  10. ');
  11. } else {
  12. echo parse('
  13. <txp:article limit="3" listform="articles_list" />
  14. ');
  15. }
  16. </txp:php>
  17. <txp:else />
  18. <txp:article limit="1" form="article_individual" />
  19. </txp:if_article_list>

Published on | Updated on by Patrick LEFÈVRE.

Related Articles

Compress your CSS & javascript files - Publié le 2012.01.09 By Patrick LEFÈVRE.
Hide your sections for non admin users - Publié le 2011.09.28 By Patrick LEFÈVRE.
Display a page on your website for known referrers - Publié le 2012.02.09 By Patrick LEFÈVRE.
Your comment forms in French or any other languages - Publié le 2011.12.24 By Patrick LEFÈVRE.
Split your links list into columns - Publié le 2011.12.14 By Patrick LEFÈVRE.
Access to all article archives

» Previous Article» Next Article
txp:fr supports Textpattern ;·) Textpattern CMS

Need Help? Post your question on Entr'Aide txp:fr website