PHP Code

Introduction to Adding PHP and HTML in Breakdance

In this tutorial, Lewis from Breakdance demonstrates how to incorporate PHP and HTML code into your Breakdance pages using the platform’s built-in code block element.

Using the Code Block

Accessing the Code Block

  1. Click the “Add” button in Breakdance.
  2. Choose the “Code Block” element to include it on your page.

Inputting Code

  1. In the “PHP code” text area, you’re permitted to input PHP and HTML code because HTML is recognized as valid PHP code.

Writing and Running PHP Code

Creating a PHP Script

  1. Start by writing a PHP script within the PHP code area.
  2. For instance, you can initiate a PHP tag and write a ‘for’ loop to echo numbers from 0 to 99, each on a new line.
  3. Execute the script. You should observe it running live on the server, with the output presented in Breakdance.

Styling the Output

  1. If you want to style the output, such as making each number bold, integrate the respective HTML tags within your PHP script.
  2. These changes will also manifest live on the server.

Error Handling and HTML Integration

Managing Code Errors

If an error exists in your PHP script, for instance, a syntax error due to a missing closing brace, Breakdance will notify you of the error and its location.

Incorporating HTML

You can also input pure HTML code if you prefer. This might be useful for certain styling or content purposes.

Additional Notes

This feature of writing live PHP code within Breakdance is particularly useful for dynamic content generation and immediate output visualization. The real-time execution allows developers to monitor changes instantly and debug effectively, while the capacity to include HTML offers more versatility in content presentation.