Latest Changes

Differences between version EMPTY and #6181

0a1,43
> ==== A simple webpage with Haxe and PHP ====
> You can also start developing websites very quickly with Haxe. Let's start with a simple HelloWorld sample. Put the following code in the file ''Index.hx'' :
> 
> <code haxe>
> class Index {
>     static function main() {
>         trace("Hello World !");
>     }
> }
> </code>
> 
> Now we need to compile this sample and create the PHP files from it. Create ''index.hxml'' so it contains the following content inside :
> 
> <code hxml>
> -php www
> -main Index
> </code>
> 
> You can now run the ''index.hxml'' by simply double-clicking on it on Windows, or, for other platforms, run the command ''haxe index.hxml'' in a terminal.
> 
> If everything goes well, it should create a directory ''www'' that contains the generated files. You can configure your webserver to point the www folder to see the PHP code in action.
> 
> ====== Web API ======
> 
> So far we've been only using the Haxe Generic API, available for all the targeted platforms. Now let's look at the ServerSide specific API, which is located into the package ''php''. Modify your ''Index.hx'' file with the following content :
> 
> <code haxe>
> class Index {
>     static function main() {  
>         var params = php.Web.getParams();
>         var name = params.exists('name') ? params.get('name') : 'world';
>         php.Lib.print('Hello ' + name + '!');
>     }
> }
> </code>
> 
> This will use the ''php.Lib.print'' function that prints some raw strings (without adding debug informations). It will print the parameters sent by the browser.
> 
> Recompile it by double-clicking the ''index.hxml'' again, and visit [[http://localhost/?name=Haxe]] (assuming that your webserver is pointing the generated folder ''www''). It will display the request parameters for the URL that are sent by the browser.
> 
> There is also a lot of useful functionality available in the [[/api/php/Web]] class.
> 
> Note that the ''php'' package tries to mimic as far as possible the ''neko'' one. This allows for easy switching from/to the two platforms
\ No newline at end of file

	
Ver Date Entry Lg User Action
#6187 2009-06-17 15:18:47 doc/flash pt cemim View | Diff
#6186 2009-06-17 15:18:47 doc/flash pt cemim Set title to Tutoriais Flash
#6185 2009-06-17 15:18:00 doc/flash/0_start pt cemim View | Diff
#6184 2009-06-17 15:16:11 doc/flash/0_start pt cemim View | Diff
#6183 2009-06-17 15:12:07 doc/flash/0_start pt cemim View | Diff
#6182 2009-06-17 15:12:07 doc/flash/0_start pt cemim Set title to Usando Haxe com Flash 9
#6181 2009-06-17 15:11:20 doc/start/php pt cemim View | Diff
#6180 2009-06-17 15:11:20 doc/start/php pt cemim Set title to Começando com Haxe/PHP
#6179 2009-06-17 15:10:59 doc/start/neko pt cemim View | Diff
#6178 2009-06-17 15:10:59 doc/start/neko pt cemim Set title to Começando com Haxe/Neko
#6177 2009-06-17 15:08:51 doc/start/js pt cemim View | Diff
#6176 2009-06-17 15:08:51 doc/start/js pt cemim Set title to Começando com Haxe/JS

Previous | Next