CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Calculating variables in HTML::Template

 



terrykhatri531
User

Jul 18, 2014, 1:37 PM

Post #1 of 3 (1671 views)
Calculating variables in HTML::Template Can't Post

Hi Chris,

Is it possible to calculate or to be exact in my case, sum up a variable value in TMPL_LOOP and display it the way I have shown in the attached picture.



Here is the TMPL_LOOP code


Code
 
<!-- TMPL_LOOP NAME=ROWS -->
<tr>
<td><!-- TMPL_VAR NAME=OrderID --></td>
<td><!-- TMPL_VAR NAME=ProductID --></td>
<td><!-- TMPL_VAR NAME=ProductName --></td>
<td align="right"><!-- TMPL_VAR NAME=UnitPrice --></td>
<td align="right"><!-- TMPL_VAR NAME=Quantity --></td>
<td align="right"><!-- TMPL_VAR NAME=Discount --></td>
<td align="right"><!-- TMPL_VAR NAME=Total --></td>
<td>
<ul class="tsc_pagination tsc_paginationA tsc_paginationA09">
<li><a href="orddetails.pl?go=Details&prodid=<!-- TMPL_VAR NAME=ProductID -->&orderid=<!-- TMPL_VAR NAME=OrderID -->">Edit</a></li>
</ul>
</td>
<td>
<ul class="tsc_pagination tsc_paginationA tsc_paginationA09">
<li><a href="delorddet.pl?go=Details&prodid=<!-- TMPL_VAR NAME=ProductID -->&orderid=<!-- TMPL_VAR NAME=OrderID -->">Delete</a></li>
</ul>
</td>
</tr>
<!-- /TMPL_LOOP -->


I want to sum up the Total variable shown in blue coloring above and display it at the bottom the way I have shown in the picture.

If not any ideas how I can achieve it.

Many thanks !

Terry
Attachments: OrderTotal.png (16.1 KB)


FishMonger
Veteran / Moderator

Jul 18, 2014, 2:56 PM

Post #2 of 3 (1666 views)
Re: [terrykhatri531] Calculating variables in HTML::Template [In reply to] Can't Post

That calculation would be done in the perl script, not the template file.


terrykhatri531
User

Jul 19, 2014, 12:42 AM

Post #3 of 3 (1641 views)
Re: [FishMonger] Calculating variables in HTML::Template [In reply to] Can't Post

Thanks Ron for you guidance I have done it in the script.

Rgds.

Terry

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives