Global Stack in 5.5.

Permalink 3 users found helpful
Is there any documentation on using stacks in 5.5? I've experimented a little with setting global areas in themes, and adding a stack that works with that global area. When I create and page using the page type that has the area defined as a global area, and the name for that gloabal area matches a stack with the same name then the page will contain the block, and I can edit it from any page that has that block and all other pages with that global area are updated. What i'm not sure about though is in hte dashboard when I click on stacks it shows the stacks I created through the panel but says I have no global stacks. What exactly is the differance between a stack glabal stack, and how is a global stack implemented?

 
LilaLola replied on at Permalink Reply
LilaLola
Hi dintx9:

The difference between a global stack and a "normal" stack is that the global stack is for all your webpages, whereas the "normal" stack is for a single page (a collection of blocks).

To add a "normal" stack; you would go to the dashboard and select "stacks", click on "Add stack" and type in the field provided a new name, then select it and add your specific blocks for example content (or whatever you like), write a line of content, save it and return to website. That's a "single" stack, you should use several blocks to group them together, hence called stack.

To add a global stack; you would go to the dashboard and select Page Types, select the Page Type you would like to edit and click on Defaults => Edit this Page, Add to the section you want to update across your site. Exit Edit Mode, Publish your Edits and return to see your changes. This only applies to any new pages you add, however if you want to apply this to all your existing pages you would select child pages.

Check out this link, too:
http://www.concrete5.org/documentation/general-topics/scrapbooks/...

Let me know if that explains it, happy CONCRETING ;-)

LL
jordanlev replied on at Permalink Reply
jordanlev
@LilaLola's response contains good information, but I think your question was specifically about including "Global Areas" in your theme page type templates (using code, not the Page Defaults).

To do that, all you have to do is add the GlobalArea code to your page type template, but use a *different* name than what already exists in the list of stacks. Then the first time you visit a page using that page type, Concrete5 will see the code and automagically create the Global Area for you in the Stacks dashboard. (But if you use the same name as a stack that already exists, C5 will not create the global area for you and instead use the normal one that's already there).

The code to put into your page type template would be something like this:
<?php
$a = new GlobalArea('My new name');
$a->display();
?>


Super-simple, and really the best new feature in 5.5 (in my humble opinion) -- I will use these for site footers and sidebars all the time from now on.

-Jordan
MrNiceGaius replied on at Permalink Reply
MrNiceGaius
Thanks jordan, this is the new global area code right? Do you know where there is any documentation on this? I thought I came across something Andrew did but I can't find it ...
jordanlev replied on at Permalink Reply
jordanlev
I don't know of any docs. But as far as I know, there's not much to it -- you use "GlobalArea" instead of plain old "Area" in your page type template, then visit a page that has that in it one time, and now you should have a new "global area" in the Stacks dashboard page you can manage. Or you don't even need to go to the dashboard page because you can edit the global area from the page itself and that will apply across the whole site (and the dashboard page that has that stack in it too).
foiseworth replied on at Permalink Reply
foiseworth
The documentation that you might be referring to is here:

http://www.concrete5.org/documentation/how-tos/developers/concrete5...

However, someone should really add jordanlev's above explanation of how to do a global stack as it is not at all covered in the above link.

Do not try to add a stack to multiple pages via:

<?php
$b = Block::getByName('Header Menu');
$b->display();
?>


as the view.js and views.css files will not load, instead use a global area using jordanlev's code above. I don't think this is a bug but rather me confusing myself...
Trivious replied on at Permalink Reply
Trivious
I'm having a hard time finding where to put the code to recreate the Site Name Global Stack. Can you tell me where to put it please??

<?php
$a = new GlobalArea('Site Name');
$a->display();
?>
Mnkras replied on at Permalink Reply
Mnkras
In your theme header.php
Fxxxx replied on at Permalink Reply
Fxxxx
OK but if I want to make a theme compatible with concrete 5.4 and 5.5 and I want to use scrapbook/stacks to create the footer or the menu what code should I use?
andrew replied on at Permalink Reply
andrew
I would maintain two separate versions and make the version with the global block serve to concrete5 5.4.2.2 and earlier and the one with the global area serve to 5.5 and later.
jordanlev replied on at Permalink Reply
jordanlev
Andrew, what about users who have a particular theme and upgrade their Concrete5 version from 5.4.2 to 5.5 -- what do you think is the best way to ensure none of their content is lost (or "disappeared") after the upgrade?
JohntheFish replied on at Permalink Reply
JohntheFish
On a related topic, there is a bit of a chicken and egg problem with upgrades and themes. You cant upgrade the theme until you have upgraded C5. But if you upgrade C5 with the old version of a theme, it could break your site to the point where you can't get into the dashboard. On the offline sites I have been practising on (not done this for real yet), I have resorted to swapping the theme to default before doing the upgrade.
adamjohnson replied on at Permalink Reply
adamjohnson
@JohnTheFish That seems odd. Do your themes include footer_required? I've updated several former 5.4.2.2 sites to 5.5+ without problems. Could be one of your add ons interfering with C5.5's new UI too. Lot's of possible things going on there. YMMV I guess.

@jordanlev Wha...? Are you talking about in relation to scrapbooks?
jordanlev replied on at Permalink Reply
jordanlev
@riotaj - my question was in relation to @Fxxxx's question about having a theme that works in 5.4 and 5.5. I understand that you can have 2 different versions of the theme -- one for 5.4 and one for 5.5 -- but what does the end user do with their global content that was in a scrapbook in 5.4 but now is upgrading to 5.5 and hence using the new version of your theme that isn't relying on scrapbook anymore?