I refute these comments with my code example to see what the template engine is.

Source: Internet
Author: User
Use my code examples to refute these comments and see what the template engine is .. [Since we know that the evaluation is pertinent, we should know where the gap is. we should replace each operation to reduce the system performance to a considerable extent. What are the advantages of such a template engine ??] [There is indeed a gap. I have looked at it. as you have said for more than a year, you have downloaded 5 times in total and made a profit from the operation of 1 cent. I will post a post with him, post some code, and refute such comments with my code example to see what the template engine is ..
[Since we know that the evaluation is pertinent, we should know where the gap is. we should replace each operation to reduce the system performance to a considerable extent. What are the advantages of such a template engine ??]
[There is indeed a gap. I have looked at it. as you have said for more than a year, you have downloaded 5 times in total and made a profit from the operation of 1 cent. This is just to post a post with him, paste some code, and no one downloads it, but it is not profitable. the gap is too big .]


PHP code
  
  Assign ("csdn", "csdner, good afternoon")-> assign ("head", array ("from", "xxx ")) -> assign ("greet", array ("PHP Technology", "Basic Programming", "open resources", "framework")-> assign ("foot ", array ("id" => '1', "foot" => "This is the bottom test 1"), array ("id" => '2 ', "foot" => "This is the bottom test 2"), array ("id" => '3', "foot" => "This is the bottom test 3 "))) -> assign ("bye", "88, good bye"); $ this-> display ("index.html") ;}}?>



HTML code
              Welcome YouYaX            
              
                
   
   
{Csdn}
{Head }---- Posted in [{greet-> 1 }]
{Greet}
{Foot. foot} {Bye} comparison test. let's use PHP in html. double quotation marks should be written on template variables.
1} ";}else {echo" error ";}?>






------ Solution --------------------
You are not using the template engine.
------ Solution --------------------
So what does your template engine do?
PHP code
// -- Normal replacement // single output array value // var_dump ($ this-> array_array); exit; $ return = preg_match_all ('/\ {[^ {] *-> [^ {}] *}/', $ txt, $ single); if ($ return) {foreach ($ single [0] as $ v) {$ x = strlen ($ v); $ y = $ X-2; $ z = substr ($ v, 1, $ y); // title-> 0 $ z1 = preg_split ('/->/', $ z,-1, PREG_SPLIT_NO_EMPTY); $ txt = str_replace ($ v, $ this-> array_array [$ z1 [0] [$ z1 [1], $ txt );}} // replace $ return = preg_match_all ("/<\ s * loop \ s *> \ s *(. + ?) \ S * <\ s * \/loop \ s *>/s ", $ txt, $ match); if ($ return) {try {foreach ($ match [1] as $ lv) {if (eregi ("<\ s * loop \ s *>", $ lv )) {throw new Exception (htmlspecialchars ("
  
   
Labels cannot be nested
   
    
! ")," 304 "); break ;}} catch (Exception $ e) {$ this-> exception ($ e) ;}$ result0 = $ match [0]; //
    
     
{Array}
    Series array
    
     
{Array2}
    $ Result1 = $ match [1]; //{Array}Series array {array2} // var_dump ($ result1); exit; foreach ($ result1 as $ r1) {preg_match_all ("/\{(. *) \}/", $ r1, $ match2); $ result2 = $ match2 [0] [0]; // {array} $ result3 = $ match2 [1] [0]; // array $ result4 = $ this-> array_array [$ result3]; // Obtain the array try {if (! Is_array ($ result4) throw new Exception (htmlspecialchars ("
    
     
Tag parsing error. only one-dimensional arrays are supported! ")," 306 ");/* if (empty ($ result4) throw new Exception (htmlspecialchars ("
     
      
The value of the resolved one-dimensional array is null! ")," 308 "); */} catch (Exception $ e) {$ this-> exception ($ e);} $ result5 = ''; // unset ($ result5); // result5 clears foreach ($ result4 as $ v) {$ result5. = str_replace ("{". $ result3. "}", $ v, $ r1);} foreach ($ result0 as $ r0) {if (ereg ($ result2, $ r0 )) $ txt = str_replace ($ r0, $ result5, $ txt );}}} // -- array replacement // include replacement $ return = preg_match_all ("/<\ s * include \ s + file = \"(. *) \ "\ s *>/", $ txt, $ inc); if ($ return) {$ inc1 = $ inc [0]; //
      
       
Series array $ inc2 = $ inc [1]; // top.html series array foreach ($ inc2 as $ v) {if (file_exists ($ v )) {$ sub = file_get_contents ($ v); foreach ($ inc1 as $ v1) {// case sensitive if (ereg ($ v, $ v1 )) {$ txt = str_replace ($ v1, $ sub, $ txt) ;}} else {exit ("include tag parsing error! ");}}}
      
     
    
   
  

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.