Using Dynamic Attributes in Content block?

Permalink
I want to create a Page Type which includes a default 'Content' block, but I'd like this content block to dynamically pull in the 'Title' from the page, i.e...

"This page is for ##PAGE TITLE HERE##".

Is this possible OOTB?

 
A3020 replied on at Permalink Best Answer Reply
A3020
As far as I know, this isn't possible. Most people would use $c->getCollectionName() in their templates, I think...
sergeant replied on at Permalink Reply
Thanks akodde, such a shame as this is such a basic feature for a CMS :(
A3020 replied on at Permalink Reply
A3020
If you really want this you'd override the 'composer.php' from the Content block. Then check $this->field('content'). If it's empty, give it the text you want.
sergeant replied on at Permalink Reply
Hi Akodde,

I'm now using your suggested string of code to display the values chosen for the page from a 'Select' type attribute, however its being returned as a standard string, not an array, and without delimiting, for instance.

value 1 value 2 value 3

Is there anyway that I can alter this to return comma separated?
A3020 replied on at Permalink Reply
A3020
$ak = CollectionAttributeKey::getByHandle('attribute_handle');
if(is_object($ak)){
    $akc = $ak->getController();
    $options = $akc->getOptions();
    echo implode(',', $options);   
}
sergeant replied on at Permalink Reply
I have tried that, replacing the 'attribute_handle' with the name of my attribute, but I get the following error:

Warning: implode(): Invalid arguments passed in
/home/siteaddress/themes/themeaddress_v1/pagetypeaddress.php
on line 48


Just to confirm - this is a new 'pagetype' php that I have created, applied to a page, then ticked a few options in my custom attribute (of type 'select').

Thanks for your help so far!
A3020 replied on at Permalink Reply
A3020
Ah wait, my bad.

This is probably the code you're looking for:
http://www.weblicating.com/doku/doku.php?id=cheatsheet/#display_get...
sergeant replied on at Permalink Reply
I did try this one this morning, but it returns all values from the Attribute, and I only wish to display the values selected/checked under the Page Properties for the attribute.
sergeant replied on at Permalink Reply
Guess what I just found!!
http://www.concrete5.org/marketplace/addons/attribute-displayer/...

And this one too!
http://www.concrete5.org/marketplace/addons/page-properties/...

Will give them a go and report back.

FREE too!
enlil replied on at Permalink Reply
enlil
This add-on will accomplish what you are looking for:

http://www.concrete5.org/marketplace/addons/magic-data/...
JohntheFish replied on at Permalink Reply
JohntheFish
As @enlil says, pulling in page properties and attributes to a content block is easy with Magic Data.

If it is just an initial heading you want to reflect the page title, you could also look at my Magic Heading block.

http://www.concrete5.org/marketplace/addons/magic-heading/...

Which to use depends on your overall requirement and what fringe benefits you can use.

Magic Heading also manages the page meta title and description that may be advantageous for SEO.

Magic Data can be useful for pulling in all sorts of data from user, products, files etc. and is the foundation for integrating information from and to many other addons.