Keyword

[SOLVED] Extra Fields Formatting Issue...

  • daniel nethery
  • daniel nethery's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #122029 by daniel nethery
[SOLVED] Extra Fields Formatting Issue... was created by daniel nethery
I'm using an Extra Fields type called Date. But when I try to reformat the date, I get a the current date rendered out…
<?php echo JHtml::date($item->extraFields->EventStartDate->value , 'Ymd');?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #122030 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Extra Fields Formatting Issue...
Which type of extrfield type are you using, also which version of Joomla! are you using?

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

  • daniel nethery
  • daniel nethery's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #122031 by daniel nethery
Replied by daniel nethery on topic Re: Extra Fields Formatting Issue...
I'm using a Date field (The one with the popup date selector) in Joomla 3.2

Thanks for the fast reply!

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 5 months ago #122032 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields Formatting Issue...
If you are working in the item view, i.e item.php, then it should be like this:
<?php echo JHtml::date($this->item->extraFields->EventStartDate->value , 'Ymd');?>

It starts with $this not $item

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #122033 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Extra Fields Formatting Issue...
Where is this happening in your template?

I tried
<?php echo JHtml::date($this->item->extraFields->datef->value , 'Y m d');?>
i

in item.php and it seemed to work fine under Joomla! 3.2 / K2 2.6.8 (Dev Build)

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

  • daniel nethery
  • daniel nethery's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #122034 by daniel nethery
Replied by daniel nethery on topic Re: Extra Fields Formatting Issue...
The issue was the how I was calling variable…


Wrong ->
$item->extraFields->EventStartDate->value
Right ->
$this->item->extraFields->EventStartDate->value

Thanks guys for the fast help!

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

  • Alfonso F. Moreno
  • Alfonso F. Moreno's Avatar
  • Offline
  • Elite Member
More
11 years 2 months ago #122035 by Alfonso F. Moreno
Replied by Alfonso F. Moreno on topic Re: [SOLVED] Extra Fields Formatting Issue...
This code shows for me the current date in "2014-03-20" format and not the date stored in database. Anybody knows why?????

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 2 months ago #122036 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: [SOLVED] Extra Fields Formatting Issue...
it will show the current date if the date value is empty or null

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • Alfonso F. Moreno
  • Alfonso F. Moreno's Avatar
  • Offline
  • Elite Member
More
11 years 2 months ago #122037 by Alfonso F. Moreno
Replied by Alfonso F. Moreno on topic Re: [SOLVED] Extra Fields Formatting Issue...
Unfortunately no...

Code is:
Log in  or Create an account to join the conversation.

  • Alfonso F. Moreno
  • Alfonso F. Moreno's Avatar
  • Offline
  • Elite Member
More
11 years 2 months ago #122038 by Alfonso F. Moreno
Replied by Alfonso F. Moreno on topic Re: [SOLVED] Extra Fields Formatting Issue...
Sorry....

You're right, the code should be:
getk2.org/community/English-K2-Community/170475-FIXED-DateTime__construct-datetime--construct-#184729

But still the same error, the part of: administrator\components\com_k2\views\item\view.html.php I think it have changed in some release...

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

More
11 years 2 months ago #122039 by Lefteris
Replied by Lefteris on topic Re: [SOLVED] Extra Fields Formatting Issue...
@Alfonso F. Moreno

Since you are using a custom format you don't need to use the JText. So the code will be like that:
<?php echo JHTML::_('date', $this->item->extraFields->fechainicio->value , 'Y-m-d'); ?>

Ensure that you are using a valid format that PHP can handle www.php.net/manual/en/datetime.formats.date.php .

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

  • Alfonso F. Moreno
  • Alfonso F. Moreno's Avatar
  • Offline
  • Elite Member
More
11 years 2 months ago #122040 by Alfonso F. Moreno
Replied by Alfonso F. Moreno on topic Re: [SOLVED] Extra Fields Formatting Issue...
Ok, I have changed it:
Log in  or Create an account to join the conversation.

More
11 years 2 months ago #122041 by Lefteris
Replied by Lefteris on topic Re: [SOLVED] Extra Fields Formatting Issue...
Which Joomla!/PHP versions are you using? Maybe the warning is coming from another piece of code in your page and not the specific file you have tweaked.

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

  • Alfonso F. Moreno
  • Alfonso F. Moreno's Avatar
  • Offline
  • Elite Member
More
11 years 2 months ago #122042 by Alfonso F. Moreno
Replied by Alfonso F. Moreno on topic Re: [SOLVED] Extra Fields Formatting Issue...
Joomla 2.5.19 K2 2.6.8 and PHP 5.3.2

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

More
11 years 2 months ago #122043 by Lefteris
Replied by Lefteris on topic Re: [SOLVED] Extra Fields Formatting Issue...
I am pretty sure that the error comes from another part of your page ( maybe a K2 module ?). Try to disable some modules temporarily to detect which one needs to be altered.

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

  • Alfonso F. Moreno
  • Alfonso F. Moreno's Avatar
  • Offline
  • Elite Member
More
11 years 2 months ago #122044 by Alfonso F. Moreno
Replied by Alfonso F. Moreno on topic Re: [SOLVED] Extra Fields Formatting Issue...
No, I have disabled ALL the modules assigned to that menu and still happens the same. Otherwise, I have found a temporary solution.

I don´t Know why it works if I do a language override of K2_DATE_FORMAT_LC with "Y-m-d" and create one new override K2_DATE_FORMAT_LC3 with "l, d F Y". Then, I change PHP to:

Log in  or Create an account to join the conversation.

More
11 years 2 months ago #122045 by Lefteris
Replied by Lefteris on topic Re: [SOLVED] Extra Fields Formatting Issue...
Obviously something was wrong with the translation of K2_DATE_FORMAT_LC. Also note that if you are under a Windows server some language modifiers are not supported.

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