Saturday, 03 August 2013 22:45

How to embed html or other codes in a Joomla article?

Written by 
Rate this item
(0 votes)

It's very common purpose when it comes to insert advertising scripts
or other html codes in a joomla article.you can easily create a plugin
which can insert your code after title or content or before content
of the article.Following way i demonstrate how to achieve
this great task -

If you want to insert codes after article title use this plugin
event -

public function onContentAfterTitle($context, &$article, &$params, $limitstart)
{
return "<p>Hello World</p>";
}

If you want to insert codes before article content displayed then
user this event -

public function onContentBeforeDisplay($context, &$row, &$params, $limitstart)
{
return '<div>ad code1</div>';
}

But if you want codes to be appared after article content then this -

public function onContentAfterDisplay($context, &$row, &$params, $limitstart)
{
return "<div>ad code 2</div>";
}

Hope that helped you very much.If it helped you in greater extent
then share and like at least

Read 3303 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.