Streaming live at 10am (PST)

How can i add php code or html


#1

hello all

i wanna know how can i add some code for example i have one page i wanna add the code for contact us like this link
http://www.freecontactform.com/email_form.php

how can i add the code inside the dashboard

thank you


#2

You can add HTML, CSS and JS from the page settings (2 zones of custom code).
You can’t add PHP, unless you export the site to host it somewhere on one of your PHP enabled server.
You can create a form that’s not using PHP with Webflow form component.


#3

It looks like you can insert PHP code etc. using the Embed block (last item in the toolbox) with a few caveats. It will (probably?) only work if you then export your code for use on your own hosting. But it sure beats manually pasting the PHP code each in each time after a .zip export.

There’s a limitation of 10,000 characters for an Embed block. I tried to split a large chunk of code between two adjacent Embed blocks and it seemed to export OK, but then I discovered that:

a) it encloses any embedded code with <div><div class="w-embed"></div></div>, and if you butt up two together you get this where the join should be: </div></div><div><div class="w-embed">

b) It seems to strip out forward slashes, for example
echo "<br/><br/>";
becomes
echo "<br><br>";

c) It also appears to strip out blank lines (newline chars?)

And it looks like gibberish in the designer, as expected, so do your layout first.


#4

I’m sure you realize - inserting php code immediately breaks html.

So you will never get a valid preview of the site.

Plus… it won’t run on a php server - because of the file extension.

What I do… is place “markers” in the code. Then I have an automated process the looks for predefined markers and replaces the markers with the appropriate php code - as well as renaming the file.

The different part is removing a block of html code.