[TYPO3-mvc] FLUID Core ViewHelper format.padding - extended version
Frank Mey - NEW.EGO
mey_mailings at newego.de
Mon Jul 18 15:53:23 CEST 2011
Hi,
I wondered why the standard view helper format.padding doesn't support the
last str_pad parameter pad_type.
So I added some code to the basic viewhelper class PaddingViewHelper.php:
class Tx_Fluid_ViewHelpers_Format_PaddingViewHelper extends
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* Format the arguments with the given printf format string.
*
* @param integer $padLength Length of the resulting string. If the
value of pad_length is negative or less than the length of the input string,
no padding takes place.
* @param string $padString The padding string
* @param integer $padType
* @return string The formatted value
* @author Bastian Waidelich <bastian at typo3.org>
* @api
*/
public function render($padLength, $padString = ' ', $padType=
STR_PAD_RIGHT) {
$string = $this->renderChildren();
return str_pad($string, $padLength, $padString, $padType );
}
}
Works fine in my installations - any reason why that parameter wasn't
implemented in the Fluid sysext ?
Thx 4 info,
Frank Mey
> -----Original Message-----
> From: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-
> project-typo3v4mvc-bounces at lists.typo3.org] On Behalf Of Pankaj Lele
> Sent: Monday, July 18, 2011 1:57 PM
> To: typo3-project-typo3v4mvc at lists.typo3.org
> Subject: Re: [TYPO3-mvc] Fluid widgets
>
> Hello Bastian,
>
> >> This error goes off if I clear all FE cache and reload the page. Is
> >> there any fix for this?
> >
> > You reload the page that contains the widget?
>
> Yes. I figured out the pattern to reproduce the problem. If I keep
refreshing
> the page having the AJAX widget, the stack of widget contexts in the
session
> keep on increasing even if there is only 1 widget on the page. At the 4th
or
> 5th refresh I start getting the "No widget context was found.." error when
I
> press button to call the AJAX side. Then at next refresh the widget
contexts
> stack in the session is reset (just 1 widget context is seen).
>
> I observed that when I have a widget which has a argument of 1 domain
> object of some repository (<m:widget.abc foo="{bar}" />) the error is
> reproduced always. When I have a widget with argument of e.g. the
> QueryResult, no error. Is this something to do with some limitations of
PHP? I
> already tried setting PHP memory_limit to 512M but still same problem.
>
> Following are possible solutions but I need to know the best approach:
>
> 1. Fix Extbase or Fluid to empty the widgetContexts stack for every page
> load. I will try to submit a patch if this is a valid solution. (Long term
fix) 2.
> Avoid setting domain objects as widget arguments and send the QueryResult
> as it is done with widget.autocomplete (quick solution for now for me) 3.
Not
> use AJAX widget and use normal controller->action through own PAGE
> object. (Recommended?)
>
> I won't choose option #3 as in general I believe that Fluid AJAX widgets
is the
> standard way of dealing with AJAX requests as we get a special controller
and
> view for each widget and some sort of security with having the AJAX widget
> identifiers. Please correct me if this is wrong understanding.
>
> Thanks,
> Pankaj
>
> --
>
> With best regards,
> Pankaj Lele
> ---------------------------
>
> CTO & Executive Director
> Lelesys Infotech Pvt. Ltd.
> Pune/Goa, India
>
> Web: http://www.lelesys.com
>
> [Certified TYPO3 Integrator]
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
More information about the TYPO3-project-typo3v4mvc
mailing list