|
osdir.com mailing list archive F.A.Q. -since 2001! |
|
|
|
Subject: Re: dreamweaver templates - msg#00343List: php.pear.general
by Date: Prev Next Date Index by Thread: Prev Next Thread Index
It's not really PEAR, but if the template has a syntax like
<!-- InstanceBeginEditable name="title" --> ... <!-- InstanceEndEditable --> Then how about: <? $template = "template.dwt" ; $content = array( "title" => "Here's my title" , // etc ) ; $find = '/<\!-- InstanceBeginEditable name="([^"]+)" -->.*<\!-- InstanceEndEditable -->/iseU' ; $replace = '$content["\\1"]' ; $in = join('', file($template)) ; $out = preg_replace($find, $replace, $in) ; print $out ; ?> Nick ----- Original Message ----- From: "Paul Wolstenholme" <wolstena@xxxxxx> To: "Ryan King" <RyanSKing@xxxxxxx> Cc: <pear-general@xxxxxxxxxxxxx> Sent: Wednesday, November 19, 2003 11:42 PM Subject: Re: [PEAR] dreamweaver templates > As far as I know, Dreamweaver templates are just regular html files > with special html comments that are used by Dreamweaver to determine > what areas are editable. PHP will more than likely just ignore these > comments. > /Paul > > On 19-Nov-03, at 3:12 PM, Ryan King wrote: > > > On Wednesday, November 19, 2003, at 02:56 PM, Paul M Jones wrote: > > > >> On Nov 19, 2003, at 2:02 PM, Ryan King wrote: > >> > >>> Does anyone know of a php package that handles Dreamweaver > >>> templates? I'm working on a new project in which that functionality > >>> would be very useful. > >> > >> Whe you say "handles" Dreamweaver templates, what exactly do you > >> mean? (Some of us are still hand-coding vampires and shrink from the > >> bright light of WYSIWYG tools. ;-) > > > > To clarify some more... instead of using Smarty or php (as savant > > apparently does) for markup, I want to use the Dreamweaver style > > markup, have it parsed and used by php scripts. > > > > ryan > > > > ------------------- > > http://homepage.mac.com/ryansking/ > > > > -- > > PEAR General Mailing List (http://pear.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Thread at a glance:
Previous Message by Date:Re: dreamweaver templatesOn Wednesday, November 19, 2003, at 05:42 PM, Paul Wolstenholme wrote: As far as I know, Dreamweaver templates are just regular html files with special html comments that are used by Dreamweaver to determine what areas are editable. PHP will more than likely just ignore these comments. /Paul I know how they're set up. It would be possible to open one of these templates, use a some regex's to edit those editiable regions. I think it would be possible and I'm wondering if anyone has tried it. Here's a snippet of code: <!-- TemplateBeginEditable name="body" --> <p> blah </p><!-- TemplateEndEditable --> ryan king -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Next Message by Date:QFC - Register RuleHi, I'm doing something wrong here, I've just moved a multipage form into the QFC framework. I have a number of genericaly useful function for generating checkbox groups, radio buttons which like a good C programmer I put into a "misc.php" - a number of the checkboxes are for questions such as "choose a,b,c,d,other ) if other then it produces a text box for 'Explanation'. I have a validation function that checks for the "other" option and fails if there is a null value in the text box. // Start of sample code function getCheckBoxExplanationRule($elements,$explFlags) /* -------------------------------------------------------------------- getExplanation Function will test an array of elements to ensure that if an option requies an explanation (from the the Database) it has been entered. The logic for this is simply if an option is followed by a textbox/explanation field and is checked then if that text box is not entered the function returns false. -------------------------------------------------------------------- */ { foreach ($elements as $k=>$v) { $flag = $explFlags[$k]; if ($explFlags[$k] == 'Y') { if (!isset($elements['explFlag']) || ($elements['explFlag'] =="")) { return false; } } } return true; } function getRadioExplanationRule($elements,$explFlags) { foreach ($elements as $k=>$v) { if ($explFlags[$v] == 'Y') { if ((!isset($elements['explFlag'])) || ($elements['explFlag'] == "")) { return false; } } } return true; } // End of code I regisiter the function as follows in the original // more code <code> $this->inputForm->registerRule('checkBoxExpl','function','getCheckBoxExplanationRule','incidentReportForm'); $this->inputForm->registerRule('checkRadioExpl','function','getRadioExplanationRule','incidentReportForm'); $this->inputForm->addRule('incLocation','Please add explanation as required','checkRadioExpl',$this->getExplFlds($this->getReferences($db,'Location'))); // end of code </code> Now I want to call it from a page in qfc, I used the following // <code> require_once "misc.php"; class IncidentPage extends HTML_QuickForm_Page { function buildForm() { // blah - build fields $this->registerRule('checkBoxExpl','function','getCheckBoxExplanationRule'); $this->registerRule('checkRadioExpl','function','getRadioExplanationRule'); } } // </code> This is wrong because it never gets called - should I include all of these functions in a parent form and sub-class that into QFC? Or is it even easier? THanks for the great work on QFC, it is sinpirational. I look forward to working with you as I get this more under control, and hopefully will need services to build things over the next few years. hpfm Barry Steele hpfm solutions pty ltd mob: 0413947980 fax: 0299817727 mailto:: barry@xxxxxxxx -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Previous Message by Thread:Re: dreamweaver templatesOn Wednesday, November 19, 2003, at 05:42 PM, Paul Wolstenholme wrote: As far as I know, Dreamweaver templates are just regular html files with special html comments that are used by Dreamweaver to determine what areas are editable. PHP will more than likely just ignore these comments. /Paul I know how they're set up. It would be possible to open one of these templates, use a some regex's to edit those editiable regions. I think it would be possible and I'm wondering if anyone has tried it. Here's a snippet of code: <!-- TemplateBeginEditable name="body" --> <p> blah </p><!-- TemplateEndEditable --> ryan king -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Next Message by Thread:Re: dreamweaver templatesThis might work. I was hoping for more, but I see that I might have to create that "more" on my own. ryan On Wednesday, November 19, 2003, at 08:02 PM, Nick Nettleton wrote: It's not really PEAR, but if the template has a syntax like <!-- InstanceBeginEditable name="title" --> ... <!-- InstanceEndEditable --> Then how about: <? $template = "template.dwt" ; $content = array( "title" => "Here's my title" , // etc ) ; $find = '/<\!-- InstanceBeginEditable name="([^"]+)" -->.*<\!-- InstanceEndEditable -->/iseU' ; $replace = '$content["\\1"]' ; $in = join('', file($template)) ; $out = preg_replace($find, $replace, $in) ; print $out ; ?> Nick ----- Original Message ----- From: "Paul Wolstenholme" <wolstena@xxxxxx> To: "Ryan King" <RyanSKing@xxxxxxx> Cc: <pear-general@xxxxxxxxxxxxx> Sent: Wednesday, November 19, 2003 11:42 PM Subject: Re: [PEAR] dreamweaver templates As far as I know, Dreamweaver templates are just regular html files with special html comments that are used by Dreamweaver to determine what areas are editable. PHP will more than likely just ignore these comments. /Paul On 19-Nov-03, at 3:12 PM, Ryan King wrote: On Wednesday, November 19, 2003, at 02:56 PM, Paul M Jones wrote: On Nov 19, 2003, at 2:02 PM, Ryan King wrote: Does anyone know of a php package that handles Dreamweaver templates? I'm working on a new project in which that functionality would be very useful. Whe you say "handles" Dreamweaver templates, what exactly do you mean? (Some of us are still hand-coding vampires and shrink from the bright light of WYSIWYG tools. ;-) To clarify some more... instead of using Smarty or php (as savant apparently does) for markup, I want to use the Dreamweaver style markup, have it parsed and used by php scripts. ryan ------------------- http://homepage.mac.com/ryansking/ -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ------------------- http://homepage.mac.com/ryansking/ -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
blog comments powered by Disqus
|
|