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


Building your website with cached dynamic modules

July 28, 2000

In today's web-world the emphasis is on load speed and easy maintenance. Learn how to construct a website on the fly using dynamic modules which can be cached for improved performance.

JP

In this article I will show how to use a modular system to create a website that is constructed on the fly using dynamic modules, which for performance sake can be cached if you want. Each module is a php script on its own, returning html data to be included in the final html page.

Overview

  • php scripted modules that implement functionality (e.g. a style definition, menu or discussion board)
  • a parser that can construct the html page by reading input files, determining which modules to call and then combine output of the modules
  • files with specific extension (say .my) that specify html + calling tags for each module

Walkthrough

To demonstrate how it works, let's see a file called hello.my:

<title>Hello world</title>
<my-style name=test>
hello world

If a request is being made for index.my, the webserver redirects this request to the php parser, which just scans for <my- .. > tags. It finds the 'style' tag, and looks for the module style.php in its module directory.

The file style.php is included and the function handle_style ($arglist) is called, where $arglist is an associative array of all specified parameters to the tag (here: <?php $arglist[name] = "test"; ?> ).

The handle_style function must return a string containing html. How the module determines the html doesn't concern the system. Say, the handle_style module returns <font face=Arial size=2 color=yellow> and the parser includes this in the final html.

Contents:

The Final HTML
Security
The parse_it function
$buf
Conclusion

Building your website with cached dynamic modules
The Final HTML


Up to => Home / Authoring / Languages / PHP




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