| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Using a Smarty tag in PHP code | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Using a Smarty tag in PHP code
Hey all,
I'm trying to implement a rating system I found that uses PHP to display the "stars" image. Here is the code I want to put in my main/product.tpl below the Buy Now and Wishlist buttons: PHP Code:
I want to use the productid because the ratings system uses an SQL database to keep track of everything and each item needs a unique identifier. Thanks in advance for any help. |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Using a Smarty tag in PHP code
I think it's more complicated than that. You have an object reference there "$rr". So that object has to be defined somewhere in the code you cut from. Then after that is resolved, there are other things you may need to do.
__________________
Richard Williams Rogue Wave Limited Initial Inventory Imports Daily Inventory Updates Daily Inventory Reports Drop Ship Support Order Export to Shipper/Supplier Shopping Feeds That Work Programming for X-Cart richard@roguewavelimited.com http://www.roguewavelimited.com |
|||||||||
#3
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
Using PHP in smarty can be done like this:
Code:
However using PHP within smarty is not recommended as it decreases performance and caching ability is reduced. You should instead create its own php file and then assign into smarty. Smarty code cant be used in php. |
|||||||
#4
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
I'm having a similar problem.
Shamum I've used the code you gave but I'm having trouble. I need to push details from Smarty tags through a PHP script when a user clicks a submit button. The way I have it at the moment is: Code:
So I want the address to show up for this field, however the result I get is: Code:
Where am I going wrong? Any help is much appreciated
__________________
X-Cart Gold 4.5.4 |
|||||||
#5
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
OK, so is there a way to have smarty generate a variable equal to the productid which can then be read by the php script?
Code:
In the first set of single-quotes, I want the productid (assigned by SMARTY as a variable?), the second single-quote number is how many stars show up. Or, is it possible to have the php script in this case grab the productid from the X-Cart database? |
|||||||
#6
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
Try...
Code:
Code:
__________________
xcartmods.co.uk |
|||||||
|
#7
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
Quote:
Thanks for the tip but I'm having issues getting to work. I've followed all instruction to a T and every time I put the code in the template to get the star rating to show up, I get these errors all over the page: Code:
It seems pretty obvious it's some kind of conflict with CDSEOPro, but I have no idea where to start looking to fix it. |
|||||||
#8
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
Bump. Any have any idea about this new problem?
|
|||||||
#9
|
|||||||
|
|||||||
Re: Using a Smarty tag in PHP code
Most likely the code you are calling closes the DB connection that is used by X-Cart and/or CDSEO.
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
|
|||
X-Cart forums © 2001-2020
|