There is a 'Code Snippets' section in nuBuilder and no desciption for it in Wiki documentation.
Can someone quickly explain what are 'URL', 'Selectable in' ? How to use them?
I tried to add PHP language snippet , so selected PHP in 'Language', left 'Selectable in' empty and defined a function. Then I called this function from onBeforeSave form PHP procedure, but got an 'Undefined function' error.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Code Snippets Topic is solved
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Code Snippets
Code snippets are a useful way to store templates, ideas, and other pieces of code. However, they cannot be directly accessed or executed in e.g. BS. or other events. Perhaps this is something that could be developed in the future.
The URL field is designed to store web addresses (URLs), allowing you to reference additional information on the internet or on a wiki. "Selectable in" allows you to specify where the code should be available, such as only in Setup -> Header. By using the </> button, you can easily paste the snippet.
If you want to include your own PHP functions in nuBuilder, it's best to place them in a separate file. This helps you better manage your custom code and keep it separate from the core nuBuilder files. To reference this file in nuBuilder, use the $nuConfigIncludePHP variable in the nuconfig.php file. This variable specifies the path to your PHP file containing the custom functions, and nuBuilder will automatically include it. This makes it easy to use your custom functions throughout your nuBuilder application without needing to manually include the file in each PHP script.
The URL field is designed to store web addresses (URLs), allowing you to reference additional information on the internet or on a wiki. "Selectable in" allows you to specify where the code should be available, such as only in Setup -> Header. By using the </> button, you can easily paste the snippet.
If you want to include your own PHP functions in nuBuilder, it's best to place them in a separate file. This helps you better manage your custom code and keep it separate from the core nuBuilder files. To reference this file in nuBuilder, use the $nuConfigIncludePHP variable in the nuconfig.php file. This variable specifies the path to your PHP file containing the custom functions, and nuBuilder will automatically include it. This makes it easy to use your custom functions throughout your nuBuilder application without needing to manually include the file in each PHP script.