RE: [PHP] Is this doable?

From: Date: Fri, 24 May 2002 22:13:59 +0000
Subject: RE: [PHP] Is this doable?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99174@lists.php.net to get a copy of this message
Can PHP do that? Of course. Can it do it that easily right out of the box. No. Just like the RXML backend is already written that parses <accessed per="day" /> into the appropriate number, the backend would have to be written for PHP to do the same thing. You'd have to write a template engine, basically, that'll look for special tags and do the appropriate PHP functions when it encounters them. I think you'd be far better off learning PHP and just adapting an existing template engine to suit your needs. There are plenty of them out there. ---John Holmes... > -----Original Message----- > From: Sandman [mailto:mr@sandman.net] > Sent: Friday, May 24, 2002 4:36 PM > To: php-general@lists.php.net > Subject: [PHP] Is this doable? > > I am currently using Roxen and it's built-in pike-based markup language > RXML for my dynamic websites. PHP is naturally alot more flexible than > RXML, but there are some thing I -really- like about Roxen that I don't > know if I can have PHP replicate, please tell me if anything of the > following is doable (and preferably how): > > Tags. > I -really- like the fact that RXML comes with XML-like tags for it's > built-in features, like the tag "<accessed />", where I can do stuff like: > > <accessed per="day" /> visitors per day. > > This is naturally just an example, but the thing I like is how I don't > need > to escape from HTML syntax and into a programming language unless it's > neccesary for the built-in function. > > > My own tags. > In RXML, I can define my own tags, like this: > > <define tag="line"> > <table cellpadding="0" cellspacing="0" border="0"> > <tr> > <td bgcolor="#000000"><img src="space.gif" > width="1" height="1" /> > </tr> > </table> > </define> > > This way, everytime I use "<line />" in the page, it will exapnd to the > above, which very well could contain other RXML commands like SQL > connectivity and such. > > > My own containers. > In the same way, I can define containers, like: > > <define container="headline"> > <span class="headline"><contents /></span> > </define> > > And when I type "<headline>Hello</headline>" '<contents > />' is replaced > with "Hello", of course. > > > Now, what I would like is to mix regular PHP syntax with my made up tags. > Is there a way for me to have <foo /> parsed into a php-script in the > page? > Maybe something like this, in pseudo-code: > > > define_container("headline"){ > print "<span class=\"headline\">$_[0]</span>"; > } > > And so on... Do you understand what I am getting at? > Is there a parse-module for apache that I can have parse the HTML file > this > way and have it execute things it recognizes? > > > Oh, and another question, in perl there is the "print qq{Hello "Sandman"}; > function, where you can use '"' how much you like, I do really hate to > metaquote everything I do in PHP, so is there a similar function, and > preferably not the "print <<KEYWORD;" variant. > > Anyway, thanks in advance, or something :) > > -- > Sandman[.net] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#99174) next »