#native_company# #native_desc#
#native_cta#

Cached Dynamic Modules Page 6

By JP
on July 30, 2000

An interesting side-effect is that in the handle_xxx function you can use the parse_it function
again to parse external retrieved data. Say that you have a <my-include file=..>, that
file can also contain new <my-..> tags if you implement res/include/include.php
as follows:

<?php

 function handle_include ($arglist) {

    if ((
$arglist["file"]) && ($f fopen ($arglist["file"], "r"))) {

        
$buf "";

        while (
$str fgets ($f4096)) 

            
$buf .= $str;

        
fclose ($f);

        return parse_it ($buf);

    }

    return 
"<!-- include: error opening " $arglist["file"] . " //-->";

}

?>



Using caching here will probably provide useful if including from external sites:
<my-include file=”http://remote.server.com/foo.my” cache=3600>
This way, the file is only fetched from the remote server once an hour,
for all the other requests the cached entry is used, which is much faster.
-JP

1
|
2
|
3
|
4
|
5
|
6