Page List - No Results | Nothing Found

Permalink
What is the best way to add to the Page List block a function that would display "No Results" (or something to this effect) if there are no results to display?

-D

haundavid
 
mesuva replied on at Permalink Best Answer Reply 1 Attachment
mesuva
This is something that custom block templates can do very easily:
http://www.concrete5.org/documentation/general-topics/custom-templa...

What you do is create in the top level /blocks folder a folder called page_list and inside that a folder called templates. Then you'd copy into /blocks/page_list/templates the file /concrete/blocks/page_list/view.php and rename it to something meaningful show_no_results_message.php.

Then you can click on the block, pick Custom Templates, and this new template can be selected. I've attached a template file here that should display the No Results message - should be obvious how to adjust this to what you need.

Just create the folder I've described above, drop in show_no_results_message.php and go pick the template for the block. (attached is zipped as the forums don't allow .php attachments)

Cheers
-Ryan
haundavid replied on at Permalink Reply
haundavid
Ryan,

Thnaks. This is perfect. Not so good with PHP. This is exactly what I needed:

<?php if (empty($pages)) { ?>
<p>No Results</p>
<?php } ?>