For example, in table "Files" I added a field with the name of "new_field" and the type of field is ENUM with values 'AB','BC','CD'
In download0.html template, I want to add <IF> templates like this:
<TMPL_IF AB>
Show text
</IF>
<TMPL_IF BC>
Show text
</IF>
<TMPL_IF CD>
Show text
</IF>
I tried to look in index.cgi and other files for example but can't find anything relevant.
XFileSharing Pro - How to add additional <IF> templates?
Re: How to add additional <IF> templates?
Hi qq.
Just passing variables to an existing template referred to in index.cgi
is easy.
Make a backup of the original .cgi and template first. Then ...
Here's an example of adding my_var parameter in index.cgi:
and in Templates/whatever.html
You will have generate the data for $val first, whether that comes
from a MySQL table or is calculated. And you will have to modify the
relevant template to expect that parameter.
Sometimes that is obvious how to do, and sometimes not so much.
Enjoy, mrperl.
Just passing variables to an existing template referred to in index.cgi
is easy.
Make a backup of the original .cgi and template first. Then ...
Here's an example of adding my_var parameter in index.cgi:
Code: Select all
my $val = 1;
$ses->PrintTemplate("whatever.html",
'gen_ip' => $gen_ip,
'gen_user' => $gen_user,
'rec_user' => $rec_user,
my_var => $val,
);
Code: Select all
<TMPL_IF my_var>
Show text
</IF>
from a MySQL table or is calculated. And you will have to modify the
relevant template to expect that parameter.
Sometimes that is obvious how to do, and sometimes not so much.
Enjoy, mrperl.
Last edited by mrperl on Mar 08, 2010 10:41 am, edited 1 time in total.
For database values, read index.cgi, find some database code that is similar
to what you want to do, and either extend it or cut-and-paste and replace
this line with your logic in the above example:
Often it is easy, but sometimes not so much.
to what you want to do, and either extend it or cut-and-paste and replace
this line with your logic in the above example:
Code: Select all
my $val = 1;