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?
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>
Viewing 15 lines of 45 lines. View entire code block.
Type: | Discussion |
---|---|
Status: | New |
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
I tried utilizing the back method below but no go it brings up a 404 page.
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 :)
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
Viewing 15 lines of 22 lines. View entire code block.
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:
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.
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.
with
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.