Including a block type/data on every new page
Permalink
Can't find any documentation on this specifically even though I'm sure it exists, so forgive me. Is there a way to include a block on a page type so that as soon as the user adds a new page, the block and data will show on the new page?
For example, I click "Add a page" and select a page type I created called "Work." "Work" requires the header.php file in /elements folder, and header.php contains this:
Is there a way to make this show on a new page, and display the same data? It's not working for me.
Thanks!
For example, I click "Add a page" and select a page type I created called "Work." "Work" requires the header.php file in /elements folder, and header.php contains this:
<?php $a = new Area('EW Header Nav'); $a->disableControls(); $a->display($c); ?>
Is there a way to make this show on a new page, and display the same data? It's not working for me.
Thanks!
Thank you! This works.
Funny, I remember reading this a while back but forgot the details, and could never find it again. Thanks again.
Funny, I remember reading this a while back but forgot the details, and could never find it again. Thanks again.
That's the easiest way.
Here is another way that I just saw last week and have yet to try:
http://www.concrete5.org/community/forums/customizing_c5/hard-codin...
And there's another method described here that creates blocks that can only be changed in the page template. I've used this method a lot for things I don't want clients to screw up:
http://www.codeblog.ch/2009/04/concrete5-blocks-within-templates/2/...
For this method, you can view whatever variables you need to set by examining the block's form_setup_html.php. I've started a running list of these variables for some blocks, attached.
Here is another way that I just saw last week and have yet to try:
http://www.concrete5.org/community/forums/customizing_c5/hard-codin...
And there's another method described here that creates blocks that can only be changed in the page template. I've used this method a lot for things I don't want clients to screw up:
http://www.codeblog.ch/2009/04/concrete5-blocks-within-templates/2/...
For this method, you can view whatever variables you need to set by examining the block's form_setup_html.php. I've started a running list of these variables for some blocks, attached.
Go into the Dashboard, then Pages & Themes, then click Page Types on the top navigation bar.
This will bring up a list of installed page types, find the one you want to update the defaults for and click the 'Defaults' button next to it.
Make your changes then publish the page.
All new pages created with this page type will now have the defaults you just setup.
Oli