-
Notifications
You must be signed in to change notification settings - Fork 446
- Download the CMS sample https://github.com/bcosca/fatfree/blob/archive/f3-3.0.6.cms.demo.zip
- Looking for more usage examples? Take a look at the Framework Unit Tests. There you'll find lots of code samples of the built-in features.
- Join us at #fatfree on freenode IRC network. Use Webchat now!
- We have an active community in Google Groups f3-framework
- Post questions in Stack Overflow fat-free-framework if that's your preference.
Static method calling convention has been deprecated. It will be dropped in the next major version.
Of course you can. In most cases, you may wish to run F3 on your own virtual host, so that it's always the root of your domain. When time comes to go into production, it's just a matter of uploading to the Web host's root folder.
On the other hand, if your F3-enabled app is not located in the Web root, i.e. on shared Web hosting services, where you may not have full control over virtual hosts setup, here are some pointers:-
-
Let's say F3 runs in
mydomain.com/myapp/
. If your.htaccess
andindex.php
files are saved in that folder, you don't need to insert an ApacheRewriteBase
directive in your.htaccess
. Apache is already aware that the current path is theRewriteBase
by default. -
F3 redirects all URLs ending with
/
(except the domain root) to the relative base, e.g. when your browser tries to access the page atmydomain.com/myapp/page1/
, F3 will automatically reroute the request tomydomain.com/myapp/page1
. All relative URLs in your templates start atmydomain.com/myapp/
. As far as the framework is concerned,page1
is just a file in themydomain.com/myapp/
directory. Using this as a guide, the full URL of<a href="page2">
ismydomain.com/myapp/page2
. If this is not desired, your can use the../
URL prefix as many times as you need to get to the right path. Remember, any URL referenced by your HTML templates/views will be relative tomydomain.com/myapp/
.If you feel that your templates/views are becoming too verbose and you wish to override the current base URL, the alternative solution is to use the HTML
base
tag. Insert the tag somewhere in the<head>
section of your template. Something like<base href="myapp/altpath/" />
instructs your browser to usemydomain.com/myapp/altpath/
as the prefix for all relative URLs. In our example above, the browser will now translate the relative URLpage2
tomydomain.com/myapp/altpath/page2
, instead ofmydomain.com/myapp/page2
.Unfortunately, Internet Explorer browser only supports absolute paths as
base href
value. Adding<base href="http://mydomain.com/myapp/">
may not be convenient in a handful of cases, as you might need to switch from dev (http) and live server (https) every now and then. So you need to dynamically calculate the absolute base path. To do so, insert<base href="{{@SCHEME.'://'.@HOST.@BASE.'/'}}">
to your F3 template. Thebase
tag also affects CSS links you might have used in a relative way, likebackground-image: url(../img/page_bg.jpg)
. They should work as expected.