Actions
Feature #103810
closedadd a general viewhelper which allow you to use nearly all php-function for manipulating strings in fluid
Start date:
2024-05-09
Due date:
% Done:
0%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
A viewhelper should allow to manipulate strings in a simple way to other 'formats'.
- I often needs a explode-viewhelper, which convert a comma-separated list into an array.
- I need sometimes a viewhelper which could convert a string to a string in lower case.
- ...
I wrote the viewhelper `convert`. The viewhelper allows the integrator, to use at least nearly any of the powerful php function for string-manipulation.
The behavior is a combination of <f:alias> and <f:variable>. It depends on the way how you define the string which should be manipulated.
Example:
<!-- stores the result of the complex php-function explode($limiter,$string, $limit) in a global fluid-variable -->
<f:convert phpfunc="explode" value="php,javascript,java,c++,ada,prolog,lisp,fortran," prev="{0:','} post="{0:3}" as="langList" />
<f:for each="{langList}" as="progLanguage">
<div>{progLanguage}</div>
<f:for>
<!-- output:
<div>php</div>
<div>javascript</div>
<div>java,c++,ada,prolog,lisp,fortran,</div>
-->
<!-- defines the result of the complex php-function explode($limiter,$string, $limit) only for the nested html via 'local="1"' -->
<f:convert phpfunc="explode" value="php,javascript,java,c++,ada,prolog,lisp,fortran," prev="{0:','} post="{0:3}" as="langList" local="1" >
<f:for each="{langList}" as="progLanguage">
<div>{progLanguage}</div>
<f:for>
</f:convert>
<!-- output:
<div>php</div>
<div>javascript</div>
<div>java,c++,ada,prolog,lisp,fortran,</div>
-->
Files
Actions