Overriding existing Plugin content

Overriding existing Plugin content, a forum discussion on Jojo CMS. Join us for more discussions on Overriding existing Plugin content on our Plugin Support forum.

Back to Forum Index : Back to Plugin Support   RSS
damien damien

24 Sep 2009
Posts: 24

Hi There

Is there any way to replace a Plugin's outputted HTML with some of your own?

For example, I have a custom plugin piggybacking on top of jojo_gallery3
In my global.php file, I detect if my special database field type exists for the current gallery
How can I use global.php to replace the outputted Gallery HTML?
I want to use my own TPL, but using $page->page["pg_body"] only works for normal pages, not generated URLs like the galleries...

Any ideas?


Cheers,
Damien
tom

Developer

tom

25 Sep 2009
Posts: 379

you could use global to generate the custom html (conditional on the page being a gallery page etc) - you can call plugin functions from global to reuse the logic, or just copy and adapt as necesssary, assign the generated html to smarty as its own variable,
then copy the gallery template into your theme and add a check to see whether the custom smarty tag has been assigned and display it if it has.
damien damien

29 Sep 2009
Posts: 24

Yup, using the Smarty IF statement with a newly created Smarty variable did the trick.

just wrapped the original code in jojo_gallery3_square.tpl with an IF for my custom variable

Although this isn't Update-Proof, it works great for now

(Maybe we could add a hook somewhere into the Gallery3 module to allow people to plugin their own Layout Styles)
((Or should we be adding it directly into the gallery3 module?))
tom

Developer

tom

29 Sep 2009
Posts: 379

if you add your modified template to the site theme templates it will override the one in the plugin, so will survive updates (although will miss out on any additions to the default template)

post a link to it when you're done and we'll have a poll as to whether it's cool enough to add to the layout styles :p
Back to Forum Index : Back to Plugin Support   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.