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


GUFE Walkthrough: Part 5

November 8, 1999

Speaking of &createPage ...

sub createPage {
#insert the table into the template page
#the HTML template page must contain the comment 
#<!--FRONTEND--> where you wish GUFE's output to appear
my ($tableHTML)=@_;
#full filesystem path to template HTML page
my $templatePage="gufe.html";
my $finalPage="";
open (INFILE,"$templatePage");
my @template=<INFILE>;
close (INFILE);

$finalPage=join('',@template);
$finalPage=~s/<!--FRONTEND-->/$tableHTML/;
return $finalPage
} #end createPage

Unlike the varied responsibilities of &resultTable, the above subroutine has one straightforward goal: insert the HTML from &resultTable into the HTML template page. We open up the template file, specified in $templatePage, join the file into one long line, and search-and-replace the known comment tag with the entire HTML chunk that GUFE has generated. This subroutine returns its result -- the entire HTML page -- to the calling statement, which was print(), causing it to be sent to the browser. Sweet peas.

Conclusion

We've spent a lot of time this month looking at segments of code and narrating segments of code. But the real core of this article is the code itself. If you want to implement, modify, or better yet, understand GUFE's application to your own web-based database you should spend time reading, tinkering, reading, and tinkering some more with the full unmodified GUFE script.

In the next installment of this Perl You Need to Know mini-series, Dabbling in Live Databases, we'll extend GUFE further -- and our work with databases -- to inserting new data into an existing database. Can't you feel the tingle?


Resources

GUFE Walkthrough: Part 4
The Perl You Need to Know


Up to => Home / Authoring / Languages / Perl / PerlfortheWeb




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