Hello all.
Some time ago I self-taught myself PHP from a couple of books. I’d consider myself an intermediate coder.
Due to time constraints, I recently switched over to Joomla to manage my blog websites. They contain fictional content. The fictional setting uses the same calendar months and days that Earth does, but the year is formatted as “YCXXX” where XXX represents the numerical year. The YC bit is important, as is the three digit year. The blog articles are written in-character so the date that displays on them is a small but important detail to add immersion.
My non-Joomla websites achieved the date I needed via a MySQL query in my PHP code:
$query = "SELECT [...] DATE_FORMAT(date, '%Y') AS year [...]";
[...]
$year = ($row['year'] - 1898);
[...]
YC$year
So, if I post an article to that website in 2014, the code will output the fictional year as YC116 which is the correct result.
I understand about using overrides in Joomla, and I have located at least one file that seems to be the one that I need. The problem is that while the code in the file is written in PHP, it’s written in a way that is foreign to me. It’s…shorthand? (For lack of a better term.)
[php]<?php $useDefList = (($params->get(‘show_author’)) OR ($params->get(‘show_category’)) OR ($params->get(‘show_parent_category’))
OR ($params->get(‘show_create_date’)) OR ($params->get(‘show_modify_date’)) OR ($params->get(‘show_publish_date’))
OR ($params->get(‘show_hits’))); ?>
[…some other code here…]
<?php if ($params->get('show_create_date')) : ?> <dd class="create">
<?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHTML::_('date',$this->item->created, JText::_('DATE_FORMAT_LC2'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd class="modified">
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHTML::_('date',$this->item->modified, JText::_('DATE_FORMAT_LC2'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd class="published">
<?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE', JHTML::_('date',$this->item->publish_up, JText::_('DATE_FORMAT_LC2'))); ?>
</dd>
<?php endif; ?>[/php]
I have no idea what to do with the relevant bits of this to get it to do the math with the year that I need. I want the “published date” and the “last updated date” to be the ones that have the manipulated year. “Created date” should be left as the actual real life date.
Can someone help me with this or point me to a resource where I learn this…shorthand PHP?
Thanks!