Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 16 matches
Smarty Forum Index
Author Message
  Topic: rounding math equation result
rshandel

Replies: 1
Views: 4245

PostForum: General   Posted: Thu Sep 02, 2010 4:56 pm   Subject: rounding math equation result
Never mind, had a brain freeze - here's the solution:

{math equation="(y-x) / y) * 100" x=$product.price y=$product.list format="%.2f"}
  Topic: rounding math equation result
rshandel

Replies: 1
Views: 4245

PostForum: General   Posted: Thu Sep 02, 2010 4:30 pm   Subject: rounding math equation result
I created a math equation:

{math equation="(y-x) / y) * 100" x=$product.price y=$product.list}
How do round off to 2 significant digits?
I know there's a string_format:"%.2f", ...
  Topic: if statement with blank field
rshandel

Replies: 2
Views: 16885

PostForum: Add-ons   Posted: Thu Sep 02, 2010 3:40 pm   Subject: if statement with blank field
Thank, Chris.

Worked like a champ!
  Topic: if statement with blank field
rshandel

Replies: 2
Views: 16885

PostForum: Add-ons   Posted: Wed Sep 01, 2010 9:39 pm   Subject: if statement with blank field
I have field in a mysql database and I want to check to see if its blank and having trouble finding the value if its blank.

i used

{if $myfield ne ""} or {if $myfield ne " " ...
  Topic: value left of decimal point
rshandel

Replies: 5
Views: 8324

PostForum: General   Posted: Tue Jun 02, 2009 8:52 pm   Subject: value left of decimal point
great, thanks everyone.
  Topic: value left of decimal point
rshandel

Replies: 5
Views: 8324

PostForum: General   Posted: Tue Jun 02, 2009 1:49 pm   Subject: value left of decimal point
Thanks. I'm new to php as well. How would I do that?
  Topic: value left of decimal point
rshandel

Replies: 5
Views: 8324

PostForum: General   Posted: Tue Jun 02, 2009 12:49 am   Subject: value left of decimal point
I trying to capture only the value left of the decimal point.

I tried using {assign var="yyy1" value=$yyy|string_format:"%.0f"}, but it ends up rounding the number;
if I have ...
  Topic: creating a smarty array from SQL
rshandel

Replies: 4
Views: 7799

PostForum: General   Posted: Mon May 18, 2009 11:49 am   Subject: creating a smarty array from SQL
I found the problem.

Silly oversite - X-cart has an init.php which creates aliases for each table.....
  Topic: creating a smarty array from SQL
rshandel

Replies: 4
Views: 7799

PostForum: General   Posted: Mon May 18, 2009 2:36 am   Subject: creating a smarty array from SQL
a little more info:

I'm using X-cart which has macro commands to connect to the database:

function func_query($query) {
$result = false;

if ($p_result = db_query($quer ...
  Topic: creating a smarty array from SQL
rshandel

Replies: 4
Views: 7799

PostForum: General   Posted: Sat May 16, 2009 8:32 pm   Subject: creating a smarty array from SQL
I'm calling this within a php program that already is calling other sql tables:

example from file:

$fields[] = "$sql_tbl[products].*";
$from_tbls[] = "pricing";
$left_jo ...
  Topic: creating a smarty array from SQL
rshandel

Replies: 4
Views: 7799

PostForum: General   Posted: Sat May 16, 2009 1:22 am   Subject: creating a smarty array from SQL
Hi,

a newbie to SQL and php, I trying to create a smarty array by pulling data from a SQL database.

I have a table in SQL I created called breed. It has 4 fields, the first field is "breed ...
  Topic: parsing smarty tags with perl
rshandel

Replies: 0
Views: 2000

PostForum: General   Posted: Mon Apr 13, 2009 10:50 pm   Subject: parsing smarty tags with perl
I'm migrating an existing site to X-Cart and the site has several functions written in Perl. Is possible to parse smarty tags within a perl script?

Thanks
  Topic: passing variable from one template to another
rshandel

Replies: 6
Views: 12086

PostForum: General   Posted: Sun Mar 29, 2009 10:22 pm   Subject: passing variable from one template to another
Thanks again. it works great.
  Topic: passing variable from one template to another
rshandel

Replies: 6
Views: 12086

PostForum: General   Posted: Sun Mar 29, 2009 6:58 pm   Subject: passing variable from one template to another
Thanks Monte! Worked like a champ. Why is it a "hack" ? Will it cause any issues in certain situations?

Thanks again
  Topic: passing variable from one template to another
rshandel

Replies: 6
Views: 12086

PostForum: General   Posted: Sun Mar 29, 2009 5:59 pm   Subject: passing variable from one template to another
Thanks for your quick reply. Unfortunately, I still don't quite understand..

if I assign a variable in the parent template,

{assign var="newsubtotal1" value="0.00"}

and a ...
 
Page 1 of 2 Goto page 1, 2  Next
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP