RegisterRegister    SearchSearch   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AJAX upload progress bar

File sharing script

File mirror script

Newsletter script
How to add additional <IF> templates?

 
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XFileSharing Pro
View previous topic :: View next topic  
Author Message
qq_bbq



Joined: 05 Jul 2009
Posts: 114

PostPosted: Feb 27, 2010 11:02 am    Post subject: How to add additional <IF> templates? Reply with quote

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.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 22 Mar 2006
Posts: 1126

PostPosted: Mar 02, 2010 6:32 am    Post subject: Reply with quote

If you just added fields - it will not work that way.
TMPL_IF tag coming from HTML::Template module and could work only with variables passed from Perl code.

You'd better use javascript for your needs.
Back to top
View user's profile Send private message Send e-mail
qq_bbq



Joined: 05 Jul 2009
Posts: 114

PostPosted: Mar 02, 2010 9:08 am    Post subject: Reply with quote

Please post an example of how to add additional <IF> tags or as you say, pass the variables from Perl code.

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'
Back to top
View user's profile Send private message
qq_bbq



Joined: 05 Jul 2009
Posts: 114

PostPosted: Mar 02, 2010 9:08 am    Post subject: Reply with quote

Is the codes encrypted or where would I find the HTML::Template that calls the values from database?
Back to top
View user's profile Send private message
qq_bbq



Joined: 05 Jul 2009
Posts: 114

PostPosted: Mar 05, 2010 9:07 am    Post subject: Reply with quote

Support?
Back to top
View user's profile Send private message
mrperl



Joined: 06 Mar 2010
Posts: 65

PostPosted: Mar 06, 2010 2:06 pm    Post subject: Re: How to add additional <IF> templates? Reply with quote

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:
Code:

   my $val = 1;

   $ses->PrintTemplate("whatever.html",
                       'gen_ip'     => $gen_ip,
                       'gen_user'   => $gen_user,
                       'rec_user'   => $rec_user,
                       my_var => $val,
                      );

and in Templates/whatever.html
Code:

<TMPL_IF my_var>
Show text
</IF>

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.


Last edited by mrperl on Mar 08, 2010 10:41 am; edited 1 time in total
Back to top
View user's profile Send private message
qq_bbq



Joined: 05 Jul 2009
Posts: 114

PostPosted: Mar 08, 2010 3:48 am    Post subject: Reply with quote

Thanks for that, I want the $var read from MySQL table, how to do that?
Back to top
View user's profile Send private message
mrperl



Joined: 06 Mar 2010
Posts: 65

PostPosted: Mar 08, 2010 10:43 am    Post subject: Reply with quote

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:
Code:

 my $val = 1;


Often it is easy, but sometimes not so much.
Back to top
View user's profile Send private message
qq_bbq



Joined: 05 Jul 2009
Posts: 114

PostPosted: Mar 11, 2010 9:07 am    Post subject: Reply with quote

sibsoft support can you please elaborate on this?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XFileSharing Pro All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group