uzziell Posted July 16, 2015 Share Posted July 16, 2015 i want to ask about this code : $id_image = Product::getCover('2'); if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; } How to put this code on .tpl and i want to echo $image_url please help me thank Link to comment Share on other sites More sharing options...
vekia Posted July 16, 2015 Share Posted July 16, 2015 it's not possible to put php code to the .tpl files in this case create static function in frontController public static function MyFunction($id){ $id_image = Product::getCover($id); if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; return $image_url; } then you can call this in your .tpl files: {FrontController:MyFunction(2)} 1 Link to comment Share on other sites More sharing options...
uzziell Posted July 16, 2015 Author Share Posted July 16, 2015 ok thank you, its work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now