Project

General

Profile

Actions

Feature #103810

closed

add a general viewhelper which allow you to use nearly all php-function for manipulating strings in fluid

Added by Dieter Porth 2 months ago. Updated about 1 month ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
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

ConvertViewHelper.php (11.2 KB) ConvertViewHelper.php Dieter Porth, 2024-05-09 16:21
Actions #1

Updated by Georg Ringer about 1 month ago

  • Status changed from New to Rejected

Hey Dieter,

thanks for creating this issue! I am rejecting this feature request for the following reasons:

feel free to contact me via slack if you want to discuss the current viewhelper and their limitations.

Actions

Also available in: Atom PDF