Showing Page Attributes in a Custom Block Template
Permalink
I would like to create a modified Page List block view template which displays additional page attributes associated with the page.
For instance, I have a text attribute called with the handle "teaser" that I want to display below the linked title in the default view template.
I copied the page list over to my custom block folder and created a folder in that block folder called templates. I can now pick that template in the block instance.
I then tried to call up the attribute to be displayed but I'm failing.
I tried using the same code that I found to use in page display template. In the case of the teaser, that is:
This does not work in the block template. As you probably have guessed my php skills are almost non-existent.
Is there an code snippet I can add to a block display tempalte to display the contents of a page attribute associated with the page type I am displaying?
For instance, I have a text attribute called with the handle "teaser" that I want to display below the linked title in the default view template.
I copied the page list over to my custom block folder and created a folder in that block folder called templates. I can now pick that template in the block instance.
I then tried to call up the attribute to be displayed but I'm failing.
I tried using the same code that I found to use in page display template. In the case of the teaser, that is:
<?php echo $c->getCollectionAttributeValue('teaser') ?>
This does not work in the block template. As you probably have guessed my php skills are almost non-existent.
Is there an code snippet I can add to a block display tempalte to display the contents of a page attribute associated with the page type I am displaying?
<?php echo $cobj->getCollectionAttributeValue('teaser');?>