How can i display a version-note from an article on the front-end – like the date or author tags?


Here's a quick guide on how to do that:

/* First include the path */
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_contenthistory', 'ContenthistoryModel');

/* Now instantiate the model */
$historyModel = JModelLegacy::getInstance('History', 'ContenthistoryModel');

/* Now get the content history of the current article */
$items = $historyModel->getItems();

/* Now get the last item. Note that depending on the ordering, you may need to get the first item */
$lastItem = array_pop($items);

/* Now you can get the latest note */
$latestNote = $lastItem->version_note;

Note that I haven't tested the above code, but technically it should work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.