Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Plugin Modifies existing templates

Quote Reply
Plugin Modifies existing templates
Hi

I'm writing a plugin for maps with links

On install, I copy three new templates in the default directory, the user has to modify his own templates to include them.

Is there a way to modify them on install ?

EXAMPLE : replace the tag <%include include_form.html%>


WITH

<%include include_form.html%>

<%-- Displays the map to add a link's localisation --%>
<%set U_action=add%>
<%include include_add_map_form.html%>



Mitia
Quote Reply
Re: [mnotaras] Plugin Modifies existing templates In reply to
How about;

1) Grab the templates
2) Search through it with a =~ s/// regex, and replace the existing tag with your new one.
3) Write it back to the template folder...

Hope that helps :p

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Plugin Modifies existing templates In reply to
That's exactly what I try to do.

Would it be better to use the build instructions or the GT::SQL::File instructions?

Mitia
Quote Reply
Re: [mnotaras] Plugin Modifies existing templates In reply to
I personally would just leave it up to the user to insert the tags at the place they want, because many people have completely changed the templates (including renaming include_form.html to something else). So you might create a mess in someboy's templates.

Also as a plugin user, I wouldn't want to install a plugin that changes my templates. I have nothing against the plugin adding templates, but changing is a different story.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Plugin Modifies existing templates In reply to
Thanks Yogi,

That was one of my doubts.

Also, it's easier.

Mitia
Quote Reply
Re: [mnotaras] Plugin Modifies existing templates In reply to
Would you like to test the beta ?

Mitia
Quote Reply
Re: [mnotaras] Plugin Modifies existing templates In reply to
Yes, send it over.

Ivan
-----
Iyengar Yoga Resources / GT Plugins