Inline Scripts is a method of adding script programs in languages like php to add-ons. Inline scripts can be placed anywhere on the page, but are executed after the page is rendered by Contensive and returned to the webserver's scriting environment.
Simple Rules
- Do not start and end with the script with the script's escape sequence, like <$PHP.
- Use the return command to place a string where the add-on was placed.
- You can use a function(), but it is not needed. If you include your code in a function, end the script with: return myFunction()
- You can use any of the script language's context objects and functions, as well as the Contensive cp object.
Example
- Create a new addon
- Give it a name
- In the placement tab, check In Content
- In the Inline Script tab, add this: return $cp->user->name
- edit a page and place the addon on the page
- View the page and the add-on shows thier name