Example: implementing static caching of Dynamic Web pages
Source Dynamic Web page
- < title > Example: Implementing static caching of Dynamic Web pages title >
- < H3 > Example: Implementing static caching of Dynamic Web pages h3 >
- < P >
- < cHTML >
- < for End=0 start = >
- < b > @{int:@{for:getsuffix}+1}- b >
- < Forendforend Forendforend =@{for:getsuffix} >
- < Fontcolorfontcolor Fontcolorfontcolor = Red > @{int:@{for:getsuffix}+1}- font >
- for >
- < BR >
- for >
- cHTML >
- P >
(example file: _samples/file_page.html)
Read the cached static file information
- < file Act=info>web-inf/cache/page_test.html file >
Determine if a static file exists
- < if x= "@{file:exists}"else=0>
- < Pager > page Call >
- < CALLXCALLX CALLXCALLX = true > Cache Call >
- if >
exists on call to cache, does not exist then invokes page
- < Pager > page Call >
- < Pager x=true>cachecall >
Callable Tag Cache , read cache file
- < cHTML onlycallid=cache>
- < file Act= Read method=str name=page>web-inf/cache/page_test.html file >
- cHTML >
Callable Tags Page
- < 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
- < HTML >
- < cHTML >
- < file Act=info> web-inf/cache/page_test.html File >
- < if x="@{file:exists}" else=0 >
- < Pager > page Call >
- < Pager x=true>cachecall >
- if >
- cHTML >
- < cHTML id= page file="@{sys:curpath}file_page.html" save = "web-inf/cache/page_test.html" Onlycall/ >
- < cHTML Onlycall ID = Cache >
- < file Act= Read method= str Name=page> web-inf/cache/page_test.html File >
- cHTML > @{file:page}
- 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 ...