Jump to content

[SOLVED] how to use Detector browser library php


Recommended Posts

Hello, I am not very expert in php and smarty, and I have not found a problem solution. 

I'm trying to use the file detector.php serves to detect browser, canvas .... 


It is best not to use {php} {/ php} within smarty. I am calling the file from productController.php with a Includer, but does not detect any variable. 

Alguine know how I can use detector.php? I'm going crazy. 

Thank you. 

regards

Link to comment
Share on other sites

ok, and how you're trying to use functions of this detector ?

I,m trying use functions in my product.tpl. Like {if $ua->canvas == "1"} {include other file.tpl}

I think If the detector.php is include in the productclass.php i Can take the var directly, may be i need to pass the var from detector.php to smarty tpl too?

Link to comment
Share on other sites

but if you include it as a php library, then you can run it in the other classes, and attach it to object variable $this->ua

then you can attach it to smarty array, like other variables.

OK! working! 

 

//Canvas detect
   require_once('js/Detector/Detector.php');
   $this->context->smarty->assign('ua',$ua);
 
thank's
Link to comment
Share on other sites

×
×
  • Create New...