Load blocks from scrapbook on view.php?
Permalink
Hi all,
I am using Calendar addon and the individual events use view.php to display the details. I have a custom view.php where I show blocks like superfish, form and banner slider. I have saved these blocks in the global scrapbook.
Is there a way to call/include these blocks from scrapbook to the view.php so that they are already included instead of making them editable areas?
Any help will be highly appreciated. Thank you!
I am using Calendar addon and the individual events use view.php to display the details. I have a custom view.php where I show blocks like superfish, form and banner slider. I have saved these blocks in the global scrapbook.
Is there a way to call/include these blocks from scrapbook to the view.php so that they are already included instead of making them editable areas?
Any help will be highly appreciated. Thank you!
Hi jordanlev,
Thanks for the prompt answer!
Well it solved part of my problem.
I am trying to include/call four blocks to my view.php:
i) Superfish (package)
ii) Gallery banner (package)
iii) Form (core block)
iv) Text content (core block)
Using your code core blocks are add correctly but package blocks are not displayed correctly.
Here is the link to the site:
http://www.adventureout.2moons.com.au/events-calendar/this-is-test-...
May be I should include path to slyle, controller etc for the package blocks? How do I do this?
Thank you!
Thanks for the prompt answer!
Well it solved part of my problem.
I am trying to include/call four blocks to my view.php:
i) Superfish (package)
ii) Gallery banner (package)
iii) Form (core block)
iv) Text content (core block)
Using your code core blocks are add correctly but package blocks are not displayed correctly.
Here is the link to the site:
http://www.adventureout.2moons.com.au/events-calendar/this-is-test-...
May be I should include path to slyle, controller etc for the package blocks? How do I do this?
Thank you!
I'm not really sure. Are you trying to use custom templates for these blocks? Did you set those custom templates via the global scrapbook?
I know there are some thorny issues with trying to override package templates and then trying to get the site to recognize those files if it's in a scrapbook block, so you may be running into that issue.
I think there might be a better approach though to what you're trying to do -- check out this free addons:
http://www.concrete5.org/marketplace/addons/global-areas/...
...it might be easier to configure this than by hard-coding blocks into another block (so create some page that's hidden from the nav that just serves as a source for the global area, then add the global area block to your pages and point them to that hidden "source" page).
One problem you will definitely run into regardless of which approach you take, though, is that the Form block won't post to the proper page. You can get around this by using the free "Ajax Form" addon (it's a custom template for the built-in form block that submits via ajax so the page never has to redirect anywhere):
http://www.concrete5.org/marketplace/addons/ajax-form...
I know there are some thorny issues with trying to override package templates and then trying to get the site to recognize those files if it's in a scrapbook block, so you may be running into that issue.
I think there might be a better approach though to what you're trying to do -- check out this free addons:
http://www.concrete5.org/marketplace/addons/global-areas/...
...it might be easier to configure this than by hard-coding blocks into another block (so create some page that's hidden from the nav that just serves as a source for the global area, then add the global area block to your pages and point them to that hidden "source" page).
One problem you will definitely run into regardless of which approach you take, though, is that the Form block won't post to the proper page. You can get around this by using the free "Ajax Form" addon (it's a custom template for the built-in form block that submits via ajax so the page never has to redirect anywhere):
http://www.concrete5.org/marketplace/addons/ajax-form...
Problem solved!!
Thank you for directing me to the ajax form. You were right, my form was not working and with the ajax form saved my life!
The display problem of the blocks (from packages) I had in my view.php was solved by including the package's corresponding css, e.g for the rotating banner to work correctly in my view.php, I pasted the code:
<link rel="stylesheet" type="text/css" href="/packages/miss_marvels_gallery_banner/css/mm_carrousel.css" />
Thank you for directing me to the ajax form. You were right, my form was not working and with the ajax form saved my life!
The display problem of the blocks (from packages) I had in my view.php was solved by including the package's corresponding css, e.g for the rotating banner to work correctly in my view.php, I pasted the code:
<link rel="stylesheet" type="text/css" href="/packages/miss_marvels_gallery_banner/css/mm_carrousel.css" />
It doesn't matter which global scrapbook the block is in, you just need to use the block's name (which you can assign from the global scrapbook list). I know this works in theme templates, but I'm not sure it works inside other block view.php files -- but can't hurt to try.