Hello,
I have a global content block for Facebook comments and I would like to allow the editor to control whether it shows on specific pages or not when editing page. Ideally via a checkbox.
How can I achieve this?
Thanks.
Allow editor to show/hide GCB on page? [SOLVED]
Allow editor to show/hide GCB on page? [SOLVED]
Last edited by atdesign on Sat May 11, 2013 11:17 am, edited 2 times in total.
-
- Forum Members
- Posts: 183
- Joined: Sun Sep 07, 2008 10:47 am
Re: Allow editor to show/hide GCB on page?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur..." (Red Adair)
Re: Allow editor to show/hide GCB on page?
uniqu3 posted a follow up to my article adding more flexibility:
http://www.i-do-this.com/blog/42/Give-Y ... ir-Sidebar
http://www.i-do-this.com/blog/42/Give-Y ... ir-Sidebar
Re: Allow editor to show/hide GCB on page?
There is a far easier way to do this.
In TinyMCE Advanced Tab > Custom dropdown option
Then just add a line such as
Name whatever of my CGB|{global_content name=\'my_GCB\'}
In the profiles make sure you include customdropdown
Then when editing the page the client can choose it from the Custom Dropdown menu
Simplez !!!
In TinyMCE Advanced Tab > Custom dropdown option
Then just add a line such as
Name whatever of my CGB|{global_content name=\'my_GCB\'}
In the profiles make sure you include customdropdown
Then when editing the page the client can choose it from the Custom Dropdown menu
Simplez !!!
Re: Allow editor to show/hide GCB on page?
Only if you want the GCB in the content... Won't work if it's a sidebar item.
Re: Allow editor to show/hide GCB on page?
And the difference is ?Wishbone wrote:Only if you want the GCB in the content... Won't work if it's a sidebar item.
Using TinyMCE gives you the flexibility of having the CGB in any order you want and as many as you wish. Of course it depends on what type of content is contained in the CGB and formatting etc etc. At the end of the day depends on what one is trying to do and what you wish to allow a client to do or perhaps more appropriately not do.
Re: Allow editor to show/hide GCB on page?
@applejack
The difference is, that you control what client may choose.
I wouldn't recommend on following that article if one doesn't know what he/she is doing as article is old and needs an update.
But from Article that Wishbone linked that was a follow up on his original article a client would/was be able to choose and reorder GCB's no matter how many were added and with prefix you would determine which GCB's a client may see.
The difference is, that you control what client may choose.
I wouldn't recommend on following that article if one doesn't know what he/she is doing as article is old and needs an update.
But from Article that Wishbone linked that was a follow up on his original article a client would/was be able to choose and reorder GCB's no matter how many were added and with prefix you would determine which GCB's a client may see.
Re: Allow editor to show/hide GCB on page?
It's also a bit of overkill for one content block. You can either used AdvancedContent or CGContentUtils to define the checkbox, then put an 'if' statement to check if it's checked, and then place the GCB if so.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Allow editor to show/hide GCB on page?
1. To allow a toggle of a specific GCB:
You could use CGContentUtils to create a checkbox content field. Then a simple if statement to enable it.
something like: (untested)
{content_module module=CGContentUtils block=toggle_gcb name='toggle_gcb' assign='myval'}
{if $myval != ''}{global_content name='foo'}{/if}
2. To allow a choice of 'pre-defined' GCB's:
You could use CGContentUtils to hardcode a list of GCB names into a dropdown box (with 'none' as one of the options)
Then a bit of smarty magic and it's done.
something like (untested)
{content_module module=CGContentUtils block=gcb_dropdown name='gcb_dropdown' assign='mygcb'}
{if $mygcb != '' && $mygcb != 'none'}
{global_content name=$mygcb}
{/if}
Hint: CGContentUtils will provide the basic tag you need to embed into your page template.
3. To not use any module at all,
if you wanted a simple toggle you could do something like:
{content block='toggle_gcb' label='Type anything here to enable the item in the sidebar' oneline='true' assign='toggle_gcb'}
{if $toggle_gcb != ''}{global_content name='foo'}{/if}
This provides a text field, the user can then just type anything into...the contents of this text field are not output, but it's non-empty status tells it to include the GCB.
Many ways to skin this cat... that's the power of CMSMS.
You could use CGContentUtils to create a checkbox content field. Then a simple if statement to enable it.
something like: (untested)
{content_module module=CGContentUtils block=toggle_gcb name='toggle_gcb' assign='myval'}
{if $myval != ''}{global_content name='foo'}{/if}
2. To allow a choice of 'pre-defined' GCB's:
You could use CGContentUtils to hardcode a list of GCB names into a dropdown box (with 'none' as one of the options)
Then a bit of smarty magic and it's done.
something like (untested)
{content_module module=CGContentUtils block=gcb_dropdown name='gcb_dropdown' assign='mygcb'}
{if $mygcb != '' && $mygcb != 'none'}
{global_content name=$mygcb}
{/if}
Hint: CGContentUtils will provide the basic tag you need to embed into your page template.
3. To not use any module at all,
if you wanted a simple toggle you could do something like:
{content block='toggle_gcb' label='Type anything here to enable the item in the sidebar' oneline='true' assign='toggle_gcb'}
{if $toggle_gcb != ''}{global_content name='foo'}{/if}
This provides a text field, the user can then just type anything into...the contents of this text field are not output, but it's non-empty status tells it to include the GCB.
Many ways to skin this cat... that's the power of CMSMS.
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.
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.
Re: Allow editor to show/hide GCB on page? [SOLVED]
Thanks for all the suggestions everyone. With Wishbone's help, we implemented CalGuy's method.
{assign var='myval' value='hello'}
{content_module module='CGContentUtils' block='toggle_gcb' name='toggle_gcb' label='Facebook Comments' assign='myval'}
{if $myval != ''}
{global_content name='fbcomments'}
{/if}
{assign var='myval' value='hello'}
{content_module module='CGContentUtils' block='toggle_gcb' name='toggle_gcb' label='Facebook Comments' assign='myval'}
{if $myval != ''}
{global_content name='fbcomments'}
{/if}