Custom PHP function

Is any way to save a custom php function to reuse later in other part of the site??

Does Wappler have any Code hinting and code completion??

Is any snippets panel??

No, there’s no snippets panel in Wappler and not place to save custom php functions. But normally in Wappler and its components you don’t need such on your pages.

It depends what the function is doing. You can often add custom formatters/extensions to both server and client sides to achieve what you want.

Hi. Can you orientate me please how to achieve this?? I am new in wappler.

Regards

Maybe explain what are you trying to achieve, that’s not possible with the components in Wappler?

For example:

I have created a function un php that takes the parameters and loop trought array for all the values…

Add a custom css to the DOM if a value from array is found.

Or simply create a PHP fucntion like this:


    // yes, the argument list can be empty
    3 function foo() {
    4
    5 // returns an array of all passed arguments
    6 $args = func_get_args();
    7
    8 foreach ($args as $k => $v) {
    9 echo "arg".($k+1).": $v\n";
    10 }
    11
    12 }
    13
    14 foo();
    15 /* prints nothing */
    16
    17 foo('hello');
    18 /* prints
    19 arg1: hello
    20 */
    21
    22 foo('hello', 'world', 'again');
    23 /* prints
    24 arg1: hello
    25 arg2: world
    26 arg3: again
    27 */

Thanks

1 Like