PHP Pre !DOCTYPE html Support

Does anyone know how to add text/code before the “<!DOCTYPE html>”?

You can add text before or after the header, but I need to add text/code before the start of the HTML tag. The reason for this, is that PHP prevents redirection/processing if HTML text has already been written to the output buffer.

Any suggestions on how this can be undertaken?

Development Idea: Replicate the same Header “add code/text before/after header” capability but at a page level and global level.

1 Like

I am afraid we don’t have an option for placing code at the start of the file, but this can be done with an export script.

Hello @martin,
Sorry maybe it’s not the perfect place for this question :

How insert PHP Code inside BSS ? with custom code ? or in different way ?
Thanks by advance for any help

You can add php code in a custom code (usually if it is a large block of code)

Or you can also add to elements, something like:

<h1 class="title"><?php echo $title; ?></h1>

Obviously the php results won’t show on in bootstrap studio, or in the preview

Thanks but I cannot export in .php file in projet right ?

You have two options.

On your server in your htaccess, you can set the server to run html files as php


AddType application/x-httpd-php .php .html
AddHandler x-httpd-php80 .php .html

This may vary from server to server, and the php80 on the second line will change depending on the version of php you are running.

Another option is to set up an script to convert all .html extensions to php

You can read about this here:

You cannot export from the program to .php files. You can convert them with an export script.