echo creation date in a specific way

More
11 years 8 months ago #34222 by bobthebob01
Hi,

First: congrats on V2 release! FC just keeps on getting better and better.

Second: i have a specific need to display the creation date. I'm using d F Y in the configuration of the created on field.
But i need to have a < br > tag between each values to get the following:
Code:
29<br> May<br> 2013

Please note that i am trying to achieve this in category view for each item (category_items_html5.php).

Is there a way to "echo" the date, day and year individually?

thanks in advance.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34241 by ggppdk
You can add the following into your template (enter correct field name below and you may need to correct the code too):
Code:
FlexicontentFields::getFieldDisplay($item, 'mydatefieldname'); $dthtml = $item->fields['mydatefieldname']->display; $dthtml = str_replace('/','<br/>',$dthtml); echo $dthtml;

NOTE 1: Depending on your template $item will be $this->item (in item view) or $items[$i] in some category layout

NOTE 2: in str_replace above use '-' instead of '/' if you have such a custom date output


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34252 by bobthebob01
Thanks ggppdk,

sorry to pick your brain more, but i'm having some error of undefined variables when i try to plug your code in mine.
here is my category_items_html5.php. It's very simple but specific design/layout i need to have:
Code:
<?php /** * HTML5 Template * @version 1.5 stable $Id: category_items_html5.php 0001 2012-09-23 14:00:28Z Rehne $ * @package Joomla * @subpackage FLEXIcontent * @copyright (C) 2009 Emmanuel Danan - www.vistamedia.fr * @license GNU/GPL v2 * * FLEXIcontent is a derivative work of the excellent QuickFAQ component * @copyright (C) 2008 Christoph Lukes * see www.schlu.net for more information * * FLEXIcontent is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ defined( '_JEXEC' ) or die( 'Restricted access' ); // first define the template name $tmpl = $this->tmpl; $user =& JFactory::getUser(); $items = & $this->items; ?> <?php foreach ($items as $item) : ?> <div class="cat-view-list-item clearfix"> <article> <div class="full-block-item"> <div class="full-block-title"> <?php if (isset($item->positions['creation-date'])) : ?> <?php foreach ($item->positions['creation-date'] as $field) : ?> <h2><?php echo $field->display; ?></h2> <?php endforeach; ?> <?php endif; ?> </div> <div class="full-block-content deepest"> <header> <?php if ($this->params->get('show_title', 1)) : ?> <h2><?php echo $item->title; ?></h2> <?php endif; ?> </header> <?php if (isset($item->positions['description'])) : ?> <?php foreach ($item->positions['description'] as $field) : ?> <?php echo(substr($field->display, 0,300)); ?> <?php endforeach; ?> <?php endif; ?> <p class="right-align">[url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug)); ?>" class="readon" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' );?>: <?php echo $item->title; ?>]<img src="images/readmore.png" alt="read more icon">[/url]</p> </div> </div> </article> </div> <?php endforeach; ?> <?php if ($this->getModel()->getState('limit')) : // Check case of creating a category view without items ?> <div class="noitems group"><?php echo JText::_( 'FLEXI_NO_ITEMS_CAT' ); ?></div> <?php endif; ?>

thanks again very much.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34254 by ggppdk
Hello,
you should copy message here,

Did you place code inside the loop?
you need to do this !

Otherwise you will get "undefined variables" warnings

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 1.278 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline