•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 373,912 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,780 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1334 | Replies: 0
![]() |
•
•
Join Date: Feb 2004
Posts: 196
Reputation:
Rep Power: 0
Solved Threads: 0
http://www.justatheory.com/bricolage/1.9.0.html
And finally—yes, you heard right—Bricolage now supports PHP 5 templating in addition to the existing Perl-based templating architectures (Mason, Template Toolkit, and HTML::Template). So how did we add PHP 5 templating to a mod_perl application? Easy: we hired George Schlossnagle of Omni TI to write PHP::Interpreter, an embedded PHP 5 interpreter. Now anyone can natively execute PHP 5 code from a Perl application. Not only that, but the PHP 5 code can reach back into the Perl interpreter to use Perl modules and objects! Here’s an example that I like to show off to the PHP crowd:
[PHP]<?php
$perl = Perl::getInstance();
$perl->eval("use DBI");
$perl->eval("use DateTime");
$dbh = $perl->call("DBI::connect", "DBI", "dbi
QLite:dbname=dbfile");
$dbh->do("CREATE TABLE foo (bar TEXT, time DATETIME)");
$now = $perl->call("DateTime::now", "DateTime");
$ins = $dbh->prepare("INSERT INTO foo VALUES (?, ?)");
$ins->execute("This is a test", $now);
$sel = $dbh->prepare("SELECT bar, time FROM foo");
$sel->execute();
$a = array("foo", "bar");
foreach ($sel->fetch() as $val) {
echo "$val\n";
}
$sel->finish();
$dbh->do("DROP TABLE foo");
$dbh->disconnect();
?> [/PHP]
And finally—yes, you heard right—Bricolage now supports PHP 5 templating in addition to the existing Perl-based templating architectures (Mason, Template Toolkit, and HTML::Template). So how did we add PHP 5 templating to a mod_perl application? Easy: we hired George Schlossnagle of Omni TI to write PHP::Interpreter, an embedded PHP 5 interpreter. Now anyone can natively execute PHP 5 code from a Perl application. Not only that, but the PHP 5 code can reach back into the Perl interpreter to use Perl modules and objects! Here’s an example that I like to show off to the PHP crowd:
[PHP]<?php
$perl = Perl::getInstance();
$perl->eval("use DBI");
$perl->eval("use DateTime");
$dbh = $perl->call("DBI::connect", "DBI", "dbi
QLite:dbname=dbfile");$dbh->do("CREATE TABLE foo (bar TEXT, time DATETIME)");
$now = $perl->call("DateTime::now", "DateTime");
$ins = $dbh->prepare("INSERT INTO foo VALUES (?, ?)");
$ins->execute("This is a test", $now);
$sel = $dbh->prepare("SELECT bar, time FROM foo");
$sel->execute();
$a = array("foo", "bar");
foreach ($sel->fetch() as $val) {
echo "$val\n";
}
$sel->finish();
$dbh->do("DROP TABLE foo");
$dbh->disconnect();
?> [/PHP]
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- How to install a Debian LAMP Server (PHP)
- Gentoo vs Ubuntu (Getting Started and Choosing a Distro)
- how to hard recover pc (Techies' Lounge)
- Text file formatting by perl (Perl)
- [JOB] Software Engineer - C++ (Based in Singapore) (Software Development Job Offers)
- Web Design & Development Company Hiring (Web Development Job Offers)
- Beware of Mod & Premod Fraud (Geeks' Lounge)
Other Threads in the PHP Forum
- Previous Thread: PHP for emailed forms
- Next Thread: XLS with PHP


Linear Mode