Example: implementing static Caching for Dynamic Web pages _php Tutorial

Source: Internet
Author: User

Example: implementing static caching of Dynamic Web pages


Source Dynamic Web page

 
 
  1. < title > Example: Implementing static caching of Dynamic Web pages title >
  2. < H3 > Example: Implementing static caching of Dynamic Web pages h3 >
  3. < P >
  4. < cHTML >
  5. < for End=0 start = >
  6. < b > @{int:@{for:getsuffix}+1}- b >
  7. < Forendforend Forendforend =@{for:getsuffix} >
  8. < Fontcolorfontcolor Fontcolorfontcolor = Red > @{int:@{for:getsuffix}+1}- font >
  9. for >
  10. < BR >
  11. for >
  12. cHTML >
  13. P >

(example file: _samples/file_page.html)

Read the cached static file information

 
  
  
  1. < file Act=info>web-inf/cache/page_test.html file >

Determine if a static file exists

 
 
  1. < if x= "@{file:exists}"else=0>
  2. < Pager > page Call >
  3. < CALLXCALLX CALLXCALLX = true > Cache Call >
  4. if >

exists on call to cache, does not exist then invokes page

 
  
  
  1. < Pager > page Call >
  2. < Pager x=true>cachecall >

Callable Tag Cache , read cache file

 
 
  1. < cHTML onlycallid=cache>
  2. < file Act= Read method=str name=page>web-inf/cache/page_test.html file >
  3. cHTML >

Callable Tags Page

 
  
  
  1. < cHTML id=pagefile="@{sys:curpath} File_page.html "save=" web-inf/cache/page_test.html " />

Introduce dynamic Web page file @{sys:curpath}file_page.htmland Save as web-inf/cache/page_test.html file

displaying cached content

@{file:page}

Full code

 
 
  1. < HTML >
  2. < cHTML >
  3. < file Act=info> web-inf/cache/page_test.html File >
  4. < if x="@{file:exists}" else=0 >
  5. < Pager > page Call >
  6. < Pager x=true>cachecall >
  7. if >
  8. cHTML >
  9. < cHTML id= page file="@{sys:curpath}file_page.html" save = "web-inf/cache/page_test.html" Onlycall/ >
  10. < cHTML Onlycall ID = Cache >
  11. < file Act= Read method= str Name=page> web-inf/cache/page_test.html File >
  12. cHTML > @{file:page}
  13. HTML >

Effect

(example file: _samples/file_cache.html)

Experience it!

http://www.bkjia.com/PHPjc/964931.html www.bkjia.com true http://www.bkjia.com/PHPjc/964931.html techarticle Example: Implementing Dynamic Web page static cache source Dynamic webpage Title instance: implement static cache of dynamic webpage/title H3 instance: implement static cache of dynamic webpage/H3 p cHTML for E ...

  • 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.