Hello World
Writing Hello World in the Croissant framework is very simple.
By default, since the framework loads the homepage.php
worker from the workers
folder, the simplest Hello World is adding the following PHP code to homepage.php
:
This will cause the framework to echo "Hello World" and then halt execution.
Hello World with style
To create a simple Hello World example using a template, create a new file in the /templates
folder called helloworld.tpl
(if it doesn't already exist).
Add the following markup.
In your homepage.php
file, use:
This will display the content of the helloworld.tpl
template using default browser styling.
Hello World with more style
To add custom styling, create a new css file in the docroot\css
folder called helloworld.css
, and add the following line to homepage.php
In your new homepage.css
file add whatever style you want for your <h1>
tag.
Adding data to Hello World
The Croissant Framework makes use of Smarty as its default rendering engine, and a number of methods have been added to make using Smarty simpler.
To add data to a template to be rendered, you Assign the data, then reference it in the template.
homepage.php
homepage.tpl