From robert at typo3.org Fri Apr 3 22:19:11 2009 From: robert at typo3.org (Robert Lemke) Date: Fri, 3 Apr 2009 22:19:11 +0200 Subject: [TYPO3-team-core-v5] FYI: New profiling tool by Facebook Message-ID: http://mirror.facebook.com/facebook/xhprof/ Cheers, robert -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: Signierter Teil der Nachricht Url : http://lists.netfielders.de/pipermail/typo3-team-core-v5/attachments/20090403/15aadcf2/attachment.pgp From bastian at typo3.org Sun Apr 5 19:02:07 2009 From: bastian at typo3.org (Bastian Waidelich) Date: Sun, 05 Apr 2009 19:02:07 +0200 Subject: [TYPO3-team-core-v5] RFC: TagBuilder Message-ID: Hi everybody, Whenever we need to create HTML (or XML) tags from PHP (e.g. in the tag-based view helpers for Fluid) we end up concatenating long strings like this: return 'renderTagAttributes() . '>' . $this->renderChildren() . ''; This is not very readable and very error-prone. I think, it would be nice, to have some kind of Tag-builder, so that you could write s.th. like:* $tag = new Tag('a'); $tag->addAttribute('href', $uri); $tag->addAttributes($this->tagAttributes()); $tag->setContent($this->renderChildren()); return $tag->render(); I think that could be a neat little class for TYPO3 v4 _and_ FLOW3. What do you think, Useful? Where to put this class and how to name it? All the best and have a great week! Bastian * In the case of Fluids tag-based View helpers the base class could even create the tag and you'd only need to write: $this->tag->addAttribute('href', $uri); From bastian at typo3.org Sun Apr 5 19:03:52 2009 From: bastian at typo3.org (Bastian Waidelich) Date: Sun, 05 Apr 2009 19:03:52 +0200 Subject: [TYPO3-team-core-v5] RFC: TagBuilder In-Reply-To: References: Message-ID: oops, didn't mean to post this to the core list. But as it is a public list, it won't get lost I guess.. Bastian From masi-no at spam-typo3.org Sun Apr 5 20:50:39 2009 From: masi-no at spam-typo3.org (Martin Kutschker) Date: Sun, 05 Apr 2009 20:50:39 +0200 Subject: [TYPO3-team-core-v5] RFC: TagBuilder In-Reply-To: References: Message-ID: Bastian Waidelich schrieb: > Hi everybody, > > Whenever we need to create HTML (or XML) tags from PHP (e.g. in the > tag-based view helpers for Fluid) we end up concatenating long strings > like this: > > return 'renderTagAttributes() . '>' . > $this->renderChildren() . ''; > > This is not very readable and very error-prone. > I think, it would be nice, to have some kind of Tag-builder, so that you > could write s.th. like:* > > $tag = new Tag('a'); > $tag->addAttribute('href', $uri); > $tag->addAttributes($this->tagAttributes()); > $tag->setContent($this->renderChildren()); > return $tag->render(); > > I think that could be a neat little class for TYPO3 v4 _and_ FLOW3. > What do you think, > Useful? Cumbersome. While I agree that long lists of tags with many attributes get tiresome written in the way you mentioned, I don't think you solve the problem with your solution. I cannot imagine that I would like to call 5 functions just to create a single tag. I know that in the TYPO3 world the double quote is shunned but I started to use double quotes strings and HEREDOC more frequently. If you you use the {$var} syntax with an editor that is able to hilight the variable parts of a string this is best in terms of readability. I'm sorry to say, but also in this respect I see no improvement by your suggestion. Masi From bastian at typo3.org Sun Apr 5 22:09:51 2009 From: bastian at typo3.org (Bastian Waidelich) Date: Sun, 05 Apr 2009 22:09:51 +0200 Subject: [TYPO3-team-core-v5] RFC: TagBuilder In-Reply-To: References: Message-ID: Martin Kutschker wrote: Hi Masi, > Cumbersome. I agree '' . $this->value . ''; or "{$this->value}" is nicer than $tag = new Tag('em', $this->value); // or rather some t3lib_div::makeInstanceClassName hassle $tag->render(); But I'm especially talking about more complex constructions that can't be put in one line. Like this one (taken from the select view helper): $out = '