Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: seadhna on April 15, 2013, 13:54:00

Title: Override Created Date?
Post by: seadhna on April 15, 2013, 13:54:00
Hi there, in the previous versions of Elxis, it was possible to override the created date. I have migrated manually a full website to the new version of Elxis but need to override the created date for each article so that it shows up as it previously did. I can't find where to do this - is it possible?
Title: Re: Override Created Date?
Post by: webgift on April 15, 2013, 16:46:39
I think that we have already discussed that. Anyway, you can change the created day manually by using a database tool like phpmyadmin.
Database table: #__content
Column: created
Title: Re: Override Created Date?
Post by: seadhna on April 15, 2013, 18:33:29
Ok, gotcha, thanks!
Title: Re: Override Created Date?
Post by: seadhna on April 15, 2013, 19:09:59
Forgot to ask: I'd like to add individual classes to the year, month and date of the 'created date' on each article. Could you tell me where to find the file containing this code? i.e. where the created date is generated in the core code? I've looked everywhere I can think of but can't find. i.e. instead of the line generated being:

<div class="elx_dateauthor">Fri April 12, 2013 16:57</div>

I would like it to be:

<div class="elx_dateauthor"><span class="month">April</span><span class="day">12</span><span class="year">2013</div>

Many thanks as always!
Title: Format options for date
Post by: datahell on April 15, 2013, 20:10:53
The date format is set in the language files. In top of each main language file (en.php, el.php, it.php, etc...) there are 13 date format options (DATE_FORMAT_1 ... DATE_FORMAT_13). These options affect only the rendering so it is safe to modify them.

Examples
$_lang['DATE_FORMAT_5'] = "%B %d, %Y %H:%M";
Output for the English language: April 15, 2013 20:07

Make the month name bold:
$_lang['DATE_FORMAT_5'] = "<strong>%B</strong> %d, %Y %H:%M";
New output: April 15, 2013 20:07

Add spans as you wish:
$_lang['DATE_FORMAT_5'] = '<span class="month">%B</span> <span class="day">%d</span>, <span class="year">%Y</span> %H:%M';

Do the same for any DATE_FORMAT_x option (don't modify the DATE_FORMAT_BOX and DATE_FORMAT_BOX_LONG options!).

Note 1
This is a global setting and it will affect everything, not just the articles. In your CSS make sure the special formatting to be applied only in your frontend articles.
So don't add css rules like that: .month { color:blue; }
But like that: div.elx_dateauthor .month { color:blue; }

Note 2
Elxis supports date interfaces which provide customization over date format/rendering. Greek and Farsi are 2 language already having such an interface.
elxisLocalDate interface: includes/libraries/elxis/date/date.interface.php
Required interface methods:
public function __construct();
public function local_strftime($format, $ts);
public function local_to_elxis($date, $offset);
public function elxis_to_local($date, $offset);

Greek implementation (provides correct conjugation for month names): includes/libraries/elxis/date/el.date.php
Farsi implementation (provides Gregorian to/from Jalaly calendar conversions): includes/libraries/elxis/date/fa.date.php
Title: Re: Override Created Date?
Post by: seadhna on April 15, 2013, 22:49:39
Thanks, that's a huge help.
Title: Re: Override Created Date?
Post by: datahell on April 15, 2013, 23:17:58
With Elxis 4.x you can do whatever you like easily, for me it is like a playground. The core is built in a way to support many things even those we haven't yet implemented into Elxis! And the most important of all, Elxis 4.x is VERY secure. Whatever need you have ask here to get the best solution.
Title: Re: Override Created Date?
Post by: SecondHand on April 23, 2013, 18:55:21
Anyway, to set up date manually on the details tab of article edit page, would be useful. I decided to be smarty and to use subtitle as a date line but now realised that article's ordering related to the dates only :( Tried manual sorting of articles. But it display correct just inside of news category but not on the front page. So without coding or getting into phpMyAdmin unable to deal with it. I am ok with it but my manager blondie not. But I am too nooby for coding. Will appreciate for advise what file can be edited to make date line editable on details tab. Thnx.