Page Block for Concrete5
Use this block to easily display any page properties and custom fields in a block inside another page!
An example of usage is to feature some article from a page burried deep down in the site map, in the home page, or a more visible page.
The default view will print all page properties and custom fields, but of course you can easily override it.
The $page variable contains the selected page collection object.
Advanced users can use this varible to do anything they want using the standard collection, and collection helpers functions.
Otherwise, you can use the following functions to get the properties you want for the selected page:
$controller->getName();
$controller->getLink();
$controller->getDescription();
$controller->getCustomFields();
$controller->getValue('the_handle');
(where the_handle is the Page Attribute handle as defined in the dashboard under "Pages and Themes / Page Types")
Some page attributes can accept extra parameters:
If the attribute is of type DATE, then you can pass a date formating string as the first parameter, as defined here: http://nz.php.net/manual/en/function.date.php
E.g: $controller->getValue('my_date_handle',"d m Y @ h:iA");
If the attribute is of type IMAGE, then you can pass the maxWidth and maxHeight as parameters.
Default maxWidth and maxHeight are 200.
E.g: $controller->getValue('my_image_handle',120,80);
Also included is a sample template for the Page List block which will use the Page Block to display the pages.
As an example, this page contains a Page Block referring to the Area Splitter page in the sidebar.
Download the block here:
For Concrete 5.3.3 or later: page_block.zip
Enjoy!
Comments:
I've only tested it on 5.3.1.1
Regarding the content, it can be done but it requires some more advanced c5 knowledge. You would need to put a code similar to this (untested) in a custom template:
$blocks = $page->getBlocks('Main');
foreach($blocks as $block){
$bv = new BlockView();
$bv->render($block);
}
Could you add an another example of how to add a custom template? I tried what you posted above, but it doesn't seem to work.
I just need to wrap the output in various SPANs with classes...
Ok, if you got this far, you can now modify your new template file. If you're more specific about what you need there I'll be able to help.
Cheers,
Matt
Regards :)
Thank you for posting this block works great, however i am still unable to remove the unwanted fields from showing up, I tried following the instructions mentioned in the posts above but no luck !!
Thanks once again, I got it working .
Cheers !!
I am relative new to C5, and i would like to create block with slider. If I am honest I am trying to create it a few days now and now I find out your site on the Internet. I would like to put this one to my site http://sixrevisions.com/tutorials/javascript_tutorial/create-a-slick-and-accessible-slideshow-using-jquery/
and made it look similar to this site: http://www.promark.com. Can you please help me?
Thanks a lot!
I recently installed C5 (and updated to v. 5.4.1.1), for the first time...I'm a bit of a n00b with blocks in general. I've installed the block successfully, but whenever I try to add the Page Block to any editable area, I get the following error:
http://dl.dropbox.com/u/778166/Concrete5/Page-Block-Error.png
Any ideas on how I can fix it and get this Block working?
Thanks in advance...
I upgraded one of my sites where page block is being used to 5.4.1.1, and found that when I attempt to add this block, the Select Page link appears disabled and no other options appear, I just saw your comment "Ok, fixed" and I re-downloaded the package from this page and tried to compare the controller.php file and found to some code changes in the two, so i tried replacing the controller.php from the existing page block used by me with the new controller.php but still it stays disabled.
Hope you can help.
Thank you
"...if you build it... they will come..."

Area Splitter Block for Concrete5
The Area Splitter block lets you split any template Area into any number of sub areas you want.