Re: [PHPTAL] Escaping of dollar sign ($)
What about the html entity: #36; On 26/10/2009 23:10, Cameron Junge cameron.ju...@finda.co.nz wrote: Hi All, Not sure if this has been covered on this list before, my quick search couldn't find anything that seemed appropriate. If I wish to display a $ followed by a tal variable using the inline syntax (ie. ${variable}) then I have to either: a) put a space between the 2 $ signs; or b) use a tag to spit the variable out; or c) use a phptal_tales expression. Eg. if I have a variable amount with the value 100, and I want to display is as $100 then I either have to do: a) $ ${amount}; or b) $tal:block replace=amount /; or c) tal:block replace=money: amount / Various attempts at escaping have failed. $$${amount} comes out as $${amount}; $${amount} comes out as ${amount} I know that there are workarounds, but surely there must be some way to do what is relatively simple? or is this a bug? Cheers, Cameron. Notice This email and any attachments are strictly confidential and subject to copyright. They may contain privileged information. If you are not the intended recipient please delete the message and notify the sender. You should not read, copy, use, change, alter or disclose this email or its attachments without authorisation. The company and any related or associated companies do not accept any liability in connection with this email and any attachments including in connection with computer viruses, data corruption, delay, interruption, unauthorised access or unauthorised amendment. Any views expressed in this email and any attachments do not necessarily reflect the views of the company or the views of any of our related or associated companies. ___ 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] MPTT to recursive macro
Hi Guys, I have been experimenting with the Modified Pre-Order Tree Traversal Pattern, my test case code is returning the results as expected however I am having trouble with the metal macros to present it. The example I am using has 3 levels (but is potentially unlimited depth due to the MPTT pattern) and I am trying to port the example from the FAQ around it, here is an array representation of the returned database object: Array ( [0] = Array ( [CategoryID] = 1 [ParentID] = 0 [CategoryName] = Default Parent [lt] = 1 [rt] = 14 [tree_depth] = 1 ) [1] = Array ( [CategoryID] = 8 [ParentID] = 1 [CategoryName] = SysAdmin [lt] = 2 [rt] = 7 [tree_depth] = 2 ) [2] = Array ( [CategoryID] = 2 [ParentID] = 8 [CategoryName] = Linux [lt] = 3 [rt] = 4 [tree_depth] = 3 ) [3] = Array ( [CategoryID] = 3 [ParentID] = 8 [CategoryName] = Windows [lt] = 5 [rt] = 6 [tree_depth] = 3 ) [4] = Array ( [CategoryID] = 5 [ParentID] = 1 [CategoryName] = Code [lt] = 8 [rt] = 13 [tree_depth] = 2 ) [5] = Array ( [CategoryID] = 6 [ParentID] = 5 [CategoryName] = PHP [lt] = 9 [rt] = 10 [tree_depth] = 3 ) [6] = Array ( [CategoryID] = 7 [ParentID] = 5 [CategoryName] = Perl [lt] = 11 [rt] = 12 [tree_depth] = 3 ) ) The example which best sums up what I am trying to achieve with the resultset is: ul metal:define-macro=output_list tal:condition=list li tal:repeat=list_item list ${list_item/CategoryName} tal:block tal:define=list list_item/sublist metal:use-macro=output_list / /li /ul tal:block metal:use-macro=output_list / Obviously there is no sublist in the resultset so the example above is useless for this purpose, I have spent a few hours experimenting with php operator conditions trying to work around the lack of dimensions in the array but as yet have had nothing work, so I was wondering if anyone with a better idea of TAL can throw me some pointers of how I should approach this. Thanks in advance. Nick ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] MPTT to recursive macro
Thanks Kornel, that's the conclusion I came to, thought it was worth asking though! Regards, Nick From: Kornel Lesiński kor...@aardvarkmedia.co.uk Organization: Aardvark Media Limited Reply-To: Template Attribute Language for PHP phptal@lists.motion-twin.com Date: Mon, 22 Jun 2009 12:40:57 +0100 To: Template Attribute Language for PHP phptal@lists.motion-twin.com Subject: Re: [PHPTAL] MPTT to recursive macro On 22-06-2009 at 12:26:34 Nick Pack n...@carbidefinger.net wrote: I have been experimenting with the Modified Pre-Order Tree Traversal Pattern, my test case code is returning the results as expected however I am having trouble with the metal macros to present it. I think the easiest way is to write PHP function that converts this dataset into recursive structure. -- regards, Kornel ___ 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] Root node not finished.
Hi All, I just upgraded from PHPTAL 1.1.12 to 1.1.16, and a macro that I have been using suddenly stopped running with an exception: ParserException with message 'Finished document in unexpected state: root node is not finished' The macro is as follows: ul metal:define-macro=sitemaprecursive tal:condition=sitemapli tal:repeat=l sitemapa href=# tal:attributes=href l/Link${l/Title}/atal:block tal:condition=l/Pages tal:define=sitemap l/Pages metal:use-macro=sitemaprecursive //li /ul tal:block metal:use-macro=sitemaprecursive / A very similar macro using the exact same models works fine on the same site, but for some reason this one doesn¹t want to play ball, it was working fine until I upgraded to the latest stable, and works if I revert back, does anyone have any ideas? Working macro is: ul metal:define-macro=recursivelist tal:condition=menuli tal:repeat=l menua href=# tal:attributes=href l/Link${l/Title}/a tal:block tal:condition=l/Pages tal:define=menu l/Pages metal:use-macro=recursivelist //li /ul tal:block metal:use-macro=recursivelist / Thanks in advance. Nick Pack Technical Services Manager E: n...@carbidefinger.net DDI: 020 7193 4510 T: 0845 8128206 W: http://www.carbidefinger.net Please do not send support enquiries directly to my email address, please instead direct them to our automated tickets system at supp...@carbidefinger.net to enable faster handling of your queries. Company Details: Carbide-finger Limited, registered in England no.4388897. Registered office: Weir Cottage, 2 Laindon Rd, Billericay, Essex CM12 9LD Confidentiality: This e-mail and any attachments are intended for the addressee only and may be confidential. If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on its content is prohibited and may be unlawful. The views expressed in this message are those of the individual sender and do not necessarily represent the views of Carbide-Finger Limited. Security: This e-mail and any attachments are believed to be free from any virus but it is the responsibility of the recipient to ensure this is so. E-mail is not a 100% secure communications medium. We recommend you observe this when e-mailing us ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] tree in PHPTAL
Sorry to dig up an old thread guys, I've been attempting to use Kornel's code below but am getting an exception when there is not a third dimension array, for example: ul metal:define-macro=recursivelist tal:condition=menu li tal:repeat=l menu${l/Title} tal:block tal:condition=l/Pages tal:define=list l/Pages metal:use-macro=recursivelist / /li /ul tal:block metal:use-macro=recursivelist/ Using: $this-view-menu = array('Title'='Section 1', 'Pages'=array( array('Title'='postgresql'), array('Title' ='test2') ) ); Throws: 'PHPTAL_Exception' with message 'Unable to find part Pages in path Pages with base Section 1' Am I missing something obvious? Thanks, Nick On 04/12/2008 10:38, Kornel Lesiński kor...@aardvarkmedia.co.uk wrote: On 04-12-2008 at 09:34:03 a b admi...@gmail.com wrote: Below is a sample of how I store and display in PHP tree structure stored in the database. Can anybody tell me how to rewrite this code into PHPTAL? I assume, that I should use macro recurrency, but how to prepare array in such case? It would be best if you could turn it into a typical array of arrays (or nested objects): $t-list = array( array('name'='sql', 'items'=array( array('name'='postgresql', 'items'=array(...)), array('name'='oracle', 'items'=array(...)), )), ); and then use: ul metal:define-macro=recursivelist tal:condition=list li tal:repeat=l list${l/name} tal:block tal:define=list l/items metal:use-macro=recursivelist / /li /ul tal:block metal:use-macro=recursivelist/ ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
RE: [PHPTAL] tal:condition and element contents
Sorry ignore that, was me being retarded! It works if you use tal:omit-tag=not: isAdmin Thanks again -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Standbrook Sent: 29 February 2008 10:34 To: Template Attribute Language for PHP Subject: Re: [PHPTAL] tal:condition and element contents Try this, I assume omit takes an argument. form tal:omit=isAdmin h1 tal:content=thisTitleThe Title/h1 input type=text name=field tal:attributes=value field / /form Richard Standbrook --- Senior Web Services Developer [EMAIL PROTECTED] Registration no: 03160139 Litton House, Saville Road, Westwood, Peterborough, England, PE3 7PR NOTICE: The information contained in this email and any attachments is confidential and may be privileged. If you are not the intended recipient you should not use, disclose, distribute or copy any of the content of it or of any attachment; you are requested to notify the sender immediately of your receipt of the email and then to delete it and any attachments from your system. On 29 Feb 2008, at 10:21, Nick Pack wrote: For my current project, I have the need to display a form tag around some elements if a condition is met, but maintaining the contents of the element regardless of the condition. For example: form tal:condition=isAdmin h1 tal:content=thisTitleThe Title/h1 input type=text name=field tal:attributes=value field / /form Is there a way that I can specify a parameter so that the elements inside the form can still be shown but omit the form tag, so that if condition isAdmin is not met, the above output will display as: h1 tal:content=thisTitleThe Title/h1 input type=text name=field tal:attributes=value field / Thanks in advance. ___ 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] RSS Feed link attribute
I've built a template/associated code for generating an RSS feed from a recordset, im having some trouble with the link attribute and I wondered if anyone could shed some light on a workaround. In my template I have tried both: linkspan tal:content=article/articlelink tal:omit-tag=http://www.carbidefinger.net//span/link http://www.carbidefinger.net/%3c/span%3e%3c/link link tal:content=article/articlelinkhttp://www.carbidefinger.net/link http://www.carbidefinger.net%3c/link Both methods result in the following output after the template is parsed (The dataset definitely contains article/articelink as the same function is used with a different template for xhtml output): link/ For an RSS feed to be valid, it must have both link and /link so using tal:attributes is a no go. Does anyone have a workaround for this? Or am I better off coding something else to build the RSS structure? The project is heavily based on PHPTAL so it would be nice to use it for everywhere that repeatable regions are needed. Thanks in advance ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal