FAQs

ChronoForms shortcodes

Written

You can use Chronoforms shortcodes to retrieve form or system info, or generate some data like UUIDs, here is a list of supported shortcodes in Chronoforms v8:

  1. {var:var_name} will retrieve a variable named var_name, variables are set by actions usually, or set using PHP code you have used.
  2. {const:null} will return a null value
  3. {data:param} will return the value of a request/get/post parameter named "param", you may pass a default value too: {data:param default-value}
  4. {post:field-name} will return the value of the field from $_POST, this is useful if you want the latest fresh posted field value
  5. {session:param} will get the stored session variable named "param"
  6. {user:id}, {user:username}, {user:name}, {user:email} will return the user's id, username, name, email address
  7. {data:}, {date:date-format} will return the server date now in mysql format Y-m-d H:i:s or according to the format specificed
  8. {icon:icon-name} will return an SVG fontawesome icon code
  9. {l-language-string} will return a translated language string defined in the form's locales
  10. {fn:action-name} or {action:action-name} will run a form function by name
  11. {vw:view-name} or {view:view-name} will run a form view by name
  12. {url:} will return the current url
  13. {path:front} will return the path to the Chronoforms frontend folder where the uploads folder exist
  14. {path:admin} will return the path to the Chronoforms admin folder
  15. {path:root} will return the path to the CMS root
  16. {str:uuid} will return a UUID string
  17. {str:ip} will return the client's ip address
  18. {str:rand} will return a random number using mt_rand
  19. {globals:var-name} will return the value of a global variable defined in the ChronoForms8 settings page

Additionally, you may add few functions to the shortcode to change the value returned by the shortcode:

  1. {data.quote:field} will quote the field value for database operations, this is useful to prevent SQL injections
  2. {data.encode:array-field} to return a json encoded value of the field, useful when the field value is an array like a checkboxes group or a multi value dropdown