User Toggle Content Visibility [solved]

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
jsherry
Forum Members
Forum Members
Posts: 13
Joined: Wed Dec 05, 2012 6:59 am

User Toggle Content Visibility [solved]

Post 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!
Last edited by jsherry on Tue Jan 01, 2013 10:16 pm, edited 1 time in total.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: User Toggle Content Visibility

Post by applejack »

Add an additional content block and assign it to a variable then do a conditional statement to see it the content exists.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: User Toggle Content Visibility

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
jsherry
Forum Members
Forum Members
Posts: 13
Joined: Wed Dec 05, 2012 6:59 am

Re: User Toggle Content Visibility

Post 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.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: User Toggle Content Visibility

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: User Toggle Content Visibility

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: User Toggle Content Visibility

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jsherry
Forum Members
Forum Members
Posts: 13
Joined: Wed Dec 05, 2012 6:59 am

Re: User Toggle Content Visibility

Post by jsherry »

Thanks everyone. Great suggestions. I'll get started and see how it works out.

Happy New Year!
jsherry
Forum Members
Forum Members
Posts: 13
Joined: Wed Dec 05, 2012 6:59 am

Re: User Toggle Content Visibility

Post by jsherry »

Worked great! The info here, combined with some info in the documentation helped me create a solution.
Post Reply

Return to “The Lounge”