Robert,
Thanks for the suggestions, but...
a) I do want to do this and I do think I can.
The big problem is not the templating, php is pretty damn good at that already.
It's handling the header/footer html which appears on every page.
On the one hand we only want one master copy so there's only one
thing to fix if it's wrong, on the other hand we want the designer's
tools (Dreamweaver in this case), to show the page they're designing
with those headers/footers included while they work locally on their server.
I still think this can be done with Dreamweaver's library items. They seem to be
held as separate files with little snippets of html, just as we'd
hold them on the server, so with a little discipline or fancy ftp
synchronisation we can make sure they are up to date. The problem seems
to be to make sure they don't show up in the saved Dreamweaver html file as well
as it's saved library item.
b) I looked at FastTemplate and I'm pretty sure I don't want
to use it.
The main difference from a pure php approache seems to be that instead
of embedding real live php in the template (and then hiding it
from the designers), instead you embed your own invented tags that
you then separately translate into the results of some php via tpl
methods.
The disadvantage is that you seem to have to create lots
of itty bitty little .tpl files for every part of the page which
is either repeated or conditional and bunches of other structure
which doesn't do anything to help productivity or maintainability.
I would much rather include the looping/conditional php in the template itself,
safely tucked away in a php tag e.g. (using the FastTemplate example)
************ mytemplate.html ************
<HTML>
<BODY>
<TABLE>
<TITLE>HALLO</TITLE>
<?php
// Start looping through files
while($filename = readdir($handle))
{
$filesize = filesize($filename);
?>
<TR>
<TD><?= $filename?></TD>
<TD><?= $filesize?></TD>
</TR>
<?php
// End of loop through files
}
?>
</TABLE>
</BODY>
</HEAD>
etc.
************ myphpprogram ****************
Then the master php just has :
//standard stuff....
$handle = opendir(...);
//error checking
include(mytemplate.html)
close($handle);
The template can then include any number of loops and conditionals all in the
same full previewable/editable html page. It's not going to be a perfect
copy of the final page i.e. each repeating section only appears once and
conditionals always appear, but that's impossible anyway until you actually
execute the page on the server.
But compared to the FastTemplate approach this is less code, less files,
less things to go wrong, same amount of coordination with the designers,
more educative for the designers (some might even get curious and look at
the php!), and it does mean the designers get a whole page to work on/preview.
I guess FastTemplate may improve reusability of the html formats
by splitting the html into separate chunks. That might matter for system
admin/software engineering type applications where you might list the same
kind of data in the same format more than once. But in my world of database
applications that almost never happens! You just don't show the same data
in the same format in more than one place or on more than one page. If you
do, it's usually an indicator that you've failed to structure your web pages
properly i.e. you should be reusing the page, not just bits of it.
Robert V. Zwink wrote:
>
> I dont' think you can do this, or that you would want to do this. Library
> items in Dreamweaver (as I understand it) are snippets of HTML that
> Dreamweaver marks as updatable accross the entire site. They are not
> "included" into the HTML, dreamweaver keeps track of where they need to go,
> then updates the entire HTML page. The html page does not "include" the
> library item, Dreamweaver handles updating the pages the library item
> applies.
>
> If you want to make your life easier familiarize the php developer(s) with
> FastTemplate. Check out:
> http://www.phpbuilder.com/columns/sascha19990316.php3
> for more information.
>
> I hope this helps.
>
> Robert Zwink
> http://www.zwink.net/daid.php
>
> -----Original Message-----
> From: George Whiffen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 05, 2001 10:40 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] php includes === Dreamweaver library items
>
> Hi,
>
> Has anyone experience of using Dreamweaver library item files (.lbi)s as
> php includes?
>
> We've got a standard header and footer to go across all pages on a site with
> the navigation etc. We want both the designers, (using Dreamweaver), and
> the
> php programmers to have access to these includes, so that the Dreamweavers
> can
> view the pages automatically with the headers/footers shown, and the
> programmers
> can still maintain the pages and includes without Dreamweaver.
>
> I don't fully understand how Dreamweaver library files work, so I guess my
> questions are :
>
> a) Can you use a url for a Dreamweaver libary file rather than using a local
> file
> so we can all share a single master copy?
>
> b) Can we tell Dreamweaver to include the libary file's html when previewing
> but
> exclude it when saving, so we don't end up with the library code twice, once
> embedded by
> Dreamweaver on the save and once included by php at execution? (I insist on
> the live page
> using the master version as I'm not prepared to trust the Dreamweavers to
> rebuild the
> pages when the library files change!)
>
> I guess I've got workarounds if the answers to these prove negative.
>
> For a) I can bully the Dreamweavers into keeping the master/local copies in
> step,
> and for b) I guess I can get the php to strip out the Dreamweaver copy of
> the
> library code at execution with a little bit of spoofing of Dreamweaver about
> where
> php starts and ends i.e. something like....
>
> <?php turn_into_an_include(<<<ENDLIBRARY
> ?>
>
> dreamweaver library item tags and text
>
> <!--
> ENDLIBRARY
> );
> //--><?php
> ?>
>
> where turn_into_an_include is a function which just finds the library file
> name
> in the passed string of library code and includes it from the appropriate
> server
> directory.
>
> Of course, this is a bit clumsy, any better suggestions?
>
> Many thanks,
>
> George
>
> ?>
>
> c) In the worst case I guess, we can live with local and master copies of
> library
> files and remind the Dreamweavers to always update the master when they make
> changes get the php
> code
> to strip out the embedded library file html at execution time and replace it
> with
> an appropriate include statement of the server copy. I've got an idea how
> to do this by as anyone else tried this?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]