Add a title, date and a back button to the main story of easy news

Permalink Browser Info Environment
Hi Guys

I managed to add the time and a read more img to the summary of the story/ front of news now i would like to add either a:

1. Breadcrumb to the actual story / level 2 so users can navigate back
2. a back button like the readmore

Also add add the title and time as per above but also in level 2

I am not sure where the actual code that writes the full story is. Sorry in advance I am not a coder just have an understating of the code :)

Code of my view.php below, any ideas?

<?php  
   defined('C5_EXECUTE') or die(_("Access Denied."));
   $textHelper = Loader::helper("text"); 
   // now that we're in the specialized content file for this block type, 
   // we'll include this block type's class, and pass the block to it, and get
   // the content
   if (count($cArray) > 0) { ?>
   <div class="ccm-page-list">
   <?php  
   for ($i = 0; $i < count($cArray); $i++ ) {
      $cobj = $cArray[$i]; 
      $title = $cobj->getCollectionName(); ?>
   <h2 class="ccm-page-list-title"><a href="<?php  echo $nh->getLinkToCollection($cobj)?>"><?php  echo $title?> - <?php echo strftime("%d . %m . %Y", strtotime($cobj->getCollectionDatePublic())); ?></a></h2>
   <?php   if ($cobj->getCollectionTypeHandle()=="Press Release") { ?>
      <h4><?php   echo $cobj->getCollectionAttributeValue('Press_Release_Type'); ?> - for release on <?php   echo strftime("%x %l:%M%p",strtotime($cobj->getCollectionAttributeValue('Release_Date'))); ?></h4>

Type: Discussion
Status: New
reachdigital
View Replies: View Best Answer
hanicker replied on at Permalink Reply
hanicker
A solution may be to open your theme folder, copy default.php to news.php, install it as a page type, modify news.php replacing
<?php
$a = new Area('Breadcrumb');
$a->display($c);
?>

with
<?php
$a = new Area('Breadcrumb');
$a->display($c);
?>
<?php
$a = new Area('Main');
$a->display($c);
?>

Then install and edit the news page type by clicking on Default from Dashboard->pages and themes->Page types.
Add an auto-nav block in the breadcrumb area and set default template to "breadcrumb" by clicking on it.
To add a back button add a new area "back" after main with an image linked to your news section.
reachdigital replied on at Permalink Reply 2 Attachments
reachdigital
Hi Hanicker

Thanks for the repose some of this has worked but some not and probably my lack of code so I apologize in advance.

1 . I used <h1><?php echo $c->getCollectionName(); ?></h1> to generate the Title, problem with this is the main news list displays the page page "Name" in this case news which reflects the autonav also. ( see news_list.jpg attached , this works great for the main article as it displays the title :)

2. Other issue is that if add the breadcrumb to the page type it also displays this in the news list main page and the actual article. I would just like to display the breadcrumb to the main article so user can go back to the news list?

3. I added a back area as advised and added my graphic to that area, this works ok although I am using javascript and is not that great, see main_article.jpg attached

<a onclick="history.go(-1)" href="#"><img style="float: right;" src="/maycon/index.php/download_file/view_inline/9/" alt="maycon_back_btn.png" width="127" height="24" /></a>


I tried utilizing the back method below but no go it brings up a 404 page.

<?php
$page = Page::getByID($c->getCollectionParentID());
$parent_url = View::URL($page->getCollectionPath());
?>
<a href="<?=$parent_url?>">Back to Overview</a>


4.Finally this is my news.php file for your reference if you think you help that would be greatly appreciated, Im pretty sure this will help alot of people out there :)

<?php  
defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header.php'); ?>
   <div id="central" class="no-sidebar">
   <div id="body">   
<?php /*?>         <?php
            $a = new Area('Breadcrumb');
            $a->display($c);
            ?><?php */?>
            <h1><?php   echo $c->getCollectionName(); ?></h1>
            <?php
            $a = new Area('Main');
            $a->display($c);
            ?>
            <?php
hanicker replied on at Permalink Best Answer Reply
hanicker
Hi. I think you should use news.php page type only for main articles, and not for the page displaying news list, so you can avoid 1. and 2. If I understood them correctly, set default page type for newslist page.
For the the back method I would use this code:
<?php
$page = Page::getByPath('/news');
$parent_url = View::URL($page->getCollectionPath());
?>
<a href="<?=$parent_url?>">Back to Overview</a>

where you can change news with the path of your main "news" page.

PS: for 1. you may want to click page properties and change Name with "News".

Hope this helps, let me know if I misunderstood anything.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.