Working With PHP

PHP is used to retrieve and manipulate data stored within Oncord, such as contacts, pages or products.

When working with Oncord, PHP is commonly used in the following scenarios:

  • Calculate shipping costs based on a custom algorithm.
  • Run a custom function after a form submission to manipulate a contact or run a sale.
  • Show posts, contacts or products based on a custom set of conditions.

PHP Tutorials

We recommend reviewing the following W3Schools tutorials to brush up on your PHP knowledge:

Add a PHP Script

To add a custom PHP script to an Oncord powered website:

Edit a Website Design or Website Page > Click the SRC button > Select the PHP tab.

A PHP script starts with <?php and ends with ?>

<?php function myFunction() { return "Hello World"; } ?>


If you need to use this PHP throughout multiple pages, the script should reside in your website design theme, rather than a single page.

PHP Inline

Oncord uses a simple templating syntax to add dynamic content to a page. An expression can be placed anywhere in the document, starting with [? and ending with ?]

Return to the "HTML" tab after adding the above PHP script, and then call your PHP function inline:

<h1>[? myFunction(); ?]</h1>


Save the page, and click the "View" button.