Re: [PHP] Templates, PHP Frameworks, and DB Abstraction?
On Fri, 30 Jun 2006, Jay Paulson wrote: I'd like to get some feedback on what the list thinks is a good template engine other than smarty. PEARs HTML_Template_IT... or mix it with other HTML_Template* I'd also like to do some quick prototyping using a PHP framework does anyone have any recommendations for one that is easy to pick up and run with? The only important one I know of is Horde (http://www.horde.org). Finally, does anyone have any suggestions for a good PHP database abstraction library? For PHP 5 I've heard wonderfull things about PDO, but the documentation sucks. I personally am working with PEAR::DB which has been merged with MDB to make MDB2 (this would be a good start point). -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Templates, PHP Frameworks, and DB Abstraction?
On Fri, 30 Jun 2006, KermodeBear wrote: http://pear.php.net/package/DB/ This one has no more development, besides bug fixes. It was merged to create the one below. http://pear.php.net/package/MDB2/ -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates, PHP Frameworks, and DB Abstraction?
I'd like to get some feedback on what the list thinks is a good template engine other than smarty. I'd also like to do some quick prototyping using a PHP framework does anyone have any recommendations for one that is easy to pick up and run with? Finally, does anyone have any suggestions for a good PHP database abstraction library? Thanks for any help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Templates, PHP Frameworks, and DB Abstraction?
Finally, does anyone have any suggestions for a good PHP database abstraction library? PHP5 has PDO for database abstraction; check the manual for information on that one. If you're stuck with PHP4 then PEAR has several offerings: http://pear.php.net/package/DB/ http://pear.php.net/package/MDB2/ I've used PEAR DB and never had problems with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates and partial rendering?
Hello, I'm trying to find a graceful solution for a problem I ran into while trying to set up a templating system. The problem is as such: Every traditional templating solution implies that the template is assembled in a string with all the required data before being sent to the browser. This for me is a Bad Thing (tm), because some of my data is pulled off an XML webservice, which sometimes isn't too quick about answering, and having the user stare at a blank page during that time is just not viable. (Calls to the webservice are obviously cached to as much of an extent as possible, so that's not the problem). So, what I need is a way to be able to render chunks of the page as they come in, as opposed to all at the same time, but still retain the ability to reuse the same HTML in multiple pages. As far as I've seen so far, the only way I can do this is to make functions with static HTML and calling them from each page as I need them. But this isn't very mantainable, I'd much rather use a template system that I can easily alter, much like in a traditional template system. As far as I know, and please correct me if I'm wrong, none of the OOB template systems out there support this kind of behavior. Does anyone have any ideas about how one might implement it (in PHP4, preferably)? My best thought right now involves passing lists of function callbacks into a template class, and having it run them as it needs them, but this seems to be a somewhat messy approach. Any insight is appreciated. Best, - Alex Sunstorm -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP templates
On Mon, 16 Aug 2004 09:31:04 +0300, Octavian Rasnita [EMAIL PROTECTED] wrote: Hi, I took a look to Smarty and Savant templating systems, and I like a few things from both of them. However, none of them are satisfactory. I don't like Smarty because it needs another language and I find Savant more easy to use. You could say that Smarty is another language, but it is basically PHP wrapped in a new syntax. It's pretty simple to learn and has great documentation. I've also found it quite easy to use and flexible. I would like to have a templating system that: 1. Separates: - the programming part (the main programs and the modules) - the structure and main design of the site (the templates) This is a completely developer(you)-defined thing. You can quite easily *not* seperate the Model, View, and Controller parts of your website, even using a template system like Smarty. The impetus for seperating these things comes from you, developer. - The content of the site, this meaning the body text, the title, keywords, and all other variables. Again, you can choose how to do such a thing with your templates by not supplying any ststic text, but sending it in variables. - Other files that can be included, like Javascript, .css, images, files that can be downloaded, etc. These just sit on your webserver and are linked to in your templates. The template language would very rarely have anything to do with this. 2. The templates should handle more languages, and all the content parts should be able to appear in every language supported. Again, this is a question of your design. You can choose to make all text be variables and pull that text from...wherever you want it. Easiest way would be to use a system like: http://pear.php.net/package/Translation or http://pear.php.net/package/Translation2 3. The program should be able to create a cache but not one containing PHP, but one that is just simple html that can be loaded from a cached file and presenting to the client. (I don't know how to decide yet when to re-create the cached file) Smarty can do this. It caches both compiled Smarty templates (as PHP files) and static HTML output of those templates. You can turn off any of these features. You can make it recompile everything when the original template is changed. Etc etc etc. If someone uses this templating system, someone can modify the design by modifying the templates and this change will be reflected in every language. If a translator add a new language or modifies a certain translation, the design won't be affected. Modify template, site changes. If you want multiple languages to use one template, again, that's your design decision. The programmer could add a new program for a new page that does something new, or new modules, etc. I couldn't find such a thing yet and I think I will have to create it. Sounds like you're looking for a whole Content Management System (CMS). Try looking into those if you don't want to have to build this stuff together. I like TYPO3 personally. Teddy - Original Message - From: Justin French [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, August 16, 2004 4:38 AM Subject: Re: [PHP] PHP templates On 15/08/2004, at 7:02 AM, Octavian Rasnita wrote: Hi all, I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP templates
Hi, I took a look to Smarty and Savant templating systems, and I like a few things from both of them. However, none of them are satisfactory. I don't like Smarty because it needs another language and I find Savant more easy to use. I would like to have a templating system that: 1. Separates: - the programming part (the main programs and the modules) - the structure and main design of the site (the templates) - The content of the site, this meaning the body text, the title, keywords, and all other variables. - Other files that can be included, like Javascript, .css, images, files that can be downloaded, etc. 2. The templates should handle more languages, and all the content parts should be able to appear in every language supported. 3. The program should be able to create a cache but not one containing PHP, but one that is just simple html that can be loaded from a cached file and presenting to the client. (I don't know how to decide yet when to re-create the cached file) If someone uses this templating system, someone can modify the design by modifying the templates and this change will be reflected in every language. If a translator add a new language or modifies a certain translation, the design won't be affected. The programmer could add a new program for a new page that does something new, or new modules, etc. I couldn't find such a thing yet and I think I will have to create it. Teddy - Original Message - From: Justin French [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, August 16, 2004 4:38 AM Subject: Re: [PHP] PHP templates On 15/08/2004, at 7:02 AM, Octavian Rasnita wrote: Hi all, I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP templates
On Mon, 2004-08-16 at 02:31, Octavian Rasnita wrote: Hi, I took a look to Smarty and Savant templating systems, and I like a few things from both of them. However, none of them are satisfactory. I don't like Smarty because it needs another language and I find Savant more easy to use. I would like to have a templating system that: 1. Separates: - the programming part (the main programs and the modules) - the structure and main design of the site (the templates) - The content of the site, this meaning the body text, the title, keywords, and all other variables. - Other files that can be included, like Javascript, .css, images, files that can be downloaded, etc. 2. The templates should handle more languages, and all the content parts should be able to appear in every language supported. 3. The program should be able to create a cache but not one containing PHP, but one that is just simple html that can be loaded from a cached file and presenting to the client. (I don't know how to decide yet when to re-create the cached file) If someone uses this templating system, someone can modify the design by modifying the templates and this change will be reflected in every language. If a translator add a new language or modifies a certain translation, the design won't be affected. The programmer could add a new program for a new page that does something new, or new modules, etc. I couldn't find such a thing yet and I think I will have to create it. InterJinn. But it doesn't use caches, it compiles directly to the retrieved web pages. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP templates
On 15/08/2004, at 7:02 AM, Octavian Rasnita wrote: Hi all, I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? Ultimately it depends on who is going to be building those templates. Is it a HTML programmer, or a Dreamweaver monkey, or is it you (a PHP programmer)? It's a very old argument that has been done to death on this list 100's of times, but PHP *is a templating language* itself. h1?=$title?/h1 table thead tdName/td tdEmail/td /thead ? foreach($users as $user): ? tr td?=$user['name']?/td td?=$user['email']?/td /tr ? endforeach; ? /table Personally, I prefer to just use PHP wherever possible. The reality is that Smarty et al all compile or parse these templates into PHP at some point, so my question is, why not just use PHP? You'll eventually run into limitations with any other template language (you can't do that with smarty). However, templating languages are PERFECT in an environment where the programmer (you) doesn't want to give the template designer (someone else) the full power of PHP. Others have (and probably will again) argue that the templating languages like Smarty are easier for the designer to learn, but I completely disagree. I can't see any benefits -- check out the following examples: {$name|capitalize} {$smarty.now|date_format:%Y-%m-%d} table {section name=mysec loop=$users} {strip} tr bgcolor={cycle values=#aa,#bb} td{$users[mysec].name}/td td{$users[mysec].phone}/td /tr {/strip} {/section} /table These all look just as simple and easy in PHP: ?=capitalize($name)? ?=date('Y-m-d')? table ? foreach($users as $user): ? tr bgcolor=?=cycle(#aa,#bb)? td?=$user['name']?/td td?=$user['phone']?/td /tr ? endforeach; ? /table Yes, I'd have to have a library of various functions like capitalize() and cycle(), but this is all rudimentary stuff that could be achieved very quickly -- in fact, I've already got most of them written. Now, to pre-empt a flame by many of Smarty's fans, Smarty does offer many other advantages (caching, restricted power, encourages separation of code and presentation, etc). As I said right back at the start, it depends on who the target author of the templates will be, and what skills they have. I've spent a lot of time in Smarty, Textpattern's XHTML based template language and many more, and in most cases *I* would prefer straight PHP, but you need to spend a little time with them and decide for yourself, based on your own needs. --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP templates
Hi all, I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? Thank you. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP templates
Try http://smarty.php.net/, I haven't used it myself but I have heard good things about it. Watty -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED] Sent: 14 August 2004 22:03 To: [EMAIL PROTECTED] Subject: [PHP] PHP templates Hi all, I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? Thank you. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP templates
On Sat, 2004-08-14 at 14:02, Octavian Rasnita wrote: Hi all, I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? I use Smarty on a very frequent basis. It's very flexible and very easy to add your own function within it. One of my favorite PHP based projects..it has definitely saved me a lot of coding time and as a result my clients a whole lot of money. http://smarty.php.net/ -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
[PHP] Re: PHP templates
Hallo! I have seen that there are many templating systems for PHP. Which is the most used and the best you have found? Can you recommend me a free and good templating system? I like Savant because it is small and intuitive. You can find more info on: http://wiki.ciaweb.net/yawiki/index.php?area=Savant http://wiki.ciaweb.net/yawiki/index.php?area=SavantTwo HTH herojoker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Templates Cached on Server
Hi all, I am doing some development work on a new server I put together. For some reason, changes I make to PHP templates don't show up right away. I have not figured out how long they take to start showing, but it could be somewhere around 30 - 60 seconds. Where is this setting modified? Thanks, Rogue -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Templates Cached on Server
On Wed, 28 Jul 2004 14:41:20 -0400, rogue [EMAIL PROTECTED] wrote: Hi all, I am doing some development work on a new server I put together. For some reason, changes I make to PHP templates don't show up right away. I have not figured out how long they take to start showing, but it could be somewhere around 30 - 60 seconds. Where is this setting modified? If you're talking about actual PHP files, they normally aren't cached at all. Are you running some kind of cache, such as Turck MMCache? If you're talking about something like Smarty templates then you need to look into the settings of your template system. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates Are Driving me Nuts
Dears, Please help. This template thing is driving my nuts. I though maybe when I read more articles things will clear up; however, things got even worse. Every article writer has a different idea. Can anyone explain to me what are Templates for? What are the advantages of using them? If I use a third party template, will my site have a different look or is it only a parser that will take my designed template and data and combine them. I really don't know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Templates Are Driving me Nuts[Scanned]
I looked at these briefly a couple of years ago but never really made great use of them. I also remember seeing an article in LinuxFormat about them which can be found at: http://www.linuxformat.co.uk/archives/LXF35.tut_php.pdf My understanding is that they are mainly intended for use in development areas where you get both programmers and designers working closely together. My limited experience of designers is that they get petrified at the sight of anything that looks like code nad personally I get horribly confused when I see some of those fiendishly complicated interfaces for graphic design applications. In theory templates might offer a way of bridging this chasm - though I have my doubts. Regards, Michael Egan -Original Message- From: EE [mailto:[EMAIL PROTECTED] Sent: 13 July 2004 14:39 To: php.net Subject: [PHP] Templates Are Driving me Nuts[Scanned] Dears, Please help. This template thing is driving my nuts. I though maybe when I read more articles things will clear up; however, things got even worse. Every article writer has a different idea. Can anyone explain to me what are Templates for? What are the advantages of using them? If I use a third party template, will my site have a different look or is it only a parser that will take my designed template and data and combine them. I really don't know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The information contained in this email (and in any attachments sent with it) is confidential. It is intended for the addressee only. Access to this email by anyone else is unintended and unauthorized. If you are not the original addressee, 3tc asks you to please maintain confidentiality. If you have received this email in error please notify 3tc immediately by replying to it, then destroy any copies and delete it from your computer system. Any use, dissemination, forwarding, printing or copying of this email by anyone except the addressee in the normal course of his/her business, is strictly prohibited. 3tc owns the copyright in this email and any document created by us and assert the right to be identified as the author of it. Copyright has not been transferred to the addressee. We protect our systems with Sophos Anti-virus - www.sophos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates Are Driving me Nuts
A template system allows you to (in most cases) use a special language, different than PHP, to write your HTML. At the simplest level, template languages replace special markers with content from PHP. More complicated types involve looping and other contro structures (if, then, else, etc.). Basically a template system allows you to seperate your display code from the rest, allowing quick and easy updating of the look and feel of the site without changing any (or much) of your PHP code. This is assuming you've architected it well, of course. ;-) On Tue, 13 Jul 2004 16:39:04 +0300, EE [EMAIL PROTECTED] wrote: Dears, Please help. This template thing is driving my nuts. I though maybe when I read more articles things will clear up; however, things got even worse. Every article writer has a different idea. Can anyone explain to me what are Templates for? What are the advantages of using them? If I use a third party template, will my site have a different look or is it only a parser that will take my designed template and data and combine them. I really don't know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f3e49a72101927516234! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates Are Driving me Nuts
EE wrote: Please help. This template thing is driving my nuts. I though maybe when I read more articles things will clear up; however, things got even worse. Every article writer has a different idea. Can anyone explain to me what are Templates for? What are the advantages of using them? If I use a third party template, will my site have a different look or is it only a parser that will take my designed template and data and combine them. I really don't know. The whole idea behind templates is to separate your business logic from your presentation logic. This means you have a script that does all of your processing and data retrieval, etc. This script is generally all PHP that performs your business logic. Then you have your template that only has code meant to control your presentation. This file is mostly HTML, generally, with some special template code or limited PHP thrown in to control presentation _only_. The idea is that changes to the presentation layer will not require changes to your business layer and vice-versa. Everyone has their own ideas on whether this is needed and what kind of templates to use. There are a ton of engines out there that you can use. Some are simple and some turn into programming languages of their own and just present another layer of failure/difficulty. Some people recommend just using PHP both in your business and presentation layer as this is what PHP was originally designed for. Personal preference. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates Are Driving me Nuts
On Tue, 13 Jul 2004 10:48:34 -0400, John W. Holmes [EMAIL PROTECTED] wrote: [snip] Everyone has their own ideas on whether this is needed and what kind of templates to use. There are a ton of engines out there that you can use. Some are simple and some turn into programming languages of their own and just present another layer of failure/difficulty. Some people recommend just using PHP both in your business and presentation layer as this is what PHP was originally designed for. Personal preference. :) Personal preference indeed -- this is likely to be a long thread! If you're new to this and finding template engines confising, I'd urge you to start out by just doing pure PHP templating, i.e. what John is describing in the last sentence of his first paragraph. You get the structural benefits of templating (more readable program logic, more readable HTML) without having to learn any new syntax. In a nutshell, this means that you have a script that prepares data, and another (mostly HTML), included by the first, that presents it. The first, let's call it page.php, will be something like this: ?php $foo = $_GET['foo']; // get example parameter passed by user $foo = htmlspecialchars ($foo); // example transformation; prevent user from injecting HTML $foo = strtoupper ($foo); // example transformation; we want this displayed in all caps $date = date ('Y-m-d'); // example data; date in '2004-07-13' format require_once 'page.tpl.php'; // render page using template, fail if not found ? and page.tpl.php will be something like this: html body h1Current foo status: ?= $foo ?/h1 smallPage created on ?= $date ?/small /body /html This is a minimal example, but even without further refinements this approach will create much more readable and maintainable code than the big-ball-o-mud interwoven-PHP-and-HTML style of development. The argument against template engines is well presented here: http://phppatterns.com/index.php/article/articleview/4/1/1/ Personally, I use Smarty for sites that need complex templating, and pure PHP templating for everything else. pb -- paul bissex, e-scribe.com -- database-driven web development 413.585.8095 69.55.225.29 01061-0847 72°39'71W 42°19'42N -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates/Separate content from presentation
Pedro Pais wrote: Hi! I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? http://pear.php.net/package/HTML_Template_Flexy http://pear.php.net/package/HTML_Template_PHPLIB http://pear.php.net/package/HTML_Template_Sigma http://pear.php.net/package/HTML_Template_Xipe -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates/Separate content from presentation
Harry Fuecks (phpPaterns(), see the link below) has a quite interesting opinion concerning php and the use of templates, with which I generally agreed, after spending some hard time to investigate the most suitable for me templating ideology/approach/system. I would suggest you first read this article and then decide whether to 'succumbing to the lure of templates' or to find your best way to use php itself as a template engine. 'Templates and Template Engines' http://phppatterns.com/index.php/article/articleview/4/1/1/ Some more resources that may help answering your question: 'Compiling a list of PHP Template Engines' http://www.phppatterns.com/index.php/article/articleview/69/1/11/ http://www.bernhardseefeld.ch/archives/67.html http://www.phpbuilder.com/mail/php-general/2003042/1730.php http://www.massassi.com/php/articles/template_engines/old/ http://www.scripps.edu/~jesusmc/cachedtpl/CachedTemplate.html http://zend.com/zend/trick/tricks-nov-2001.php Cheers, Boyan Nedkov -- Pedro Pais wrote: Hi! I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates/Separate content from presentation
Thank you all for the information you gave me! :) I'll study every one of it and tell you in a short time about my choice :P Boyan Nedkov wrote: Harry Fuecks (phpPaterns(), see the link below) has a quite interesting opinion concerning php and the use of templates, with which I generally agreed, after spending some hard time to investigate the most suitable for me templating ideology/approach/system. I would suggest you first read this article and then decide whether to 'succumbing to the lure of templates' or to find your best way to use php itself as a template engine. 'Templates and Template Engines' http://phppatterns.com/index.php/article/articleview/4/1/1/ Some more resources that may help answering your question: 'Compiling a list of PHP Template Engines' http://www.phppatterns.com/index.php/article/articleview/69/1/11/ http://www.bernhardseefeld.ch/archives/67.html http://www.phpbuilder.com/mail/php-general/2003042/1730.php http://www.massassi.com/php/articles/template_engines/old/ http://www.scripps.edu/~jesusmc/cachedtpl/CachedTemplate.html http://zend.com/zend/trick/tricks-nov-2001.php Cheers, Boyan Nedkov -- Pedro Pais wrote: Hi! I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates/Separate content from presentation
Hi! I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates/Separate content from presentation
I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? I tried Smarty for several weeks and found it was more than I needed, so I went back to my simpler template system. I have templates that look like this for example: cat userImage.tpl !-- userImage Template -- tr tda href=index.php?i=$imageIDimg src=thumbnail.php?i=$imageID $imageHeightWidth border=0 alt=$imageAltText title=$imageAltText //a/td td nowrap=nowrap$userType/td td align=center$commentsCountHTML/td td align=center$totalPoints/td td align=center$timesRated/td td align=center$averageRating/td /tr !-- End userImage Template -- Then in my php scripts I call a template like this: $userImage = getTemplate(userImage); eval(\$userImage = \$userImage\;); $html .= $userImage; The function being: function getTemplate($template){ global $Site; $html = ''; $file = $Site['TemplatePath'] . '/' . $template . '.tpl'; if($handle = fopen($file, r)){ while(!feof($handle)){ $html .= fgets($handle, 4096); } fclose($handle); $html = str_replace(\\',', addslashes($html)); } else { die('Fatal: cannot open template ' . $file . 'br /\n'); } return $html; } Of course I have no template caching system like Smarty has, but I use TurkeMM Cache: http://www.turcksoft.com/ and query caching from MySQL 4. I also clean my html before output, removing all tabs and newline characters, and I have zlib.output_compression enabled. Seems to work well. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates/Separate content from presentation
On Fri, 2003-10-31 at 22:23, Pedro Pais wrote: Hi! I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? TemplateJinn, part of the InterJinn framework. Absolutely fantastic (bias warning :) Too much to properly give credit in a single email, feel free to check out the very full docs at the link below: http://www.interjinn.com/documentation/templateJinn.phtml Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates, custom functions, mysql
Hi list, I'm using TemplatePower (http://templatepower.codocad.com/) as my template engine. There will be multiple rows of results, and the data is stored in the $tpl-assign(); parts. The function gets projects for a given employee. My function is at the bottom of this e-mail. The problem is that I can't get the results to be printed to my $template, or $home_tpl. $home_tpl is named home.tpl, and that's where the html code is that displays the results from worker_projects(); Can anyone help me out here? If you need more info, just let me know. Tyler Longren [EMAIL PROTECTED] CODE BELOW function worker_projects() { $template = $home_tpl; $tpl = new TemplatePower($template); $tpl-prepare(); // Begin getting consulting projects. $consultingproject_sqltext = SELECT customer.custid,customer.ownorgname,customerorder.custid,consultingproject.p rojectid,consultingproject.description,consultingproject.startdate,consultin gproject.enddate,consultingprojectassign.workerid,consultingprojectassign.pr ojectid FROM consultingproject,consultingprojectassign, customerorder, customer WHERE consultingprojectassign.workerid='$_COOKIE[workerid]' AND consultingproject.projectid=consultingprojectassign.projectid AND consultingproject.ordid = customerorder.ordid AND customer.custid = customerorder.custid ORDER BY enddate ASC; $consultingproject_sql = mysql_query($consultingproject_sqltext); if (mysql_num_rows($consultingproject_sql) 1) { $tpl-newBlock('no_consulting_projects'); $tpl-assign(no_consulting_projects,You don't have any consulting projects.); } else { $alternate = 1; $tpl-newBlock('consulting_projects'); while ($row = mysql_fetch_array($consultingproject_sql)) { $tpl-newBlock('consulting_projects_data'); $tpl-assign(consulting_projectid,$row[projectid]); $tpl-assign(consulting_company,$row[ownorgname]); $tpl-assign(consulting_startdate,$row[startdate]); $tpl-assign(consulting_enddate,$row[enddate]); if ($alternate == 1) { $color = #ff; $tpl-assign(row_color,$color); $alternate = 2; } else { $color = #cecece; $tpl-assign(row_color,$color); $alternate = 1; } } } mysql_close($connection); $tpl-printToScreen(); return $tpl; // End getting consulting projects. } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates...
Does anyone know any other way used in template engines for loops but creating array first and passing it to template class? This is rather annoying and it makes work slower and code harder to read. I've made my own template class with variable and loop support. Loop handling is way different from what I've seen in other template engines. I've made few screenshots of code examples (I was too lazy to add font colors). Please let me know if you've seen this idea before, and what you think of it. The class still needs some tweaking but I'll post it here some other day if anyone is interested. Cheers, Donny
Re: [PHP] Templates
yeh, I'd totally agree with this. Smarty is fantastic The best one imho in PHP is Smarty. I'd rank it up there with Template::Toolkit. Take a look: http://smarty.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates
I'm looking around for some options on using templates with PHP. I've used several Perl solutions in the past, but never tried it in PHP. Digging on the web yields several options so I'd love some thoughts or comments. The real driver is that the basic site design could change over time and I'd like to have the basic HTML in the templates, and the real logic in the PHP code. Thanks in advance, Darren Young -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates
Go for a complex situation if that's what you want, or consider the basics: home.php ? include('inc/header_code.php'); // // unique code for this page to be executed before the html tag // include('inc/header_html.php'); ? Welcome to our website! ? include('inc/footer.php'); ? contact.php ? include('inc/header_code.php'); // // unique code for this page to be executed before the html tag // include('inc/header_html.php'); ? Contact us: [EMAIL PROTECTED] ? include('inc/footer.php'); ? If you update any code in any of the 3 include files, you will update the entire site's look, feel and actions. It still allows for you to execute unique PHP code either before or after the HTML starts too. Strip your site down to what's common, and what's unique to each page, and see where you go from there. Justin on 14/02/03 10:00 AM, Darren Young ([EMAIL PROTECTED]) wrote: I'm looking around for some options on using templates with PHP. I've used several Perl solutions in the past, but never tried it in PHP. Digging on the web yields several options so I'd love some thoughts or comments. The real driver is that the basic site design could change over time and I'd like to have the basic HTML in the templates, and the real logic in the PHP code. Thanks in advance, Darren Young -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates
If you update any code in any of the 3 include files, you will update the entire site's look, feel and actions. It still allows for you to execute unique PHP code either before or after the HTML starts too. I forgot to mention that a whole heap of your formatting and visial design can be achieved with CSS too... don't get yourself trapped by making the content hard to update. A simple p class=bodyText means that it's just as updateable as the rest of your code, by tweaking a few lines of CSS in header_html.php Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Templates
That's pretty much what I'm doing today, header page, menu page, content page and a footer. Each of which includes a shared functions file as well via require_once(). Only real problem is keeping track of tables/rows/columns across all the various files. The 'where was that tr supposed to be...' kind of thing. Here's another one, there's no way to set a cookie after the headers have been sent, true? Any way around this at all or at that point am I best to use session variables and/or hidden fields. I haven't done pure web development in a few years and am trying to catch back up quickly. Any best practices assistance would be appreciated. Thanks for the response by the way. /DAY -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 5:22 PM To: Darren Young; [EMAIL PROTECTED] Subject: Re: [PHP] Templates Go for a complex situation if that's what you want, or consider the basics: home.php ? include('inc/header_code.php'); // // unique code for this page to be executed before the html tag // include('inc/header_html.php'); ? Welcome to our website! ? include('inc/footer.php'); ? contact.php ? include('inc/header_code.php'); // // unique code for this page to be executed before the html tag // include('inc/header_html.php'); ? Contact us: [EMAIL PROTECTED] ? include('inc/footer.php'); ? If you update any code in any of the 3 include files, you will update the entire site's look, feel and actions. It still allows for you to execute unique PHP code either before or after the HTML starts too. Strip your site down to what's common, and what's unique to each page, and see where you go from there. Justin on 14/02/03 10:00 AM, Darren Young ([EMAIL PROTECTED]) wrote: I'm looking around for some options on using templates with PHP. I've used several Perl solutions in the past, but never tried it in PHP. Digging on the web yields several options so I'd love some thoughts or comments. The real driver is that the basic site design could change over time and I'd like to have the basic HTML in the templates, and the real logic in the PHP code. Thanks in advance, Darren Young -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates
on 14/02/03 10:20 AM, Darren Young ([EMAIL PROTECTED]) wrote: That's pretty much what I'm doing today, header page, menu page, content page and a footer. Each of which includes a shared functions file as well via require_once(). Only real problem is keeping track of tables/rows/columns across all the various files. The 'where was that tr supposed to be...' kind of thing. yeah, well a complex layout will kill it pretty quick :) The other way is go down the route of a 'fusebox' -- one script that shows all pages within the site. index.php ? // some header stuff ? html table tr tdStuff/td /tr tr td ? $file = content/{$_GET['p']}.html; if(file_exists($file)) { include($file); } else { include('content/error.html'); } ? /td /tr /table /html you can call that script with p=contact p=home p=about p=membersaction=validatestep=3favcolor=blue And just make sure the include files do what they need to. Here's another one, there's no way to set a cookie after the headers have been sent, true? Any way around this at all or at that point am I best to use session variables and/or hidden fields. Hidden fields, yes. You are going to have the same problem with sessions... sessions must be set before the headers are sent too. You need to either change the logic on your page so that you set the cookie BEFORE the html, or enable output buffering, so that you can set the cookie or session whenever you like, then do a flush. Personally, I've never seen the need to use OB, because I've found a way to work that I'm comfortable with. eg: ? include('header_code.inc'); if($action=='validate') { // validate form entry if($error) { $show_form = 1; } else { $show_form = 0; // add form to DB or // set a cookie or // set a session or header(Location: form.php?page=thanks); } } ? html body ? if($show_form) { include('form.inc'); } if($_GET['page'] == thanks) { echo thanks; } ? /body /html In otherwords, I execute any code that I need to BEFORE the headers are sent, to ensure that I CAN set cookies, sessions, or use header()... I set some simple triggers like $show_form to decide what I want to do in the body. Each to their own, but it works great for me over many many applications. Justin Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates
On 13 Feb 2003 at 17:00, Darren Young wrote: I'm looking around for some options on using templates with PHP. I've used several Perl solutions in the past, but never tried it in PHP. Digging on the web yields several options so I'd love some thoughts or comments. The real driver is that the basic site design could change over time and I'd like to have the basic HTML in the templates, and the real logic in the PHP code. Well, it seems every Perl programmer at one point or another wrote their own templating system. I went from my own to HTML::Template to a big fan of Template::Toolkit. The best one imho in PHP is Smarty. I'd rank it up there with Template::Toolkit. Take a look: http://smarty.php.net/ Of course it's very easy to change not only the look and feel but the actual layout and everything else about it. Best thing about not writing your own personal propriertary system is you benefit from the world at at large. I haven't used Smarty in a awhile as I've been mired in a CMS but I just recently had a chance to use it and I see it has been improving. Take a good look at it. Peter Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] templates
I am developing a site, using XML and PHP for formatting. I want to have one HTML template and call up the different XML files from a Javascript menu. Ideally i want to be able to call files from a link, such as: 'index.php?action=loadfile=file.xml' Not sure if this is the right format, but hopefully you get the idea. Cheers, Adam.
Re: [PHP] templates
I'm assuming you're trying to have a select list. Try this: select name=foo onChange=window.location='?=$PHP_SELF??action=loadfile=' + this.value option value=file.xmlFile XML1/option option value=file2.xmlFile foo/option /select Just make sure you test the value you get for file, so that someone doesn't pass you /etc/passwd (just an example). -js Adam wrote: I am developing a site, using XML and PHP for formatting. I want to have one HTML template and call up the different XML files from a Javascript menu. Ideally i want to be able to call files from a link, such as: 'index.php?action=loadfile=file.xml' Not sure if this is the right format, but hopefully you get the idea. Cheers, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templates
Cheers for replying. I have the menu in place already, it is the PHP end i'm not sure about. Currently I have many php files which only differ in one line: $filename=file.xml; I want to be able to pass this value to the script through a link. A. - Original Message - From: Jonathan Sharp [EMAIL PROTECTED] To: Adam [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, November 19, 2002 4:33 PM Subject: Re: [PHP] templates I'm assuming you're trying to have a select list. Try this: select name=foo onChange=window.location='?=$PHP_SELF??action=loadfile=' + this.value option value=file.xmlFile XML1/option option value=file2.xmlFile foo/option /select Just make sure you test the value you get for file, so that someone doesn't pass you /etc/passwd (just an example). -js Adam wrote: I am developing a site, using XML and PHP for formatting. I want to have one HTML template and call up the different XML files from a Javascript menu. Ideally i want to be able to call files from a link, such as: 'index.php?action=loadfile=file.xml' Not sure if this is the right format, but hopefully you get the idea. Cheers, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templates
At 18:04 19.11.2002, Adam spoke out and said: [snip] Cheers for replying. I have the menu in place already, it is the PHP end i'm not sure about. Currently I have many php files which only differ in one line: $filename=file.xml; I want to be able to pass this value to the script through a link. [snip] How about $files = array('file1.xml' = 'Go to file 1', 'file2.xml' = 'Go to file 2', 'file3.xml' = 'Go to file 3', 'file4.xml' = 'Go to file 4'); foreach ($files as $filename = $text) { // you should put your actual menu code here echo 'a href=', $_SERVER['PHP_SELF'], '?filename=', urlencode($filename), '', htmlentities($text), '/abr'; } -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
Re: [PHP] templates
Thanks, but not sure if this is what i'm looking for I just want to setup the PHP script so that the variable $filename can be changed via a link such as 'index.php?filename=file.xml', causing the script to parse the appropriate file. Adam. - Original Message - From: Ernest E Vogelsinger To: Adam Cc: Jonathan Sharp ; [EMAIL PROTECTED] Sent: Tuesday, November 19, 2002 5:17 PM Subject: Re: [PHP] templates At 18:04 19.11.2002, Adam spoke out and said: [snip] Cheers for replying. I have the menu in place already, it is the PHP end i'm not sure about. Currently I have many php files which only differ in one line: $filename=file.xml; I want to be able to pass this value to the script through a link. [snip] How about $files = array('file1.xml' = 'Go to file 1', 'file2.xml' = 'Go to file 2', 'file3.xml' = 'Go to file 3', 'file4.xml' = 'Go to file 4'); foreach ($files as $filename = $text) { // you should put your actual menu code here echo 'a href=', $_SERVER['PHP_SELF'], '?filename=', urlencode($filename), '', htmlentities($text), '/abr'; } -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
Re: [PHP] templates
At 19:10 19.11.2002, Adam said: [snip] Thanks, but not sure if this is what i'm looking for I just want to setup the PHP script so that the variable $filename can be changed via a link such as 'index.php?filename=file.xml', causing the script to parse the appropriate file. [snip] When you execute the URL index.php?filename=file.xml (note - no quotes) your PHP script will have this value readily accessible as $filename (if register_globals is on, as outlined in many threads the last days). With the latest PHP versions, register_globals defaults to off, so you don't have $filename but rather $_GET['filename'] available. If your PHP host has register_globals off, but you need parameters as globals, you can put this little script at the beginning of your PHP file: foreach ($_REQUEST as $varname = $value) { $var = '$'.$varname; global $$var; $$var = $value; } You will then be able to access parameters as if register_globals would be on. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templates and listbox
Hey Javier: On Thu, Apr 11, 2002 at 01:33:10PM -0300, Javier wrote: But does it use templates? I want to use templates not functions that generates html. What do you mean, it uses templates not functions? Smarty uses functions. Are you envisioning include files with scripts in them that aren't functions? --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] templates with php
Has anybody uses other engine besides Smart or php-templates (freebsd ports) I trying to get into the subject but I don't know which to start with. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates
Hi every1, I've been playing around with template.inc out of PHPLib. Now there's just one question dwelling in my head.. is it possible somehow to get the server to parse any html-file that is requested. example: user requests file index.html, index.html is parsed thru a standard template to generate the nicely formatted page... index.html only holds the content of the site and is pure html (maybe with a tag or two to mark the content and the title or so, but no or very very little PHP code in it.) I hope this is more or less understandable... ;oP I'd appreciate any help on that even if you say that it will never work.. thanks Stefan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates
Hey mate, There's several template engines out there, Take a look around here: http://www.hotscripts.com/PHP/Scripts_and_Programs/Content_Management/ Hope that helps ya! - Lum - Original Message - From: Truniger, Stefan Martin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 14, 2002 7:46 PM Subject: [PHP] Templates Hi every1, I've been playing around with template.inc out of PHPLib. Now there's just one question dwelling in my head.. is it possible somehow to get the server to parse any html-file that is requested. example: user requests file index.html, index.html is parsed thru a standard template to generate the nicely formatted page... index.html only holds the content of the site and is pure html (maybe with a tag or two to mark the content and the title or so, but no or very very little PHP code in it.) I hope this is more or less understandable... ;oP I'd appreciate any help on that even if you say that it will never work.. thanks Stefan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] templates
hey, which is the best template library out there? does anyone have any benchmarks? smarty? phplib? any others? Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templates
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Kunal Jhunjhunwala declared hey, which is the best template library out there? does anyone have any benchmarks? smarty? phplib? any others? Hehe, still messing with templates kunal? There's a good article on PHPLib vs Fastemplate on either devshed or phpbuilder but from what I've read PHPLib is the way forward. - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8ZCyEHpvrrTa6L5oRAl4IAJ9HWbjF8fh4nwOV3AAlz2WSNwEbzwCcC6fz 3fuFP1328LE9SO2Iabj3jZk= =NU8H -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templates
Hey, Well, I got phplib working.. but i yet think something is missing :) and have heard a lot of buzz abt smarty... but havent seen any benchmarks... from the article at devshed.. fast templates should have stayed with perl ;) anyone else got any suggestions? Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll - Original Message - From: Nick Wilson [EMAIL PROTECTED] To: php-list [EMAIL PROTECTED] Sent: Saturday, February 09, 2002 1:22 AM Subject: Re: [PHP] templates -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Kunal Jhunjhunwala declared hey, which is the best template library out there? does anyone have any benchmarks? smarty? phplib? any others? Hehe, still messing with templates kunal? There's a good article on PHPLib vs Fastemplate on either devshed or phpbuilder but from what I've read PHPLib is the way forward. - -- Nick Wilson Tel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8ZCyEHpvrrTa6L5oRAl4IAJ9HWbjF8fh4nwOV3AAlz2WSNwEbzwCcC6fz 3fuFP1328LE9SO2Iabj3jZk= =NU8H -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates: how to get that HTML outta my templates!
Sorry for bringing this topic up yet again, but I'm having a real problem with the details of implementing a templates system. I'm read all the tutorials, articles, emails etc, but was hoping others on this list with the same problems could share how they solved them. Now I understand the basic logic of a template system: separate the client side code (html, javascript) from the PHP. That way I can write my PHP modules then hand them off to the HTML programmers and designers to implement in their webpages. Two ways to do this (that I can think of at the moment) would be to use PHP functions ?php create_main_menu(); ?, or to use include files ?php include(main_menu.php3); ?. The problem is that I use PHP throughout my webpages and find it very difficult to elegantly separate the HTML and PHP code. I use it for main menus, sub menus, titles, page listings, article listings, next-page links, random image generation, etc etc. As an example lets look at a menu. There are a lot of ways that menu could be designed. The designer could have a little icon in front of each menu item, or behind each menu item, or have a special background colour, or special font colour, etc etc etc. The list is endless. The PHP code is going to have to loop through that menu array, display each menu item, then add the appropriate html for that menu item. How the heck do I separate the HTML and PHP here? One option I thought of was to create a PHP function with the HTML design components making up the function's arguments. Ie, argument one would be the name of the mouse-over image in front of each menu item, argument two would be it's height, argument three would be it's width. etc etc ad infinitem. What a mess! You would end up with an insane number of arguements. How do users of template systems deal with these problems? I work in a very small tech department (there are four of us, and I do all the PHP coding) and found it was easiest in the long run to just divide up the webpages into components and turn these components into include files. For example, the main menu component, sub menu component, page list component, page contents component, etc etc. Each component is a full autonomous table that can can easily pop into the basic table structure of a website. (I've found that dividing up one table into two or more files is just confusing!) Others in the department who are designing a webpage to which I'll be adding PHP components just use sample data for menus, page content, etc. I take a look at it then, make sure the design is database-driven content friendly, then add the php bits. When you use template driven websites, do you find there are certain projects they work better for. Are they more appropriate for larger websites with larger groups of people working on them? I'd really be interested in other people's solutions and experiences! Thanks, Rita. -- 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] templates
I was wondering if anyone knew of alternatives to the TEMPLATES methodology? thanks Yorke -- 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] PHP templates vs XML
In an on-again-off-again desultory style, I keep trying to find the time to study template systems - and quite separately see if I can find a practical use for XML. The idea of a template system is that the HTML code/presentation of the final view to the user/browser, can be devised/maintained quite separately from the PHP code required to pull data out of the back-end db/processing/whatever. Correct? The systems I've looked at do this by allowing you to put 'tags' into the HTML which are subsequently expanded/replaced with 'real data' by the template processor immediately before presentation to the browser. Now, again broadly speaking, XML allows us to define our own tags, which are subsequently ... Correct? So: when would you use a template system and when would you use XML? (and thus: on which one should I concentrate my research? ) Any all pointers/references to online information sources will be much appreciated. =dn -- 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]
Re: [PHP] PHP templates vs XML
On Mon, 29 Oct 2001 14:02:32 -, you wrote: The idea of a template system is that the HTML code/presentation of the final view to the user/browser, can be devised/maintained quite separately from the PHP code required to pull data out of the back-end db/processing/whatever. Correct? The systems I've looked at do this by allowing you to put 'tags' into the HTML which are subsequently expanded/replaced with 'real data' by the template processor immediately before presentation to the browser. Now, again broadly speaking, XML allows us to define our own tags, which are subsequently ... Correct? So: when would you use a template system and when would you use XML? (and thus: on which one should I concentrate my research? ) I tend to use FastTemplate or similar systems to template most of my output - be that output HTML, Javascript - or XML. That, and the way a program is structured (collecting, processing and only then outputting it in whatever format) makes adding in different assortments of data in a variety of output formats truely trivial. In the current case, it's book information, so I collect ISBN data, which gets output. In an upcoming project, it will be news snippets - press releases and the like, where the templates will be updated and added to at will for different styles of output, as well as serialised (PHP/WDDX) and XML/RDF/Javascript output . The XML related templates of which you speak are generally XSL Templates, which are a programming language in themselves, and the XML parsing into XSL is an extensive overhead to carry. Alister -- 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] Templates???
Can anyone direct me to some sample PHP code that extracts HTML from a template file and replaces the, say, %field% tags in the HTML with variables from the PHP file. Just like what Gossamer Threads Links program does with Perl. So, any 1 have any links?? -- 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] templates
i've been looking for a template site that i used and never bookmarked. I'll tell you what i remember about the site and hopefully someone will know what site i'm talking about. I've spend the last 5 hours looking for this siteso this is my final stab in the dark. The site had 4 categories of templates. one was business templates and the other was user templates. most of the designs were linkware. and most of the templates were in plain html. the site had a lot of templates...150+? does anybody remember a free template site like that? I'm pulling my hair out because ti was a good template site...not one of those cheezy one design 50 different color template sites. ~kurth -- 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]
Re: [PHP] templates
Your web browser should have a history option, and you can sift through the list of domains you surfed that approximate time frame ago...Also you can search in some applications like netscape the history file, and look for key things like templates... Good Luck Kurth Bemis wrote: i've been looking for a template site that i used and never bookmarked. I'll tell you what i remember about the site and hopefully someone will know what site i'm talking about. I've spend the last 5 hours looking for this siteso this is my final stab in the dark. The site had 4 categories of templates. one was business templates and the other was user templates. most of the designs were linkware. and most of the templates were in plain html. the site had a lot of templates...150+? does anybody remember a free template site like that? I'm pulling my hair out because ti was a good template site...not one of those cheezy one design 50 different color template sites. ~kurth -- 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] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- 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]
Re: [PHP] templates
At 11:29 AM 7/23/2001, Jack Sasportas wrote: I last visited this site about 2 months ago...too long for any history :-( Your web browser should have a history option, and you can sift through the list of domains you surfed that approximate time frame ago...Also you can search in some applications like netscape the history file, and look for key things like templates... Good Luck Kurth Bemis wrote: i've been looking for a template site that i used and never bookmarked. I'll tell you what i remember about the site and hopefully someone will know what site i'm talking about. I've spend the last 5 hours looking for this siteso this is my final stab in the dark. The site had 4 categories of templates. one was business templates and the other was user templates. most of the designs were linkware. and most of the templates were in plain html. the site had a lot of templates...150+? does anybody remember a free template site like that? I'm pulling my hair out because ti was a good template site...not one of those cheezy one design 50 different color template sites. ~kurth -- 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] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- 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]
Re: [PHP] templates
For future purposes you should set your history to expire some ridiculous time in the future. I still reference sites from as far back as 2 years ago... It's really nice to be able to do that. I use netscape and my setting is 999 days.. Jack Kurth Bemis wrote: At 11:29 AM 7/23/2001, Jack Sasportas wrote: I last visited this site about 2 months ago...too long for any history :-( Your web browser should have a history option, and you can sift through the list of domains you surfed that approximate time frame ago...Also you can search in some applications like netscape the history file, and look for key things like templates... Good Luck Kurth Bemis wrote: i've been looking for a template site that i used and never bookmarked. I'll tell you what i remember about the site and hopefully someone will know what site i'm talking about. I've spend the last 5 hours looking for this siteso this is my final stab in the dark. The site had 4 categories of templates. one was business templates and the other was user templates. most of the designs were linkware. and most of the templates were in plain html. the site had a lot of templates...150+? does anybody remember a free template site like that? I'm pulling my hair out because ti was a good template site...not one of those cheezy one design 50 different color template sites. ~kurth -- 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] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- 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] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- 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] PHP, Templates, XSLT
Hi there, I was wondering if anyone ever tested XSLT. I know it's much more than a template system, but we are willing to use it as a transformation of XML purely as a template. Anyways, has anyone experienced it with Sablotron? How did you like it? Was it any good? Is it fast enough for big websites? We're trying to decide what is best: smarty template or a XML-based solution. Do you guys think that PHP is prepared for XML/XSLT or you don't like XML at all? -- Leonardo Dias Catho Online WebDeveloper http://www.catho.com.br/ -- 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]
Re: [PHP] PHP, Templates, XSLT
From: Leonardo Dias [EMAIL PROTECTED] Anyways, has anyone experienced it with Sablotron? Yes. How did you like it? Worked as advertised. Which is a bear sometimes - but that's due to XML limitations, not Sablotron's fault. Was it any good? Yup. Is it fast enough for big websites? Well, big websites don't necessarily have to be fast (I've got over 100,000 pages on one of my websites - but since I'm getting about 2 hits/second it doesn't have to be fast) - but in general, XSLT translation takes a noticeable hit. If your expaectations are in the hundreds of hits/second then you would want to cache the resulting page anyway. Mark [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]
Re: [PHP] PHP, Templates, XSLT
Anyways, has anyone experienced it with Sablotron? How did you like it? nice You can also try to check browser : if mozilla 0.9.1 or later (you choose) it can be parsed on the client; ie 6.0 isn't used yet... -- Marius Andreiana -- 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]
Re: [PHP] Templates??
Hi, What the true advantage of using templates Abstraction between PHP and HTML. where can I get info on using them? have a look at the well-known php sites like: http://www.phpbuilder.com/ http://www.phpdeveloper.org/ http://www.newbienetwork.net/ http://www.evilwalrus.com/
Re: [PHP] Templates??
The template defines the look and feel for a class of pages. The advantage is in allowing you to change one file -- the template file -- and have your changes be reflected in all the individual pages that use the template WITHOUT having to individually edit all of those pages. For smaller sites, this may not be a big deal, but, for sites with thousands of pages, you clearly want to avoid hand-edits if at all possible. I'm personally reworking my online portfolio, and I'm now using templates so I can present a different look and feel to suit different potential clients. FYI, at the last ThunderLizard web design conference, a presenter speaking about content management tools said that most sites only need 6 or so templates ... that there are usually only 6 categories of pages. At 05:48 PM 6/18/2001 -0700, Daniel Guerrier wrote: What the true advantage of using templates and where can I get info on using them? __ Do You Yahoo!? Spot the hottest trends in music, movies, and more. http://buzz.yahoo.com/ Les Neste 678-778-0382 http://www.lesneste.com
Re: [PHP] Templates??
FYI, at the last ThunderLizard web design conference, a presenter speaking about content management tools said that most sites only need 6 or so templates ... that there are usually only 6 categories of pages. Salut, do you know where we could get more info about that conference? What are his 6 categories of pages? I am focusing on Templating my sites now and I am interested in what was said there. py - Original Message - From: Les Neste [EMAIL PROTECTED] To: Daniel Guerrier [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, June 19, 2001 6:29 AM Subject: Re: [PHP] Templates?? The template defines the look and feel for a class of pages. The advantage is in allowing you to change one file -- the template file -- and have your changes be reflected in all the individual pages that use the template WITHOUT having to individually edit all of those pages. For smaller sites, this may not be a big deal, but, for sites with thousands of pages, you clearly want to avoid hand-edits if at all possible. I'm personally reworking my online portfolio, and I'm now using templates so I can present a different look and feel to suit different potential clients. FYI, at the last ThunderLizard web design conference, a presenter speaking about content management tools said that most sites only need 6 or so templates ... that there are usually only 6 categories of pages. At 05:48 PM 6/18/2001 -0700, Daniel Guerrier wrote: What the true advantage of using templates and where can I get info on using them? __ Do You Yahoo!? Spot the hottest trends in music, movies, and more. http://buzz.yahoo.com/ Les Neste 678-778-0382 http://www.lesneste.com
[PHP] Templates??
What the true advantage of using templates and where can I get info on using them? __ Do You Yahoo!? Spot the hottest trends in music, movies, and more. http://buzz.yahoo.com/
[PHP] Templates/Graphics/Text
I'm trying to figure out what's the best way to do something that may be simple, however I can't for the life of me envision it. I want to have three files as follows: [ NOTE: I may be thinking of this the wrong way (by thinking up three files.) If someone has a better suggestion, please speak up! I'm willing to entertain other solutions. ] - img_template.php (which contains the full, graphical website page, except for the content) - txt_template.php (which contains the full page, without any of the bells and whistles, graphics javascript and all) - content_page.html (which is the actual content) This is where I get stuck. What to do? To me, the easiest seems to be one single (control) file for the whole site, which then loads up the content based on the URI. For example: http://our.web.site/index.php?page_to_load - this will grab the img_template.php file, then - fetch 'page_to_load.html' and insert it into the template and serve it. However, will this pose a problem for search engines? Or for anything else? I don't know. Anyone? Now, we would also like to have the whole site be in text format (really a slimmed down page without all the graphics, roll-overs, easy to print and such). I'm thinking, add another variable: http://our.web.site/index.php?page_to_loadformat=text or: http://our.web.site/index.php?page_to_loadformat=graphic But again, how will search engines handle this? And, I would also have to be able to dynamically update any anchor links that show up in the content so it knows what it needs to link to in terms of format. Somewhat stupid to have someone click on a 'text only' link, and when following another link from that it drops back to a graphic based page. Call for comments. Suggestions. A blow to the head. Something. I'd like to make this so that future site re-designs won't be as painful as this one is turning out to be (currently all 500+ pages of the site have everything hard coded, so changing something in say a menu causes a real problem). And yes, I've looked at FastTemplates and I'm, uh, somewhat lost, but that may be because I haven't really spent a whole lot of time reading up on it. Also, the stuff on there dates back to 1999 - has it not been updated recently? Or did it not need any? AMK4 -- W | | I haven't lost my mind; it's backed up on tape somewhere. | ~ Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. .eFax 248.671.0909 http://www.pcraft.com . 3550 Arapahoe Ave #6 .. . . . . Boulder, CO 80303, USA -- 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]
Re: [PHP] Templates/Graphics/Text
sounds like you're wanting to do this : // get mode from url or preferences or somewhere $mode = strtolower($HTTP_GET_VARS['mode']); if ($mode == 'text') { include 'txt_template.php'; } else { include 'img_template.php'; } include 'content_page.html'; now : index.php?mode=text // loads text template index.php ... // anything else loads img template regarding friendly search-engine pages, have a look at these two tutorials : http://www.phpbuilder.com/columns/tim2526.php3 http://www.zend.com/zend/spotlight/searchengine.php also, consider sending 'lynx' users to your text templatized pages ;-) and fyi, the above if/else can be written as follows (ternary conditional operator) : include ($mode == 'text') ? 'txt_template.php' : 'img_template.php'; regards, philip On Wed, 2 May 2001, Ashley M. Kirchner wrote: I'm trying to figure out what's the best way to do something that may be simple, however I can't for the life of me envision it. I want to have three files as follows: [ NOTE: I may be thinking of this the wrong way (by thinking up three files.) If someone has a better suggestion, please speak up! I'm willing to entertain other solutions. ] - img_template.php (which contains the full, graphical website page, except for the content) - txt_template.php (which contains the full page, without any of the bells and whistles, graphics javascript and all) - content_page.html (which is the actual content) This is where I get stuck. What to do? To me, the easiest seems to be one single (control) file for the whole site, which then loads up the content based on the URI. For example: http://our.web.site/index.php?page_to_load - this will grab the img_template.php file, then - fetch 'page_to_load.html' and insert it into the template and serve it. However, will this pose a problem for search engines? Or for anything else? I don't know. Anyone? Now, we would also like to have the whole site be in text format (really a slimmed down page without all the graphics, roll-overs, easy to print and such). I'm thinking, add another variable: http://our.web.site/index.php?page_to_loadformat=text or: http://our.web.site/index.php?page_to_loadformat=graphic But again, how will search engines handle this? And, I would also have to be able to dynamically update any anchor links that show up in the content so it knows what it needs to link to in terms of format. Somewhat stupid to have someone click on a 'text only' link, and when following another link from that it drops back to a graphic based page. Call for comments. Suggestions. A blow to the head. Something. I'd like to make this so that future site re-designs won't be as painful as this one is turning out to be (currently all 500+ pages of the site have everything hard coded, so changing something in say a menu causes a real problem). And yes, I've looked at FastTemplates and I'm, uh, somewhat lost, but that may be because I haven't really spent a whole lot of time reading up on it. Also, the stuff on there dates back to 1999 - has it not been updated recently? Or did it not need any? AMK4 -- W | | I haven't lost my mind; it's backed up on tape somewhere. | ~ Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. .eFax 248.671.0909 http://www.pcraft.com . 3550 Arapahoe Ave #6 .. . . . . Boulder, CO 80303, USA -- 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]
[PHP] Templates - Perl to PHP
Hello! Do you know Links 2.0 by Gossamer-Threads ? Well, this perl script uses a template engine(annexed file) based in a modification of CGI::FastTemplate that give a useful flexibility for webdesigners. The facilities are that webdesigners can use logical functions in his tags on templates (actually if, if not, , , = =, != ) eg: {IF IMAGE} p img src="{IMAGE}" br br {ENDIF} Thus all code between the if statement will be printed if $image is set else nothing will be. This is very useful when you have a list of elements that someone have some elements and others not, eg: 1) The template without this enhancement: p img src="{IMAGE}"brbr {NAME}br {EMAIL} Thus if the current user doesn't have a image the p, img and brbr tags will be printed in any way. 2) The template with the enhancement: {IF IMAGE} p img src="{IMAGE}" br br {ENDIF} {NAME}br {EMAIL} Thus if the current user doesn't have a image the p, img and brbr tags will not be printed in any way, maintaining the desired design. THIS IS GREAT !!! Note) Also, would be excellent if we have the following options on tags: 1) include a file not parsed (straight include of HTML) (allows php code) 2) include a file parsed (parse the include file for tags) (allows php code) Is possible to convert the Template.pm (see annexed file) by Gossamer to php class ??? Kindest Regards, Marco Aurlio Brazil [EMAIL PROTECTED] BTW(a), I tried dozen based FastTemplates engines but anyone have the functions of Template.pm. BTW(b): 1) Can you understand me ??? (sorry for my poor english.) 2) If have any cost, please tell me. 3) Please answer me, I really need it. -- 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]
Re: [PHP] Templates - Perl to PHP
Hola - your English is mucho better than my Spanish (or is it Portguese in Brazil?) sorry! I assume you're looking for PHP code equivalents for this, correct? Is there any reason you can't just put the code in your template? ? if ($image) { ? p img src="?=$image;?" br br ? } else { ? ?=$name;? ? } ? That would do it just as well. Admittedly, there's more and ? than you might like, but it's as functional (if not more so) and it's one less thing for your script to process at the end of the day. Marco Aurlio wrote: Hello! ... {IF IMAGE} p img src="{IMAGE}" br br {ENDIF} Thus all code between the if statement will be printed if $image is set else nothing will be. This is very useful when you have a list of elements that someone have some elements and others not, eg: 1) The template without this enhancement: p img src="{IMAGE}"brbr {NAME}br {EMAIL} Thus if the current user doesn't have a image the p, img and brbr tags will be printed in any way. 2) The template with the enhancement: {IF IMAGE} p img src="{IMAGE}" br br {ENDIF} {NAME}br {EMAIL} Thus if the current user doesn't have a image the p, img and brbr tags will not be printed in any way, maintaining the desired design. THIS IS GREAT !!! Note) Also, would be excellent if we have the following options on tags: 1) include a file not parsed (straight include of HTML) (allows php code) 2) include a file parsed (parse the include file for tags) (allows php code) Is possible to convert the Template.pm (see annexed file) by Gossamer to php class ??? It probably is, if anyone wants to take a stab, but we generally just use the method I described above. -- 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]
RE: [PHP] Templates PHP
try these: search google for fast templates templates, check out sourceforge.net there's a whole bunch of this applications. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Maamiin [mailto:[EMAIL PROTECTED]] Sent: Friday, February 23, 2001 4:06 AM To: PHP General Newslist Subject: [PHP] Templates PHP Where can I find some help, how to make use page templates on my webpages??? Needs this some add-ons to my PHP3(Linux-main)/PHP4(win98+pws)? THNX -- 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]
[PHP] Templates PHP
Where can I find some help, how to make use page templates on my webpages??? Needs this some add-ons to my PHP3(Linux-main)/PHP4(win98+pws)? THNX -- 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]
Re: [PHP] Templates
andrew wrote: Sure, My understanding of templating engines 1.array or item is assigned to a variable 2.php placeholders in a html page match in name to above variable. 3.a parser separate from php subsitutes the variable values set in (1) into (2) I've seen plenty of examples where there is a file containing lists of variable to item assignment, and thase files are passed to a one of a few template pages for layout. There must be a way to pass the result set of an SQL query into the set of placeholders - the end result would be that you could call whole sites via simple queries. All you have to pass in would be the SQL parameter. i.e. Table named 'Pvalues' Pvalues Sample Row -- page_id contactus.html page_name Contact Us page_title Contact US header_text Please send an email body_text [EMAIL PROTECTED] footer_text thanks! Check out http://www.scripps.edu/~jesusmc/cachedtpl/CachedTemplate.html by Jesus M Castagnetto. His class solves the problem with caching templates for all the template classes he has found. One of those he found was a class called XTemplates, that class have some very good functions, you could write this in your templae page: {Pvalues.page_id} and in the php page you could assign the result set directly to Pvalues, and all items called Pvalues.something would be filled out with the column of the same name. The only drawback of XTemplates is that it adds some extra spaces to the output, which on large pages might amount to quite a bit, but since you're complentating working something like this out, you might instead rewrite this class to remove that bit of a problem. (I haven't had the time to track the bug down myself.) Some timings I've made have shown that XTemplates on a large result set seems to be only 10% slower than the templates which comes with PHPLib, which is pretty good. Finally it is much easier to use and initalize than any template engine I've tried. -- Paul K Egell-Johnsen Developer/PR Manager zez.org: about code http://zez.org/ -- 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]
Re: [PHP] Templates
Not too similar to the caching issue of template output - I maybe missing something, but at least in our case, *every* page made with templates has custom info re: the client (name, etc) which can't, imo, be cached, unless we started caching multiple bits of the templates then assembling them - potentially lots more disk access than we'd want. We *do* cache query results for queries that we know will have similar results for a long time ('customers not on credit hold' for example - for one client in particular the results of this query would only change daily, as they only updated 'credit hold' info daily, so we cache this for a few hours, saving db hits). andrew wrote: Yup, I believe so - I've been wrestling with this idea for a while and trying to figure out how to integrate it into the parser explained in a PHPBuilder Article on Cached Modules: http://www.phpbuilder.net/columns/jprins2201.php3 In the above, I think the point is to create little block templates on a page, that can essentially return html. Now, the article mostly covers how to cache this for peformance reasons, but integrating FastTemplates with it in the manner below makes sense. Are you doing something similar? regards, andrew -- 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]
Re: [PHP] Templates
well, I suppose it could, but it's pretty weird... why would you want to directly hook up presentation w/sql queries ? :) -a -- Alex Black, Head Monkey [EMAIL PROTECTED] The Turing Studio, Inc. http://www.turingstudio.com vox+510.666.0074 fax+510.666.0093 Saul Zaentz Film Center 2600 Tenth St Suite 433 Berkeley, CA 94710-2522 From: [EMAIL PROTECTED] (andrew) Newsgroups: php.general Date: 13 Jan 2001 17:06:48 -0800 Subject: Re: [PHP] Templates Sure, My understanding of templating engines 1.array or item is assigned to a variable 2.php placeholders in a html page match in name to above variable. 3.a parser separate from php subsitutes the variable values set in (1) into (2) I've seen plenty of examples where there is a file containing lists of variable to item assignment, and thase files are passed to a one of a few template pages for layout. There must be a way to pass the result set of an SQL query into the set of placeholders - the end result would be that you could call whole sites via simple queries. All you have to pass in would be the SQL parameter. i.e. Table named 'Pvalues' Pvalues Sample Row -- page_id contactus.html page_name Contact Us page_title Contact US header_text Please send an email body_text [EMAIL PROTECTED] footer_text thanks! You can even generate a list of links dynamically for nav bar via: "select page_name, page_id from Pvalues", if you account for performance issues. If the usre clicks on the "contact us" link, it returns a page_id value of contactus.html. So then: "select * from Pvalues where page_id = "contactus.html" Then call a templating parser and pass it the values of the select statement and which template to use. Can this be done, or I am way off base on this? regards, andrew On 1/13/01 7:27 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: I thought I understood your question, but I think I need a clarification. Can you elaborate a bit? I think I have an answer, but I'm not 100% what you're meaning here. Thanks. andrew wrote: Michael, Wouldn't a benefit be that you could pass a database query in via that variable, either via form submit or value of a clicked link? I know PHP can do this without a separate templating engine, but if you do use one then you can submit an array to a specific template. Is there a way to do this via built in functions without constructing the set of page object's first, or can you only do this in templates? regards, andrew On 1/13/01 7:06 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I looked around the web for templates and founf FastTemplates. Not exactly what i was looking for thoug lets say I have $file = "111" and there is a template "template.txt" and it contains "file #$file is blahlah" how can I make that a template? Thanks - Peter Any reason 'template.txt' couldn't just say file $?=$file;? is blahlah then include('template.txt'); in your main file? Not sure why you'd want to complicate things with something like FastTemplates - I understand it has a use and purpose, but the only long term benefit I see from involved schemes like that won't be realized anyway (discussion for another day). -- 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]
Re: [PHP] Templates
Michael, Wouldn't a benefit be that you could pass a database query in via that variable, either via form submit or value of a clicked link? I know PHP can do this without a separate templating engine, but if you do use one then you can submit an array to a specific template. Is there a way to do this via built in functions without constructing the set of page object's first, or can you only do this in templates? regards, andrew On 1/13/01 7:06 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I looked around the web for templates and founf FastTemplates. Not exactly what i was looking for thoug lets say I have $file = "111" and there is a template "template.txt" and it contains "file #$file is blahlah" how can I make that a template? Thanks - Peter Any reason 'template.txt' couldn't just say file $?=$file;? is blahlah then include('template.txt'); in your main file? Not sure why you'd want to complicate things with something like FastTemplates - I understand it has a use and purpose, but the only long term benefit I see from involved schemes like that won't be realized anyway (discussion for another day). -- 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]
Re: [PHP] Templates
I thought I understood your question, but I think I need a clarification. Can you elaborate a bit? I think I have an answer, but I'm not 100% what you're meaning here. Thanks. andrew wrote: Michael, Wouldn't a benefit be that you could pass a database query in via that variable, either via form submit or value of a clicked link? I know PHP can do this without a separate templating engine, but if you do use one then you can submit an array to a specific template. Is there a way to do this via built in functions without constructing the set of page object's first, or can you only do this in templates? regards, andrew On 1/13/01 7:06 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I looked around the web for templates and founf FastTemplates. Not exactly what i was looking for thoug lets say I have $file = "111" and there is a template "template.txt" and it contains "file #$file is blahlah" how can I make that a template? Thanks - Peter Any reason 'template.txt' couldn't just say file $?=$file;? is blahlah then include('template.txt'); in your main file? Not sure why you'd want to complicate things with something like FastTemplates - I understand it has a use and purpose, but the only long term benefit I see from involved schemes like that won't be realized anyway (discussion for another day). -- 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]
Re: [PHP] Templates
Sure, My understanding of templating engines 1.array or item is assigned to a variable 2.php placeholders in a html page match in name to above variable. 3.a parser separate from php subsitutes the variable values set in (1) into (2) I've seen plenty of examples where there is a file containing lists of variable to item assignment, and thase files are passed to a one of a few template pages for layout. There must be a way to pass the result set of an SQL query into the set of placeholders - the end result would be that you could call whole sites via simple queries. All you have to pass in would be the SQL parameter. i.e. Table named 'Pvalues' Pvalues Sample Row -- page_id contactus.html page_name Contact Us page_title Contact US header_text Please send an email body_text [EMAIL PROTECTED] footer_text thanks! You can even generate a list of links dynamically for nav bar via: "select page_name, page_id from Pvalues", if you account for performance issues. If the usre clicks on the "contact us" link, it returns a page_id value of contactus.html. So then: "select * from Pvalues where page_id = "contactus.html" Then call a templating parser and pass it the values of the select statement and which template to use. Can this be done, or I am way off base on this? regards, andrew On 1/13/01 7:27 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: I thought I understood your question, but I think I need a clarification. Can you elaborate a bit? I think I have an answer, but I'm not 100% what you're meaning here. Thanks. andrew wrote: Michael, Wouldn't a benefit be that you could pass a database query in via that variable, either via form submit or value of a clicked link? I know PHP can do this without a separate templating engine, but if you do use one then you can submit an array to a specific template. Is there a way to do this via built in functions without constructing the set of page object's first, or can you only do this in templates? regards, andrew On 1/13/01 7:06 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I looked around the web for templates and founf FastTemplates. Not exactly what i was looking for thoug lets say I have $file = "111" and there is a template "template.txt" and it contains "file #$file is blahlah" how can I make that a template? Thanks - Peter Any reason 'template.txt' couldn't just say file $?=$file;? is blahlah then include('template.txt'); in your main file? Not sure why you'd want to complicate things with something like FastTemplates - I understand it has a use and purpose, but the only long term benefit I see from involved schemes like that won't be realized anyway (discussion for another day). -- 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]
Re: [PHP] Templates
I'm sure it could be done, just with a bit of planning. The notion of passing in sql results is not foreign - we do it sometimes to our own 'templates', but our templates are generally just HTML with a bit of PHP in there, whereas the initial PHP page is PHP with a tiny bit of HTML. If there's a large result set that needs parsing through, we'll normally do it in the PHP code, and write the results out to a variable, substituted in the 'template'. You could instead have a 'template system' or php itself loop through that in the 'template' itself - whichever makes more sense to the end coders. I'd THINK you could do what you wanted with an array $sql = one row of SQL results, in a has. Passing $sql to the template, you could then have $sql["page_id"] $sql["page_name"] etc. Pulling stuff from the database drivers into an associate array would do this - is this what you're talking about? andrew wrote: Sure, My understanding of templating engines 1.array or item is assigned to a variable 2.php placeholders in a html page match in name to above variable. 3.a parser separate from php subsitutes the variable values set in (1) into (2) I've seen plenty of examples where there is a file containing lists of variable to item assignment, and thase files are passed to a one of a few template pages for layout. There must be a way to pass the result set of an SQL query into the set of placeholders - the end result would be that you could call whole sites via simple queries. All you have to pass in would be the SQL parameter. i.e. Table named 'Pvalues' Pvalues Sample Row -- page_id contactus.html page_name Contact Us page_title Contact US header_text Please send an email body_text [EMAIL PROTECTED] footer_text thanks! You can even generate a list of links dynamically for nav bar via: "select page_name, page_id from Pvalues", if you account for performance issues. If the usre clicks on the "contact us" link, it returns a page_id value of contactus.html. So then: "select * from Pvalues where page_id = "contactus.html" Then call a templating parser and pass it the values of the select statement and which template to use. Can this be done, or I am way off base on this? regards, andrew -- 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]
Re: [PHP] Templates
Yup, I believe so - I've been wrestling with this idea for a while and trying to figure out how to integrate it into the parser explained in a PHPBuilder Article on Cached Modules: http://www.phpbuilder.net/columns/jprins2201.php3 In the above, I think the point is to create little block templates on a page, that can essentially return html. Now, the article mostly covers how to cache this for peformance reasons, but integrating FastTemplates with it in the manner below makes sense. Are you doing something similar? regards, andrew On 1/13/01 8:37 PM, "Michael Kimsal" [EMAIL PROTECTED] wrote: I'm sure it could be done, just with a bit of planning. The notion of passing in sql results is not foreign - we do it sometimes to our own 'templates', but our templates are generally just HTML with a bit of PHP in there, whereas the initial PHP page is PHP with a tiny bit of HTML. If there's a large result set that needs parsing through, we'll normally do it in the PHP code, and write the results out to a variable, substituted in the 'template'. You could instead have a 'template system' or php itself loop through that in the 'template' itself - whichever makes more sense to the end coders. I'd THINK you could do what you wanted with an array $sql = one row of SQL results, in a has. Passing $sql to the template, you could then have $sql["page_id"] $sql["page_name"] etc. Pulling stuff from the database drivers into an associate array would do this - is this what you're talking about? andrew wrote: Sure, My understanding of templating engines 1.array or item is assigned to a variable 2.php placeholders in a html page match in name to above variable. 3.a parser separate from php subsitutes the variable values set in (1) into (2) I've seen plenty of examples where there is a file containing lists of variable to item assignment, and thase files are passed to a one of a few template pages for layout. There must be a way to pass the result set of an SQL query into the set of placeholders - the end result would be that you could call whole sites via simple queries. All you have to pass in would be the SQL parameter. i.e. Table named 'Pvalues' Pvalues Sample Row -- page_id contactus.html page_name Contact Us page_title Contact US header_text Please send an email body_text [EMAIL PROTECTED] footer_text thanks! You can even generate a list of links dynamically for nav bar via: "select page_name, page_id from Pvalues", if you account for performance issues. If the usre clicks on the "contact us" link, it returns a page_id value of contactus.html. So then: "select * from Pvalues where page_id = "contactus.html" Then call a templating parser and pass it the values of the select statement and which template to use. Can this be done, or I am way off base on this? regards, andrew -- 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] Templates
I looked around the web for templates and founf FastTemplates. Not exactly what i was looking for thoug lets say I have $file = "111" and there is a template "template.txt" and it contains "file #$file is blahlah" how can I make that a template? Thanks - Peter -- 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]