PHP and ASP pages

WebsitePainter not only is able to create static HTML websites, but also dynamic websites created by PHP or ASP. This pages shows a short overview about how to do that, and it will focus on PHP, but it is basically the same with ASP websites.


In order to use PHP, you need to know HTML as well as how to program PHP. It is a programming language after all. It could be a good idea to read through some real PHP tutorials on the web (there are a lot of them), because explaining it here is quite out of scope.


Getting started


Using PHP, ASP and JavaScript is quite simple in WebsitePainter, and there are several ways to do this. For PHP, simply name your pages/files with a .php extension, not .html which is the default. To do this, change the 'FileName' property in the property window of the page when selected in WebsitePainter to something ending with '.php', instead of '.html'.


By using either the 'PHP Code' element (Insert -> PHP code), you can enter php code anywhere on the page. Double click it and enter for example this code to see if it works:


echo ('hello world');


Additionally, you can use the menu 'View -> HTML Code of Page' to insert PHP code before and inside the header of the website.



Making it run


To test your PHP code, you need to run the page from a (local) webserver. Use the 'publish to local disk' feature of WebsitePainter (Menu: Publish -> 'to local disk') to write out the final .php file and then copy it to a webserver to test it out. If you only do the 'preview' instead, WebsitePainter will add a .html to your website and show it as it wasn't php.




Copyright by Ambiera e.U.