Jump to content

Smarty php depreciation


ralphonz

Recommended Posts

I'm really new to smarty. In fact the only time i've ever used it is when customising my WHMCS template.

 

In the smarty documentation it clearly states:

 

{php} tags are deprecated from Smarty, and should not be used. Put your PHP logic in PHP scripts or plugin functions instead.

 

However, I see loads of people on this forum using {php} tags and recommending their use to get round certain shortcomings in the WHMCS template system.

 

I am currently using the {php} tags to assign extra variables not usually available on certain pages (to combine some of the client area pages). However, what will happen when {php} is finally dropped from smarty? It's very worrying.

Link to comment
Share on other sites

WHMCS it self use {php}

you can create action hook instead of using it

 

Sorry I'm not sure I understand? What do you mean? Could you give me an example?

 

It should be worrying but WHMCS has implemented Smarty version that uses {php}. If they update it to the latest, changelog should mention it for updating all the custom work in themes, by the user.

 

WHMCS dev team will update source code in order to WHMCS work properly. Not other codes :)

 

My concern is that if I write code now using {php} then WHMCS one day moves to use a smarty version with no {php} function then my template will break when I update WHCMS. So, my real question is what should I be doing instead of using {php} in order to future-proof my template?

Link to comment
Share on other sites

  • Always read changelog
  • Always update on a non-live version of WHMCS
  • Be prepared

 

U can not prevent your code for not been updated in future WHMCS updates. This is a script that must been updated for many reasons. Like Smarty, PHP is been updating and removing old tags so everyone must follow the changes.

 

PS: I dont think that WHMCS is going to update Smarty soon....

Link to comment
Share on other sites

    [*]Be prepared

 

Yeah I'm trying to be prepared by not using {php} smarty tags! But what is the alternative way to execute the same code while keeping all files that I change within in my custom template directory?

 

I'd be grateful if anyone could share their knowledge on smarty to explain another way of using php code in WHMCS templates. Then I'd feel prepared :-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated