BobLeponge Posted March 8, 2017 Share Posted March 8, 2017 Hello, We just upgraded from WHMCS 5 to 7 and one of our custom pages no longer works. <?php define("CLIENTAREA",true); require("init.php"); $ca = new WHMCS_ClientArea(); $ca->setPageTitle("PAGE TITLE"); $ca->initPage(); $ca->requireLogin(); $ca->setTemplate('TEMPLATENAME'); $ca->output(); ?> We correctly upload the TEMPLATENAME.tpl file to the /templates/six directory and, even with a simple .tpl file : {php} exit("!!!"); {/php} Only the header and footer are displayed on the page. Why? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 8, 2017 Share Posted March 8, 2017 take a look at the developers pages for creating pages and spot the changes in the code there... https://developers.whmcs.com/advanced/creating-pages/ that said, if I try your code above in v7.1.2, using homepage as the template and removing the login option, it works ok. 0 Quote Link to comment Share on other sites More sharing options...
BobLeponge Posted March 8, 2017 Author Share Posted March 8, 2017 Thanks for your input. It turns out that it works if the .tpl file contains only the HTML to output, but it doesn't work with the {php} tags and echo(). Not sure what changed here. - - - Updated - - - "However, as of Smarty 3, support for the {php} block has been removed [...]". https://developers.whmcs.com/themes/php/ 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 8, 2017 Share Posted March 8, 2017 Thanks for your input. It turns out that it works if the .tpl file contains only the HTML to output, but it doesn't work with the {php} tags and echo(). Not sure what changed here. a lot. the option to use {php} got disabled by default with v6. http://docs.whmcs.com/Version_6_Template_Migration_Guide An option was added to WHMCS 6 to enable use of the potentially dangerous {php} tag in custom templates. This option is disabled by default but can be enabled if required in Setup > General Settings > Security. We strongly encourage using hook functions over php code blocks inside of templates for backend interaction. i'd be surprised if the {php} option is still available when WHMCS launch v8 - so in the short term, you can still enable the option; in the long-term, get out of the habit of using it. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 9, 2017 Share Posted March 9, 2017 "However, as of Smarty 3, support for the {php} block has been removed [...]".https://developers.whmcs.com/themes/php/ in the short-term, if you need to enable {php} tags you can do so via the General Settings... http://docs.whmcs.com/Security_Tab#Allow_Smarty_PHP_Tags The use of {php} tags is depreciated in WHMCS v6 and above, but legacy support can be enabled here during a transition period. We recommend keeping this option disabled unless specifically required. For more information refer to Templates and Custom PHP Logic. ... but you should be looking to move them to use other solutions, such as action hooks. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.