Display External Php Script On Products Page Tab


Using CS-Cart 4.8.1, I would like the ability have a tab on the products page display content from an external php script located in the httpdocs root folder. path: domain.com/script.php

It seems the newer versions of CS-Cart no longer support php code in an HTML block with Smarty support. In older versions of CS-Cart I would simply use the {php} tag which allowed PHP code to be embedded directly into the template.

Would this need to be an add-on or is there an more simple workaround to get php code to execute in an HTML block? Even file_get_contents would work if I could simply get the php to execute.

Thanks for the help!

You will need to do this with javascript via an ajax request to the script and then have (or create) a container to put the output in. Note that there are security implications to this so assume that your script is handling that.

Use HTML block with SMARTY support and the following code

{$response = "https://domain.com"|file_get_contents}
{if $response}
    {$response nofilter}