Copy of a block in same page
Permalink 1 user found helpful
I have a block in one part of my page and as my page is responsive i want to show the content in another area.
My idea was to use stacks but i want the user to edit and have different things on each page.
so i have
and then in another part of the page i was thinking of say
but nothing comes in and if i echo $blocks I get the words array.
My idea was to use stacks but i want the user to edit and have different things on each page.
so i have
$as = new Area('myBlock'); $as->display($c);
and then in another part of the page i was thinking of say
$page = Page::getCurrentPage(); $blocks = $page->getBlocks('myBlock');
but nothing comes in and if i echo $blocks I get the words array.
Thanks for that you must have read my mind.
I just tried it expecting an error and what do you know it works.
Thanks for you input.
I just tried it expecting an error and what do you know it works.
Thanks for you input.
P.s. This isn't how I do my responsive designs, I avoid this 'duplicate areas' tactic wherever possible as it is not great for performance or page loading speeds (especially if a mobile device is loading all of the content and then displaying only part of it). However, I can see the benefit of it if you needed something normally displayed in the footer to be displayed in the header for a mobile device, such as a location map, store opening hours or something like that.
If you don't want to have duplicate areas in your theme/page template:
You could use the built in block copy & paste which actually pastes a pointer to the original block.
You could also look at the Global Areas addon
http://www.concrete5.org/marketplace/addons/global-areas/...
Or my Universal Content Puller which can do the same and a lot more
http://www.concrete5.org/marketplace/addons/universal-content-pulle...
Use either to pull another area from the same page.
Or you could render the block once and use a snippet of jQuery to copy it to the other location in the browser.
You could use the built in block copy & paste which actually pastes a pointer to the original block.
You could also look at the Global Areas addon
http://www.concrete5.org/marketplace/addons/global-areas/...
Or my Universal Content Puller which can do the same and a lot more
http://www.concrete5.org/marketplace/addons/universal-content-pulle...
Use either to pull another area from the same page.
Or you could render the block once and use a snippet of jQuery to copy it to the other location in the browser.
Does that help?