Page 1 of 1
User Toggle Content Visibility [solved]
Posted: Wed Dec 05, 2012 7:06 am
by jsherry
I am creating a CMSMS site and the user has asked that they have an optional "status" bar that can appear at the top of the page. If they don't need it, it would not be visible (display:none; by default) but if they have a warning to post, then can show it and they can be the ones to make it visible.
How could I implement something like that and still make it easy for the user to "toggle it" on/off the backend?
Thanks!
Re: User Toggle Content Visibility
Posted: Wed Dec 12, 2012 1:00 am
by applejack
Add an additional content block and assign it to a variable then do a conditional statement to see it the content exists.
Re: User Toggle Content Visibility
Posted: Wed Dec 12, 2012 10:42 am
by Rolf
Re: User Toggle Content Visibility
Posted: Mon Dec 24, 2012 10:20 pm
by jsherry
@Rolf - Not what I needed, but might be useful another time, so I'll keep it in mind. Thanks.
@applejack - It's needs to be global, so a content block wouldn't work as well since there are 4 templates. If global content blocks had the option to make 'active/inactive' or 'enable/disable' like a content page can, I bet that would have worked out.
Any other thoughts? No way to embed the content of one CMSMS page into another is there? Then I could make a new page that could be turned on/off and the templates could reference it.
Just to recap, the idea is being able to create a warning bar across the top of the site for emergencies.
Example 'Severe whether conditions slowing down response times'
If there was a problem, the client could post something and a red bar with the message would appear at the top of the site. When the problem was over, they would have control to turn it off.
Re: User Toggle Content Visibility
Posted: Wed Dec 26, 2012 11:37 am
by applejack
Re: No way to embed the content of one CMSMS page into another is there?
Yes there is you can use CGISimpleSmarty module though from the example you stated I would perhaps use the News module.
Re: User Toggle Content Visibility
Posted: Wed Dec 26, 2012 2:45 pm
by Jo Morg
applejack wrote:Re: No way to embed the content of one CMSMS page into another is there?
Yes there is you can use CGISimpleSmarty module though from the example you stated I would perhaps use the News module.
I agree. In some sites I use a news category for messages. I then use Smarty logic to check if there are news (in some cases I limit the display to one article) on that category and display a bar (or any other sort of widget) with the message.
Re: User Toggle Content Visibility
Posted: Wed Dec 26, 2012 3:35 pm
by calguy1000
I would use a news category, and expiration dates.
i.e:
1. create a news category called 'urgent notices' ... note the id of this category
2. create news articles in this category
(use either expiration dates, and/or only ensure that one article in this category is published at a time).
3. Create a new news summary template called 'urgent notices'
in that use logic like (not exact, making this up in my head)
{if count($entries) > 0}
<div id="urgent_notice">
{* remainder of news summary template *}
</div>
{/if}
4. Modify your page template(s) (you may need to modify multiple page templates) to call {News category=<categoryid> limit=1 summarytemplate='urgent notices'}
---
Now... Your page templates will display 0 or 1 urgent notices
depending on how many are 'published' in that category and are valid to display based on expiration dates.
Your users can then create new news articles, and if they fill in reasonable expiration dates and start dates... everything should just work.
You can use a special CMSMS page for this, and the CGSimpleSmarty module to pull content from that page and insert it into any other, but then you have greater concerns RE making sure that the page is active, trapping errors if it is not, making sure that the user cannot navigate to that page himself, SEO issues, and also potential styling issues. And, those notices don't disappear automatically.
Re: User Toggle Content Visibility
Posted: Thu Dec 27, 2012 6:18 pm
by jsherry
Thanks everyone. Great suggestions. I'll get started and see how it works out.
Happy New Year!
Re: User Toggle Content Visibility
Posted: Tue Jan 01, 2013 8:51 pm
by jsherry
Worked great! The info here, combined with some info in the documentation helped me create a solution.