Smarty Backwards Compatibility On Cs Cart 4

hi, im new to cs cart and its usage of the smarty templating engine. i started on a cs cart 3 version and had no issues regarding usage of smarty tags like the {php} tag and so on. but then i upgraded my cs cart version to 4.03 and php smarty tag is not being recognized by smarty as a valid smarty tag. i found out that cs cart 4 is using the new version of smarty which is smarty 3+ and some tags like the php tag is already deprecated. But to make it work again they said in their documentation that instead of using ‘new Smarty()’ i should use ‘new SmartyBC()’. The problem is i have no idea where to change that inside cs cart. So the question now is:


  1. How can i apply the smarty backwards compatibiltiy class(SmartyBC.class.php) to the new cs cart 4?what are the files do i have to change?


  2. the smarty unescape modifier is not working for me in cs cart 4, does this have something to do as well on the backwards compatibility?



    i am fully aware on smarty’s advice not to use the php tags on the view area but in my case i really need to use it because the usage of smarty php tag on my templates are really a lot in cs cart 3 and migrating some of the custom templates without the support of smarty php tags in cs cart 4 is a really headache.



    thank you for taking the time to view this issue. any help would be much appreciated.

Bad idea to use php tags in smarty. Better to use “variable modifiers” which can be php functions. I.e.

{"goofy "|str_replace:'':"this is a goofy string"}

will result in "this is a string"



Invoking PHP code from the template is going backward in the architecture. I.e. you're at the presentation level and you're trying to do things at the business logic level.

[quote name='tbirnseth' timestamp='1389244081' post='174770']

Bad idea to use php tags in smarty. Better to use “variable modifiers” which can be php functions. I.e.

{"goofy "|str_replace:'':"this is a goofy string"}

will result in "this is a string"



Invoking PHP code from the template is going backward in the architecture. I.e. you're at the presentation level and you're trying to do things at the business logic level.

[/quote]



Hi tony and thank you for the advice, i'll take note of that. However in my case right now i really need to make the php code work inside the view. What i'm doing right now since i really have no idea on how to activate the backwards compatibility class is that i'm currently creating a smarty plugin that will handle those php codes. Its the only temporary solution i can come up with and i think it will also cut the time because i have a deadline for this. I hope you can point me out on the right direction on where i should change the usage of smarty class to a smarty backwards compatibility class.



By the way, the cs cart development guide series that you created really helped me a lot. thank you for that wonderful guide. i really appreciate your contributions to this community.