[PHPTAL] Need confirmation about the pipe syntax inside tal:attributes
Hi everybody, I use this syntax : input name=firstname value= tal:attributes=value firstname| / Note the pipe character at the end of the expression. So, if the firstname value exists, this show it and if the value is not set, this return an empty string. It's perfect for me, but I just want to be sure if this syntax is good and will not be deprecated in future. Thanks ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Need confirmation about the pipe syntax inside tal:attributes
I was well adviced to ask ! ;-) Thanks Iván, Kornel, Levi Christoph for your explanations ! Le vendredi 07 août 2009 à 15:47 +0200, Christoph Frick a écrit : On Fri, Aug 07, 2009 at 03:32:43PM +0200, Guillaume Lecanu wrote: input name=firstname value= tal:attributes=value firstname| / i usually use input name=firstname value= tal:attributes=value firstname|default / this uses the value from the value-attribute. the suggested nothing of course is fine too. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] What is the better way for Radio Button default value ?
Hi again, I have in my form a field civility like that : labelCivility/label ul li input type=radio name=civility value=Miss id=civility-miss / label for=civility-missMiss/label /li li input type=radio name=civility value=Ms id=civility-ms / label for=civility-msMs/label /li li input type=radio name=civility value=Mr id=civility-mr / label for=civility-mrMr/label /li /ul If the form is submitted with errors, I need to pre-fill the civility field with the previous selected value. I give the $_POST array to PHPTAL like that : $tpl-set('P', $_POST), so I can access to this value by P/civility What is the best way to have no radio-buttons selected if P/civility doesn't exist, and to have the good radio-button selected dependant of the value found into P/civility ? Thanks in advance for your help ! ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] Custom modifiers
Hi, There is a solution inside the function of the custom modifier to get the default text that will be replaced ? For example, in : span tal:content=mymodifier: newText class=importantHello World/span Inside my phptal_tales_mymodifier() function, I want to get Hello World. Another example : img src=# title=Hello World tal:attributes=title mymodifier: newText / I want to get Hello World. Thanks for your help ! ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Validation of XHTML - Solution
Le dimanche 17 mai 2009 à 20:32 +0800, Tjerk Meesters a écrit : It would be much easier if you could just add tal: and metal: inside the %coreattrs definition ;-) Hi everybody, With the help of Tjerk Chris, I have created a XHTML STRICT 1.0 custom DTD for PHPTAL. I have attached it to this email. This will recognize all of the PHPTAL attributes in every XHTML tags. You can uses this DOCTYPE in your PHPTAL templates : !DOCTYPE html SYSTEM http://www.your-internet-web-site.com/path-to-your-dtd/xhtml1-strict-phptal.dtd; And of course, replace it by the good one at the fly for your final XHTML code. Hope this will help. xhtml1-strict-phptal.dtd Description: application/xml-dtd ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Validation of XHTML - Solution
Le lundi 18 mai 2009 à 16:05 +0800, Tjerk Meesters a écrit : That's awesome :-) A few more pointers: 1) it might be somewhat nicer to place phptal attributes in their own group: !ENTITY % phptalattrs tal:define %Text; #IMPLIED tal:condition %Text; #IMPLIED ... tal:block %Text; #IMPLIED ... !ENTITY % attrs %coreattrs; %i18n; %events; %phptalattrs; Fixed 2) add tal:block block element definitions (the gotcha here is that inside tal:block you can also use stripped attributes, such as condition or fill-slot without the tal: prefix I have no knowledges in DTD specifications, how can we said the tal:block is available anywhere in the code ? In XHTML, there is block and inline elements, where inline can't have nested block element. We need to autorise it everywhere, even in the head section. For the stripped tags, I suppose we can create a similar ENTITY % phptalstrippedattrs for this tal:block Your help for theses point will be appreciate ! :-) 3) same for metal:block i guess? ;-) What is metal:block ? I don't see it in the manual... ? You would mean there is also i18n:block and phptal:block ? Best, Tjerk On Mon, May 18, 2009 at 3:12 PM, Guillaume Lecanu guilla...@lya.fr wrote: Le dimanche 17 mai 2009 à 20:32 +0800, Tjerk Meesters a écrit : It would be much easier if you could just add tal: and metal: inside the %coreattrs definition ;-) Hi everybody, With the help of Tjerk Chris, I have created a XHTML STRICT 1.0 custom DTD for PHPTAL. I have attached it to this email. This will recognize all of the PHPTAL attributes in every XHTML tags. You can uses this DOCTYPE in your PHPTAL templates : !DOCTYPE html SYSTEM http://www.your-internet-web-site.com/path-to-your-dtd/xhtml1-strict-phptal.dtd; And of course, replace it by the good one at the fly for your final XHTML code. Hope this will help. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal -- noovea Lecanu Guillaume Directeur Général Tél. : 01.76.23.00.12 GSM : 06.27.46.36.04 Fax : 05.47.29.57.98 ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Validation of XHTML - Solution
Le lundi 18 mai 2009 à 09:57 +0100, Kornel Lesiński a écrit : On 18-05-2009 at 09:23:24 Guillaume Lecanu guilla...@lya.fr wrote: I have no knowledges in DTD specifications, how can we said the tal:block is available anywhere in the code ? I'm afraid that DTD isn't able to express it (doesn't have what HTML5 calls transparent content model). In terms of DTD, *:block elements are closest to HTML's ins and del - they can be used in both block and inline context and need to be allowed to contain anything. 3) same for metal:block i guess? ;-) What is metal:block ? I don't see it in the manual... ? You would mean there is also i18n:block and phptal:block ? Yes. Hi again, Here is the final XHTML STRICT custom DTD for PHPTAL. I have added the tal:block metal:block i18n:block phptal:block with the full attributes and their stripped attributes version. Like advised by Tjerk, I have also separated the %coreattrs from the % phptalattrs. Thanks all for your help, I think we have the final DTD now ! :-) PS for Kornel: Still no private emails received from you, I have explicitly white-listed your email, you can try to re-sent to guilla...@lya.fr, thanks ! xhtml1-strict-phptal.dtd Description: application/xml-dtd ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Validation of XHTML - Solution
Le lundi 18 mai 2009 à 11:22 +0100, Kornel Lesinski a écrit : On 18 May 2009, at 11:05, Guillaume Lecanu wrote: Here is the final XHTML STRICT custom DTD for PHPTAL. Nothing is ever final :) You right ! But I think it's already better and usable than before ;-) You can probably trim it down significantly by only overriding values in XHTML DTD, and including XHTML DTD as an entity. Here's an example that adds Safari's input type=search to XHTML/1.0: !ENTITY % InputType (text | password | checkbox | radio | submit | reset | file | hidden | image | button | search) !ENTITY % XHTML10Strict PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; %XHTML10Strict; !ATTLIST input autosaveNMTOKEN #IMPLIED results CDATA #IMPLIED incremental (incremental) #IMPLIED As you see the trick is that some things have to be defined before including XHTML DTD, and some after. I'm not sure if you won't run into some chicken-egg problem though. humm I'm not sure to understood how to do this, but there is something wrong with my last version ? Because if it's only a problem of size of the DTD, it's really not a problem for me, because the DTD is only for the developers tests, in production the real DTD will be the XHTML STRICT version... But if someone want to create a better version, let's go ! :-) ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] phptal:debug doesn't works ?
Hi, When there is an error into my code, the error reported by PHPTAL is not really precise. I'm searching a way to tell me which line in my original template file the error is found. I have tried to put phptal:debug in some of XHTML tags but I don't see any differences. There is a solution for that ? Thanks again. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] phptal:debug doesn't works ? [not ok with macros ?]
Le mardi 14 octobre 2008 à 13:55 +0200, Guillaume Lecanu a écrit : Le mardi 14 octobre 2008 à 12:32 +0100, Kornel Lesiński a écrit : On 14-10-2008 at 12:01:27 Guillaume Lecanu [EMAIL PROTECTED] wrote: When there is an error into my code, the error reported by PHPTAL is not really precise. I'm searching a way to tell me which line in my original template file the error is found. What error are you getting? Oh I have just see the differences ! The line in the template is reported with phptal:debug=, it's exactly what I want :-) Thanks again ! Argh, just tried with macros, and this doesn't report the good line. Technically, I have a /templates/template.html with some of global parts common to every page. Into this template.html, there : div id=content metal:use-macro=$template_file/content/div All others html pages have a macro named content, called by the template.html. The line error reported by phptal:debug is good if the error is into template.html But, if the error is into the macro of another file, this go at the wrong line of the html file. There is a trick to have the good line ? I have tried to put phptal:debug in some of XHTML tags but I don't see any differences. There is a solution for that ? Put phptal:debug on html element (or the outermost element in your template). If you have syntax error in php: expression, then unfortunately PHPTAL won't be able to tell you original line number - you'll have to open file reported by PHP (/tmp/tpl_123...php) and try to make sense of it. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] How to disable autoquote ?
Le mardi 14 octobre 2008 à 09:55 +0100, Kornel Lesiński a écrit : On 13-10-2008 at 21:22:26 Iván -DrSlump- Montes [EMAIL PROTECTED] wrote: prefix the content with the 'structure' keyword, it will use the value verbatin. script tal:content=structure myJsCode/script This may make XHTML ill-formed if there's any or in the script. script/*![CDATA[*/ ${structure myJSCode} /*]]*//script works in both text/html and application/xhtml+xml modes. Great, thanks Kornel ! ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] How to disable autoquote ?
Hi, I want to write a dynamic JS content into the script/scriptbalise. A simple : alert(Hello World) But the problem is PHPTAL replace all quotes (simple or double quote) by HTML entities. How can I do ? Thanks ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] How to disable autoquote ?
Le lundi 13 octobre 2008 à 22:22 +0200, Iván -DrSlump- Montes a écrit : prefix the content with the 'structure' keyword, it will use the value verbatin. script tal:content=structure myJsCode/script This working fine, thanks you for this very quick reply ! ciao, /imv On Mon, Oct 13, 2008 at 10:13 PM, Guillaume Lecanu [EMAIL PROTECTED] wrote: Hi, I want to write a dynamic JS content into the script/scriptbalise. A simple : alert(Hello World) But the problem is PHPTAL replace all quotes (simple or double quote) by HTML entities. How can I do ? Thanks ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Preloading a macros file ?
Le vendredi 10 octobre 2008 à 10:39 +0100, Kornel Lesiński a écrit : On 10-10-2008 at 10:25:36 Guillaume Lecanu [EMAIL PROTECTED] wrote: I have a file macros.html with all my macros for our website. But this is really annoying to call each macros like this : metal:use-macro=../../macros.html/name_of_my_macro There is a solution to force to load macros.html and to call the macro everywhere like this : metal:use-macro=name_of_my_macro ? This is possible: $phptal-m = '../../macros.html/'; metal:use-macro=${m}name_of_my_macro Hi Kornel, Thanks for this trick, I'll uses it if there is really not other way. Do you think it's possible to patch PHPTAL to force to read the file(s) of our choices ? If PHPTAL read it, I suppose all readed macros will be saved in memory, and so we should uses it everywhere without the need of ${m}; Thanks for your help ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Preloading a macros file ?
Le vendredi 10 octobre 2008 à 16:05 +0100, Kornel Lesiński a écrit : On 10-10-2008 at 15:46:10 Guillaume Lecanu [EMAIL PROTECTED] wrote: If PHPTAL read it, I suppose all readed macros will be saved in memory, and so we should uses it everywhere without the need of ${m}; You could try to hack PHPTAL::executeMacro() function - get base function name that your macro template file uses (the same way that executeMacro) does it), store it somewhere, and then when local macro is executed, and local function doesn't exist, instead of throwing an exception, retry with another function name. I've made some changes to this function today, so use SVN version of PHPTAL. Ok, thanks for your help. I'll try to see what I can do. Have a good we. ++ ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Best way to make a list of list
Hi, I have just tried your example. Here is my list attached to PHPTAL : $tpl-set('listmenu', array( array('title' = 'First', 'submenu' = null), array('title' = 'Second', 'submenu' = array( array('title' = 'Youp', 'submenu' = null), )), array('title' = 'Third', 'submenu' = null), )); If I try to show the first level menus (first, second, third) this works fine with this code : tal:block tal:repeat=item listmenu lia href=# tal:replace=item/titleTitle/a/li /tal:block But if I try your example (I have adapted a little bit) this doesn't works : ul metal:define-macro=makemenu tal:condition=listmenu li tal:repeat=item listmenu a href=# tal:replace=item/titleTitle/a tal:block metal:use-macro=makemenu tal:define=listmenu item/submenu / /li /ul Any ideas ? Thanks a lots. Le vendredi 08 août 2008 à 22:46 +0200, Guillaume Lecanu a écrit : Le vendredi 08 août 2008 à 17:24 +0100, Kornel Lesiński a écrit : On 08-08-2008 at 17:18:31 Guillaume Lecanu [EMAIL PROTECTED] wrote: But all the structure is stored in DB, so I don't know in advance if one menu have 1, 2, or 10 childrens, and I don't know if a children is a submenu. I know how to do that in PHP without PHPTAL, but how is it possible to do that kind of XHTML code with PHPTAL ? Of course. You can use macros called recursively: ul metal:define-macro=list tal:condition=list li tal:repeat=item list... tal:block metal:use-macro=list tal:define=list item/sublist / /li /ul Interresting, I'll try this. Thanks Kornel Iván ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Lower than as char in javascript
Le jeudi 29 mai 2008 à 22:55 +0200, Christian Welzel a écrit : Hi there, is there a way to insert a lower than in phptal, which is printed as lower than in the source code? My problem: i have a javascript part in my template where i need a lower than in some cases ... ( if(foo 0) { do(); } ) I could not find a simple way to add this to the code. The only way i found is this: if( foo span tal:replace=structure lessthen / 0) { do(); } and define lessthan = '' in my phpcode. Hi, Is your JavaScript is between a CDATA block ? script type=text/javascript // ![CDATA[ (your JavaScript here) // ]] /script And it's also a good idea to put JS code in an external file like that : script type=text/javascript src=code.js/script ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] automated documentation for templates?
Le jeudi 29 mai 2008 à 22:14 +0200, Iván -DrSlump- Montes a écrit : NaturalDocs [1] is a very flexible documentation system which can be configured to suit almost any language [2]. The documentation could look something like this: !-- Iterable: options Members: label - The option label selected - Is the option selected? value - The option value -- div tal:repeat=option options /div [1] http://www.naturaldocs.org [2] http://www.naturaldocs.org/customizinglanguages.html The idea of Jason is very good. Iván, NaturalDocs could be an idea, but only if PHPTAL can remove theses HTML comments. This could be problematics if theses comments are show in the final HTML source. On Thu, May 29, 2008 at 9:54 PM, Anton Andrievskij [EMAIL PROTECTED] wrote: Hi, Jason. I think your idea is useful and we it need be realized. What other people think? Anton On Thu, May 29, 2008 at 10:25 PM, Jason - USL [EMAIL PROTECTED] wrote: Hi, everybody. I'm wondering if anybody's created or thought about a system for documenting the PHPTAL templates themselves. It seems to me that, for a project of any size, it would be ideal if each template could be processed by a documentation engine that tells the developers which variables/objects/arrays need to be passed into the template and how they're used. For example, if my template designer creates something like tal:repeat=option options, my php developer would see a corresponding line in the documentation saying that the variable 'options' needs to be set, and it needs to implement the iterable interface... I though maybe it could be achieved by hacking together some custom objects to use in place of the standard PHPTAL_Php_CodeGenerator and PHPTAL_Php_CodeWriter to generate documentation instead of compiled template files. After getting into the code, though, it looks like a bigger project than I'd thought. So, I was wondering if anybody on the list has done something like this, or has better ideas for communicating and documenting the templates' functions. Thanks for any advice you can give, Jason ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] XMLNS DTD
Hi, When I try to check my template page in W3C validator, this report some errors because of xmlns like metal, tal and i18n. There is surely a xmlns:metal, xmlns:tal xmlns:i18n attributes to put in the html tag but I don't find the good URL of the DTD. Can you give me the correct URL of DTD's ? Thanks ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] XMLNS DTD
Oups, sorry for my last email. It's an error ! Le mercredi 23 avril 2008 à 16:20 +0200, Guillaume Lecanu a écrit : Hi, Le mercredi 23 avril 2008 à 12:23 +0200, Krzysztof Sikorski a écrit : xmlns:tal=http://xml.zope.org/namespaces/tal; xmlns:metal=http://xml.zope.org/namespaces/metal; Thanks but theses URL go on an 404 Error page, it's may be what's excepted, I don't know. I found those two somewhere on the Zope's site. I can't help you with i10n as I don't use that namespace, but I guess the url is similar. Besides, if you just want the validator to shut up, than probably any url will do, or maybe even an empty attribute (xmlns:i10n=). If I put them in my html tag, the w3c validator continue to show the errors. It's strange, there is surely a trick to have a valid XHTML page with metal/tal/i18n namespaces.. On Wed, Apr 23, 2008 at 9:28 AM, Guillaume Lecanu [EMAIL PROTECTED] wrote: Hi, When I try to check my template page in W3C validator, this report some errors because of xmlns like metal, tal and i18n. There is surely a xmlns:metal, xmlns:tal xmlns:i18n attributes to put in the html tag but I don't find the good URL of the DTD. Can you give me the correct URL of DTD's ? Thanks ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal -- noovea Lecanu Guillaume Directeur Général Tél. : 01.76.23.00.12 GSM : 06.27.46.36.04 Fax : 03.20.32.37.48 ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] PHPTAL_TranslationService questions
Hi, Thanks for this project, this seems very interesting. I'm trying to adapt my framework to uses your templates engine with my translations text system. But I have some problems to adapt it like I want to uses it. Some translations have arguments, and so the syntax I want to have is this one : span i18n:translate=welcome $user/name $nbNewMessagesWelcome John Doe, you have 3 messages !/span 'welcome' is the key of my translations hashtable. $user/name is the 1st argument required for this translation $nbNewMessage is the 2nd argument required for this translation. But the translate($key) function receive only one argument. There is a way to permit to receive others arguments ? Another question, is it possible to retrieve the current sample texte found in the template (Welcome John Doe ... ) ? This will be very helpful in my case. And a last question, how can we translate an attribute ? For example I want to translate 'Send' : submit name=submit value=Send / Thanks a lots for your help ! ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal