Forums

How do i send the content of my article where my Chronoforms module is embeded in ?

gemeline 20 Feb, 2019
I need a Hidden field where i retrieve the content, probably ?? How to?
healyhatman 20 Feb, 2019
https://joomla.stackexchange.com/questions/19409/how-can-i-show-the-published-date-of-the-current-article-inside-a-module

Get the details with PHP, and THEN display the form. Use {var:php_block_name} in the Value of your hidden field.
gemeline 21 Feb, 2019
Thank you so much! here is the code for those who need it :

// FIRSTLY CHECK THAT THE PAGE THE MODULE APPEARS ON IS AN ARTICLE
$nameofcomponent = JRequest::getVar('option');
$viewofcomponent = JRequest::getVar('view');

if ($nameofcomponent=="com_content" && $viewofcomponent=="article" ) {

// IT IS AN ARTICLE, SO GET THE ID OF THE ARTICLE
$idofarticle = JRequest::getInt('id');

// LOAD THE MODEL OF COM_CONTENT
$model = JModelLegacy::getInstance('Article', 'ContentModel');
// USE THE GETITEM FUNCTION OF THE MODEL TO RETURN THE DETAILS
$article = $model->getItem($idofarticle);


// GET THE CONTENT TEXT
$content = $article->introtext;
return $content ;
}
Rammis 28 Feb, 2019
I take this code does exactly what your question was and nothing else, Gemeline? Much appreciated, if so.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}