getcollectionname / running 5.6.3.2

Permalink
Hello,
I'm probably a bit naif :
- I wanted to get the page title to put somewhere within it.
- I found many sode sample to do so.
- I used the HTML block to put the code into
Apparently the code is misunderstood and I get in treturn a part of the code itself :

$c = Page::getCurrentPage();
echo $c->getCollectionName();

would result in

$c = Page::getCurrentPage(); echo $c->getCollectionName();

being displayed. That is also true for authorname etc.

Could you please kindly tell me where i'm wrong?

 
ramonleenders replied on at Permalink Reply
ramonleenders
You are using PHP code in a HTML block. That won't work. One could create a block first with this info before adding this block in your site, that's the best way. Perhaps a block with page info you can display? Using a block where you can paste in PHP code wouldn't be really safe in my humble opinion.
olavax replied on at Permalink Reply
Outch !

I should be very tied !
Of course. I've just set up my first block this morning....
JohntheFish replied on at Permalink Reply
JohntheFish
A couple of my addons can be used to do that without writing code. Both offer a lot of other functionality. Both are only available for 5.6.x and before, not 5.7.
Magic Heading http://www.concrete5.org/marketplace/addons/magic-heading/...
Magic Data http://www.concrete5.org/marketplace/addons/magic-data/...

I think there are some other blocks in the marketplace that do similar.