Include page properties in text block

Permalink
Hi, is it possible to include page properties in a tekst block?

I have a stack I want to include in various pages. The stack contains a default text, but I want it combined with the page properties. EG.

Default text: Nice to meet you + [PAGE TITLE PROPERTY]

So if the page name is, Jason, it should become:

Nice to meet you, Jason

Hope someone can help! Thanks

ZillionProductions
 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
You can append this code to your default text
<?php  $page=Page::getByID($c->getCollectionID());  echo $page->getCollectionName();?>
JohntheFish replied on at Permalink Reply
JohntheFish
Any reason that can't be simplified?
echo $c->getCollectionName();
ZillionProductions replied on at Permalink Reply
ZillionProductions
Hi, thanks for the quick help. I'm probably doing it wrong. When I paste the code into the TEXT BLOCK using the SOURCE button, I still see code instead of result.

Also tried adding it to an HTML block.

Any tips? Thanks!
JohntheFish replied on at Permalink Reply
JohntheFish
Though with that in mind, you could just add a 'Page Title' block.
ZillionProductions replied on at Permalink Reply
ZillionProductions
What I want is to have a TEXT BLOCK with text like:

Hello, [TITLE OF THE PAGE], bla bla bla.
JohntheFish replied on at Permalink Reply
JohntheFish
To add code, you would need to use either a php or code block (dangerous, but free in the marketplace), or create a new block view template for an existing block and add the code to the template.

If all you need is the page heading, then a page title block may be your easiest solution.

You could also look at the 'Page Attribute Display' block.
ZillionProductions replied on at Permalink Reply
ZillionProductions
I can't use the Page properties block, because I need the text and property to be a link.

EG:

I have a STACK that contains a text block with the text 'EMAIL NAME'. This needs to be a link to the contact page. All the pages that have this STACK will link to the SAME contact form, but I want the text to be different on all pages. EG. EMAIL JASON or EMAIL KATY of EMAIL AMANDA, etc.

The NAME must come form the page property.
JohntheFish replied on at Permalink Reply
JohntheFish
You will need either a custom block or a custom template for one of the above blocks.

Your template would put your boilerplate text and link about the page title.
JohntheFish replied on at Permalink Reply
JohntheFish
There is also a 'Shortcodes' addon https://www.concrete5.org/marketplace/addons/shortcodes...
, but you still need to supply the php to generate the inserted text.

Unless you have a lot of other uses for inerting stuff, stick with a custom template.
ZillionProductions replied on at Permalink Reply
ZillionProductions
Thanks man! I'll check it out ;)