Forum

Thread tagged as: Question

Can I suspend/disable from displaying an item in list /detail setup?

I haven't been able to find this may not be standard Perch. Has anyone been able to do this? Many thanks

Phil Wragg

Phil Wragg 0 points

  • 6 years ago

You could add a checkbox to template to filter against at output.

More description needed for more complete answer...

Robert Ketter

Simon Clay

Simon Clay 127 points

Hi Phil,

I think you could do it by adding a checkbox like this in your template:

<perch:content id="suspend" type="checkbox" label="Suspend" value="yes" suppress="true" />

Then using something like this in your listing template, to hide the list item if it's suspended:

<li perch:if exists="suspend">style="display:none;visibility:hidden;"</perch:if>>Item title</li>
Simon Clay

Simon Clay 127 points

or perhaps a better way would be to filter the listing. Leave your listing template as is and filter the listing in this way :

<?php
perch_content_custom('Your Listing', array(
    'page'=>'your-page.php',
    'template'=>'your_listing_template.html',
    'filter'=>'suspend',
    'match'=>'neq',
    'value'=>'yes'
));
?>

Simon Clay said:

Hi Phil,

I think you could do it by adding a checkbox like this in your template:

<perch:content id="suspend" type="checkbox" label="Suspend" value="yes" suppress="true" />

Then using something like this in your listing template, to hide the list item if it's suspended:

<perch:if exists="suspend">
<perch:else />
<li>stuff here</li>
</perch:if>

Simon we are just having a good time today... Our posts are missing each other by seconds...

Simon Clay

Simon Clay 127 points

Ha, yes we are!

Have a good day all.

Many thanks both will try these this week