echo out page descsription

Permalink
Hello - i need to echo out the page description of a site and i need to add it to a view.php file - how would you do this ?

How this will work is i add a new page and a description for that page. Then on that page i will add a block (a designer content block) and in that blocks view.php i need a code so it will echo out the page description.

i found this code

<?php echo $c->getCollectionDescription() ?>


but nothing shows even though i have made a description when i added the new page... I add a block (designer content) to the page with the description and its also that blocks view.php file i gave the code to echo out the description.

Im really newbie with coding stuff like this, so any help would be appreciated.

thank you.

 
berteldk replied on at Permalink Reply
hmm i thought this would be fairly simple to people not beeing a rookie.

Nobody know how to do this?
moosh replied on at Permalink Reply
moosh
Hello,

If i undestand, you want echo current page description by calling $c->getCollectionDescription() within a block view.php (like content block) ?

mOoSh
berteldk replied on at Permalink Reply
yes exactly... How this will work is i add a new page and a description for that page. Then on that page i will add a block (a designer content block) and in that blocks view.php i need a code so it will echo out the page description.
Mnkras replied on at Permalink Reply
Mnkras
before that, try putting:
$c = Page::getCurrentPage();
berteldk replied on at Permalink Reply
like this?
<?php $c = Page::getCurrentPage(); echo $c->getCollectionDescription()?>


EDIT: this wont work :( - thank you for trying though... anyone else have a suggestion?
moosh replied on at Permalink Best Answer Reply
moosh
Try this :

global $c
echo $c->getCollectionDescription();


Or

$v = View::getInstance();
echo $v->getCollectionObject()->getCollectionDescription();
berteldk replied on at Permalink Reply
you my hero... the last one worked. Thank you so much!!! Last request is to add a class arround the text, how would you then do that? or just a p tag...?

<p class="test"><?php $v = View::getInstance();
echo $v->getCollectionObject()->getCollectionDescription(); ?></p>


is that ok?
moosh replied on at Permalink Reply
moosh
no problem ! :p

You can wrap code with p, span, div tags (any html element you want)
jamesleech replied on at Permalink Reply
jamesleech
Thanks - helpful for me also.