Ecshop new version cannot add PHP code directly in the template file. DWT and. LBI Solutions

Source: Internet
Author: User

Ecshop The new version cannot add PHP code directly in the template file. DWT and. LBI, why?
Because directly in the template to add PHP functions and code, not filtered, easy to create security risks. The program source code security is very important.
But what if a friend wants to add PHP code directly to the template file?
In fact, just need to change a file, namely includes/cls_template.php
Open this file to find function Fetch_str ($source)
Found in this function, approximately 288 lines

        if(Preg_match_all(' ~ (<\? (?:\ w+|=)? | \?>|language\s*=\s*[\ "\ ']?php[\" \ ']?) ~is ',$source,$sp _match))        {            $sp _match[1] =Array_unique($sp _match[1]);  for($curr _sp= 0,$for _max2=Count($sp _match[1]);$curr _sp<$for _max2;$curr _sp++)            {                $source=Str_replace($sp _match[1] [$curr _sp], '%%%SMARTYSP '.$curr _sp.‘ %%%‘,$source); }              for($curr _sp= 0,$for _max2=Count($sp _match[1]);$curr _sp<$for _max2;$curr _sp++)            {                 $source=Str_replace('%%%SMARTYSP '.$curr _sp.‘ %%% ', ' <?php echo \ '.Str_replace("‘", "\‘",$sp _match[1] [$curr _sp]).‘ \ ';?> '. " \ n ",$source); }         }


Remove or annotate this piece of code directly.
Log in to the background update cache, you can then insert the PHP code in the template file to try.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.