--- layout: default title: Examples ---
Some code snippets to boost your daily fat-free development. bla bla bla, some more cool text here.
This is your base, your control center, the headquarter - call it whatever you want.
Hint: You can use F3 as a static class too by using e.g. F3::set(). But this is not adviseable and will be deprecated in future releases.
We recommend the following layout for your folder structure.
The routing engine is a core feature of F3. Easy to use and minimal preparation to work with it.
This is the core part of F3's routing engine. As you may recognize. This is no PHP or HTML code. You have to put this into your .htaccess file in your application folder. Don't forget to modify RewriteBase
E.g. your app is on http://example.org/myf3app, than you have to modify your .htaccess the following way:
{% highlight apache %} ... RewriteBase /myf3app/ ... {% endhighlight %}Got it? Since you're done with the setup part for your routing engine, you can use F3's integrated routing engine which gives you URLs like /news/article/412. Do define normal routes, you have to use this:
{% highlight php startinline %} $app->route('GET /news/article/@id', 'news->showArticle'); {% endhighlight %}F3 loads all your files automatically. Class- and file name has to be same! In this case, it's our inc/news.php
You know the basics, now add your own stuff.
External code in your app? No way! Use the inbound form validation to make your app more secure.
How could a basic Login Class look like?
Simple example of form post via AJAX