Received: from cr322781-a.ym1.on.wave.home.com (cr322781-a.ym1.on.wave.home.com [24.112.37.89]) by hub.org (8.10.1/8.11.0) with ESMTP id e9HLmPW05306 for ; Tue, 17 Oct 2000 17:48:25 -0400 (EDT) (envelope-from svanegmond@bang.dhs.org) Received: from svanegmond by cr322781-a.ym1.on.wave.home.com with local (Exim 3.16 #1 (Debian)) id 13leav-00024T-00; Tue, 17 Oct 2000 17:48:25 -0400 Date: Tue, 17 Oct 2000 17:48:25 -0400 To: dan_wilson@geocities.com Cc: pgsql-php@postgresql.org Subject: Re: is this list live? Message-ID: <20001017174824.A7939@bang.dhs.org> Reply-To: svanegmond@home.com References: <20001017210903.89208.qmail@web9505.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001017210903.89208.qmail@web9505.mail.yahoo.com>; from killroyboy@yahoo.com on Tue, Oct 17, 2000 at 02:09:03PM -0700 From: Stephen van Egmond X-Archive-Number: 200010/25 X-Sequence-Number: 40 Dan's approach reminds me of something I coded up to imitate a cool feature they have in embperl. It's so simple, I'll append it here. The general idea is that you have a template in your document root: root/_template.php Which for instance can say things like: .....body... include ("topnav.php"); ... ##PART## ... Obviously, you could have topnav .php right in root, but why not in the subdirectories alongside the content: root/foo/topnav.php root/bar/topnav.php The actual content pages: root/foo/content.php root/bar/content.php only need to call one function to bring in the whole templating system. Their topnav will come from the directory that they're in, and they don't need to do anything except provide their exact functionality. Usage: Put this in every file: -- at the top -- at the bottom Create a _template.html somewhere (perhaps the document root) that contains at least the string ##PART## . Call template_include() when you want to pull in a file located somewhere between your script and the document root. = count($root_path); $i--) { $directory = join('/',array_slice($script_path, 0, $i)); $_template_search_path[] = $directory; if (file_exists($directory.'/_template.php')) { $fh = fopen($directory.'/_template.php', 'r'); while (!feof($fh)) { $_template_data .= fread($fh, 65536); } $_template_cut_index = strpos($_template_data,'##PART##'); if ($_template_cut_index == 0) { print "Error: there's no ##PART## in $directory/_template.php"; die; } eval ('?>'.substr($_template_data, 0, $_template_cut_index-2).'"; } function template_footer() { global $_template_data, $_template_cut_index; eval ("?>".substr($_template_data, $_template_cut_index+6)."