some concrete5 tricks
Some time ago I was asked a question (through the form you see on the right). Here is the question:
hello, so i tried setting up some new functions in C5, including a breadcrumb and a more "blog like" interface .. both of them come up with parsing errors, it must be that i’m not implementing the code correctly.
here is what i found,
<h3><?= $c->getCollectionName() ?></h3>
<div id='blog-envelope-information'>
Posted by <?= $c->vObj->Version($c, $cvID = "ACTIVE", $extended=true)->getV
ersionAuthorUserName() ?>
at <?= $c->vObj->Version($c, $cvID = "ACTIVE", $extended=true)->getVersionD
ateCreated('Y') ?>
</div>
i assumed that creating a "blog.php" in my themes folder and with the h3 & div tags it would work fine but i still get errors.. i’m really confused, and could use a pointer if you have a sec. thank you.
Here are solutions I suggested:
To display page author name in concrete5.1.1, use this code:
<?php
$author = User::getByUserID($c->getCollectionUserID());
print $author->getUserName();
?>
In concrete 5.2.0 and higher, use this code:
<?php print $c->vObj->getVersionAuthorUserName(); ?>
To display page name in concrete5, use the code as follows:
<?php print $c->getCollectionName(); ?>
To display page publication date in concrete5, try this code snippet:
<?php print $c->vObj->getVersionDateCreated(); ?>