Hi, welcome to our forum!
Embedding PHP code within templates is generally not recommended due to security concerns and best practices, which encourage separating logic from presentation. However, if you need to include PHP code for specific functionality, you can enable PHP in templates where required.
To add PHP to a template in CMSMS, you must first ensure that the PHP code option is enabled in your system. Here's how to do it for individual templates:
Navigate to the CMSMS admin panel.
Go to Design > Templates.
Select the template where you want to include PHP.
Insert your PHP code within the Smarty {php}{/php} tags in the template.
Code: Select all
{php}
// Your PHP code here
echo 'Hello, this is PHP code!';
{/php}
Consider creating a User Defined Tag (UDT) that encapsulates your PHP code
1) Create a new UDT with your PHP code.
2) Use the tag {my_udt} in your templates
This method allows you to maintain and update your PHP code in one place and reuse it across multiple templates, enhancing maintainability and security.