Composer Form Content in a Page List View?

Permalink 1 user found helpful
Is it possible to pull non-custom attribute composer form Content (as in content block text) into a Page List view template?

tduncandesign
 
pvernaglia replied on at Permalink Best Answer Reply
pvernaglia
I've done it like this, replacing the line where $description comes from the attribute

[code]
$pBlocks = $page->GetBlocks();
foreach ($pBlocks as $pBlock){
if ($pBlock->btHandle == 'content') {
$blockContent = $pBlock->getInstance();
$description = $blockContent->getContent();
}
}
tduncandesign replied on at Permalink Reply
tduncandesign
Thank you pvernaglia!
tduncandesign replied on at Permalink Reply
tduncandesign
Finally got to this phase of the project, this worked a treat. I tweaked it a bit to truncate to the first paragraph, leaving this here for posterity... may help someone else.

// get description composer form block content   
        $pBlocks = $page->GetBlocks();
              foreach ($pBlocks as $pBlock){
                    if ($pBlock->btHandle == 'content') {
                        $blockContent = $pBlock->getInstance();
                        $description = $blockContent->getContent();
                        // truncate it to the first paragraph, so we don't pickup unordered feature lists for listings view - td
                        $description = substr($description,0, strpos($description, "</p>")+4);
                    }
              }
cmynsc replied on at Permalink Reply
Thank you for this snippet! Helped me save a lot of time.