Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Conclusion

July 28, 2000

An interesting side-effect is that in the handle_xxx function you can use the parse_it function again to parse externally 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 ($f, 4096)) 
            $buf .= $str;
        fclose ($f);

        return parse_it ($buf);
    }
    return "<!-- include: error opening " . $arglist["file"] . " //-->";
}

?>

Using caching here will probably prove 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

$buf
Building your website with cached dynamic modules


Up to => Home / Authoring / Languages / PHP / Dynamic_Modules




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers