Meta data in blog entry1 user found helpful
Now, one thing I miss is a kind of topic link in the meta header of the blog entry. Just under the page title there is the creation date and the user name. I would like to see there a link to the blog entry topic under which the blog post was posted.
I tried editing the file ../concrete/blocks/page_title/templates/byline.php, adding something like...
but it doesn't work.
Does anyone know if that could be implemented by editing that file, and how?
Here's how I would approach the problem.
1. First, turn off the overrides cache in Dashboard > System and Settings > Optimization > Cache and Speed Settings.
2. Next, create a new directory at application/blocks/page_title/templates/. Copy concrete/blocks/page_title/templates/byline.php into this directory. Since you turned off the overrides cache, the system will look into the application directory before looking into the concrete directory, and you'll be able to keep your custom changes separate from concrete5's internal code.
3. Now, you can make changes to byline.php for this new functionality. Here's a custom template that should get you started:
<?php defined('C5_EXECUTE') or die("Access Denied."); $dh = Core::make('helper/date'); /* @var $dh \Concrete\Core\Localization\Service\Date */ $page = Page::getCurrentPage(); $date = Core::make('helper/date')->formatDate($page->getCollectionDatePublic(), true); $user = UserInfo::getByID($page->getCollectionUserID()); ?> <div class="ccm-block-page-title-byline"> <h1 class="page-title"><?=$title?></h1> <span class="page-date"> <? print $date; ?> </span> <? if (is_object($user)): ?> <span class="page-author"> <? print $user->getUserDisplayName(); ?> </span>
It's basically the same as the byline template, but in order to show topics it grabs the custom attributes of the current page, and loops through them. A couple notes:
1. This assumes that you're using blog_entry_topics. This is a separate attribute from project_topics, etc... so this is doing some hard coding. You might consider making separate custom templates for the different areas of your site.
2. This assumes you always want to link up to the parent page.
3. This doesn't give you any CSS for the page-topics class applied to the span. You'll have to do that yourself.
Hope this helps!