Plugin that insert <img scr="..."> tag to the begining of an article before save

157 views
Skip to first unread message

LoZo

unread,
Dec 8, 2014, 5:37:10 AM12/8/14
to joomla-de...@googlegroups.com
Hello,

Before I start  to program I would like to know if it is possible to make a plugin that insert a html tag to the begining of an article only in selected categories (Category News). Or even better set image as an intro image?
I read that joomla has some events...onContentBeforeSave. But how can I manipulate the arcticle? Some example will be appreciate.

Thanks 


Seth Warburton

unread,
Dec 8, 2014, 5:55:26 AM12/8/14
to joomla-de...@googlegroups.com
You know that you can already set intro images using the existing article options, right?

ced1870

unread,
Dec 8, 2014, 6:00:56 AM12/8/14
to joomla-de...@googlegroups.com
+1 with Seth, because anyway you will have to set the image url somewhere
CEd

LoZo

unread,
Dec 8, 2014, 7:18:29 AM12/8/14
to joomla-de...@googlegroups.com
Yes I know but I need this for the front site users which are posting news. Because it will be the same image for every article which goes to the news category and I don't want to repeat that think everytime someone post a news.

Dne ponedeljek, 08. december 2014 11:55:26 UTC+1 je oseba Seth Warburton napisala:

Sergio Manzi

unread,
Dec 8, 2014, 7:33:44 AM12/8/14
to joomla-de...@googlegroups.com
LoZo, I strongly advice you to buy and read the "Learning Joomla! 3 Extension Development" book by Tim Plummer (Packt Publishing, 2013).
I first bough it on Amazon (Kindle format) but found it to be quite unreadable in that format. Then I bought the pdf version directly from PAKT and been happy since!

Sergio
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

Matt Thomas

unread,
Dec 8, 2014, 8:03:21 AM12/8/14
to Joomla! General Development

I'd suggest you take a look at https://docs.joomla.org/Plugin/Events, specifically the Content events. It sounds like you want the before or after display title events.

Best,

Matt Thomas
203.632.9322
http://betweenbrain.com/

Sent from mobile. Please pardon any typos or brevity.

LoZo

unread,
Dec 8, 2014, 8:13:25 AM12/8/14
to joomla-de...@googlegroups.com
Thanks to everyone but I think I found a solution which will help me to do the plugin.

 https://docs.joomla.org/Make_changes_to_an_article_automatically_using_a_plugin

Dne ponedeljek, 08. december 2014 11:37:10 UTC+1 je oseba LoZo napisala:

Seth Warburton

unread,
Dec 9, 2014, 7:56:54 AM12/9/14
to joomla-de...@googlegroups.com
If it is the same image for every article then you can could use css in your plugin and add it as a background image to the :before psuedo-element. 

This will require only a single css declaration and semantically might be a better fit anyway, because if it is the same image for every article it may be considered more decorative than informational.

If this is something you will only do on a single site, then you could just add that to the template css directly.

Sergio Manzi

unread,
Dec 9, 2014, 8:27:22 AM12/9/14
to joomla-de...@googlegroups.com
Elegant!
Reply all
Reply to author
Forward
0 new messages