M
M
Mikhail Maximov2019-01-15 11:30:53
Joomla
Mikhail Maximov, 2019-01-15 11:30:53

How to add last modified date to material text in Joomla 3?

In the content manager, I add a page and try to add an edit date. Standard solutions in the display settings do not work. Please help me how to write the code.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Rekun, 2019-01-15
@mmaximov97

I'm pasting the code using paste directly into the material.

That is, PHP code through the plugin for inserting code directly into the material? If you drag directly from the database, then the code is as follows:
$id = JFactory::getApplication()->input->getInt('id', 0); // получаем ID материала
$db = JFactory::getDbo(); // объект БД
$query = $db->getQuery(true); // объект конструктора запросов

$query->select('modified');
$query->from($db->quoteName('#__content'));
$query->where($db->quoteName('id') . ' = ' . (int) $id);

$modified = $db->setQuery($query)->$db->loadResult();

https://docs.joomla.org/Selecting_data_using_JData...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question