phptemplate-enginex-cart

How can i disable X-cart 5 Flexy template engine and use PHP?


Flexy is lack of documentation and maybe because of that I really don't like it at all. I want to use regular PHP in my module, is it possibly? The best solution would be if I could use PHP just for my module, and do not apply it site-wide.
Thank you.


Solution

  • You can defintely do it, though it is not recommended, by overriding display() method in each of your View classes. The basic implementation is described in \XLite\View\AView class. You can override it in your View class to print in buffer the output of your custom php script like this:

    public function display($template = null)
    {
        include 'custom_php_template.php';
    }
    

    While having 'custom_php_template.php' with similar contents:

    <?php
    echo 'Hello world';
    

    Please note that this is just the simple example and the real logic can be a lot more complex. Also, by using this approach you may need to create or adapt existing caching solution and other things by yourself.