Gossamer Forum
Home : Products : Gossamer Links : Discussions :

add/modify and include_form.html

Quote Reply
add/modify and include_form.html
Alex,

If the include_form.html is being used by both add and modify, it would be nice if the add.cgi and modify.cgi passed an identifier to the form, so the form would know which routine it was in.

I did a <%GT::Template::dump%> and there is no identifier tag constant across all add* or modify* forms, or search* for that matter.

For instance, in an add.html you would want to "enter" a new file, but in a modify form you'd want to "edit" it. You wouldn't want to show a "No attachment" statement in add.html, but you might in modify.html, and right now there is no way to figure out which you are in.

Would it be possible to add two global tags so that a template file would know both what script called it (add.cgi, page.cgi, etc) and which template file called it? The template file would be the name passed to Site_HTML::display and would not be an included or nested include file. This way, a template knows who called it, and what template it's in.

Maybe, each template should have a <%TEMPLATE_NAME::add.html%> tag in it. If the tag is missing, it is set to the name of the file. The reason is the upper template knows what include file it's using, but the included files don't know what template they are being called into.

The calling script might be a tad trickier, but it has just as important uses, if a template knows it was called from search.cgi, add.cgi, page.cgi, -- or even search.cgi vs search-ni.cgi.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: add/modify and include_form.html In reply to
Hi,

You could do this by doing:

<%set type='add'%>
<%include include_form.html%>

in the add.html. Then in the include, you can do:

<%if type eq 'add'%> .... <%elsif type eq 'modify%> ...

Cheers,

Alex

--
Gossamer Threads Inc.