Global Block
Permalink 1 user found helpful
Hello everyone,
I have been away from C5 some time now but i just got som sparetime and i wanna catch up on things. My first problem is how to make a global block? I want a global area which is editable by my client and once edited all sites with this block should ofcause be updated. I need this for a footer so i cant just hardcode it, since some of the blocks will be frequently updated by client.
I have been looking in different cheat sheets of c5 etc. but with no luck - is it really so that they havent allready thought of this option?
I have been away from C5 some time now but i just got som sparetime and i wanna catch up on things. My first problem is how to make a global block? I want a global area which is editable by my client and once edited all sites with this block should ofcause be updated. I need this for a footer so i cant just hardcode it, since some of the blocks will be frequently updated by client.
I have been looking in different cheat sheets of c5 etc. but with no luck - is it really so that they havent allready thought of this option?
Looking for a little clarification here.
The lowercase g in globalArea used to be valid pre 5.6, did it not? It's certainly how I was using it all along...
I've got a handful of sites to upgrade to 5.6, I've been holding off because of this, it's not a huge time sink to change during an upgrade but still precious minutes being precious and all. Was this an intentional change? What is the reason to not just support the lower case g as a legacy thing?
The lowercase g in globalArea used to be valid pre 5.6, did it not? It's certainly how I was using it all along...
new globalArea ('blah');
I've got a handful of sites to upgrade to 5.6, I've been holding off because of this, it's not a huge time sink to change during an upgrade but still precious minutes being precious and all. Was this an intentional change? What is the reason to not just support the lower case g as a legacy thing?
If I understand you right, I think concrete5 version 5 and upwards will do what you need out-the-box.
It does depend on your theme specifying that an area should be a global area as a opposed to an area but this is simple.
Call this:
rather than this:
Any block you put in that area will be appear on all pages using that page_type and if used across all page_types, all pages of your site.
Hope that helps.
It does depend on your theme specifying that an area should be a global area as a opposed to an area but this is simple.
Call this:
$a = new GlobalArea('Top Bar Left'); $a->display($c);
rather than this:
$a = new Area('Top Bar Left'); $a->display($c);
Any block you put in that area will be appear on all pages using that page_type and if used across all page_types, all pages of your site.
Hope that helps.
Actually i did this with the default theme, but then i get an error saying the VAR globalarea isnt specified or something similiar...?
actually here the line is:
Fatal error: Class 'globalArea' not found in /var/www/floatleft.dk/public_html/fond/themes/default/full.php on line 9
What am i missing?
i used this:
actually here the line is:
Fatal error: Class 'globalArea' not found in /var/www/floatleft.dk/public_html/fond/themes/default/full.php on line 9
What am i missing?
i used this:
<?php $a = new globalArea('Main'); $a->display($c); ?>
What concrete5 version?
Sent from my iPhone
Sent from my iPhone
Latest stable version - i just downloaded it last night.
If i use this code under here, (the normal block type) i dont get any error... its weird.
If i use this code under here, (the normal block type) i dont get any error... its weird.
<?php $as = new Area('Main'); $as->display($c); ?>
Im not sure what is different, but i just try to copy the code you gave me into my php tag and now it makes it sidewide... very weird, but never the less you fixed my issue!
Thx and have a good weekend :-)
EDIT: Ahh crap, i spelled global with a non capital g... Thats prolly it!
Thx and have a good weekend :-)
EDIT: Ahh crap, i spelled global with a non capital g... Thats prolly it!
The 'Best Answer' shouldn't be the one with the a lower case 'g'. The solution you marked as the "best' was stated earlier by 55webdesign and Formigo. I would suggest picking one of their answers so that others with the same question don't just cut 'n paste your solution with the typo in it.
lol sorry - its corrected. Have a gr8 sunday :)
If you want more flexibility for where this content can be placed, you can also build a stack containing the desired content and then 'Add Stack' rather than 'Add Block' to an area. All of these child stacks placed throughout your site will 'globally' change when you change the parent stack though the dashboard. The danger with this technique is that if these child stacks are edited where they sit on their page instead of through the dashboard, they 'detach' themselves from the parent and will not longer be updated when changes are made to the parent stack through the dashboard.
To get around this issue, you could add the stack to a page and then set the permissions so that only certain people can edit it.
To get around this issue, you could add the stack to a page and then set the permissions so that only certain people can edit it.
You could try:
Or something similar