With a PHP entry, you can extend the functionality of your website without having to deal with the details of additor® programming. PHP scripts can be used to generate dynamic content or implement interactions, among other things.

You can display the output of a PHP script, which must be located in a specific directory on your web server, on the website. The directory is displayed in the path above the input field.

If you require the above functionality, please contact your web administrators.

MULTI LANGUAGE: This entry is language-independent, i.e. it is transferred to the secondary language(s).

Entry PHP

Technical information

PHP

  • The output of the script is inserted into the page; the script should therefore not deliver a complete page, but only an HTML block, not set any headers and encode the output in UTF-8.
  • As usual, normal HTML can also be written in a PHP file; PHP blocks must be opened with "<?php".
  • If there are several scripts, you can split them up into PHP entries on several pages, or load and execute one or other partial script in your PHP file depending on the context.
  • The script is not executed in the global context. If you use global variables, you must also register them as global at the top level.
  • You can use session variables, but you should not initialise, start or delete the session.
  • If a PHP error occurs, a corresponding error message is recorded in the "runtime/<DomainName>/logs/application.log" directory. As a rule, no output is displayed on the page.
  • In contrast to normal PHP scripts, pages generated by additor may be cached. Only if you set the cache time to 0 will the page not be cached.

Javascript / CSS

  • CSS or Javascript can be embedded directly in the HTML or loaded from external files.
  • CSS or Javascript files cannot be stored in the CustomScript directory. If required, create a "css" or "js" directory in the DOCUMENT_ROOT and place the files there. Address the files with an absolute path, e.g. "/css/form.css".
  • If you need a function in Javascript that is called when the page is loaded, you should define a function (e.g. "function myInit() {}". You should register the function in a PHP block as follows:
    <?php \Yii::app->view->registerJs('myInit();'); ?>