"Render" an article through custom php module

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
CreekJumper
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Oct 20, 2017 3:24 pm

"Render" an article through custom php module

Postby CreekJumper » Fri Dec 15, 2017 10:34 pm

Hello, I have created a custom module which renders certain articles based on some values attached to user logged in. It works well, except for the times I want to output a field value within an article like {Field 1), etc.

This is because I am reading the joomla database directly and outputting the content via a php echo.

Is there a way to "render" the article instead of just dumping whats in the database? I'd like the article to "render" with the field values, etc.

CreekJumper
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Oct 20, 2017 3:24 pm

Re: "Render" an article through custom php module

Postby CreekJumper » Sat Dec 16, 2017 2:03 am

No Responses... Maybe I did not provide enough info.

I am trying to output the FULL contents of an article, including any custom field values via PHP. If I view the article in Joomla, I see the values of the embedded custom fields. When I view through my custom module (which uses php JTable::getInstance('Content', 'JTable') -- I get the article contents fine. However, any custom fields {Field 1},etc that may be embedded into the article do not get converted, instead they stay as {field 1), etc.

I would like to render the article just as joomla does so I get the custom fields. Some sample code would be appreciated..

Thanks

User avatar
effrit
Joomla! Explorer
Joomla! Explorer
Posts: 318
Joined: Sun Nov 12, 2017 2:21 pm
Location: middle of Russia
Contact:

Re: "Render" an article through custom php module

Postby effrit » Sat Dec 16, 2017 2:49 am

hi.
i am not sure, but you can try to handle with content plugins

Code: Select all

JHTML::_('content.prepare', $mytext);


in standard Custom it looks like

Code: Select all

JPluginHelper::importPlugin('content');
$module->content = JHtml::_('content.prepare', $module->content, '', 'mod_custom.content');


Return to “Joomla! 3.x Coding”

Who is online

Users browsing this forum: No registered users and 6 guests