The index.php embeds base.swf. It uses SWFObject to detect the flash plugin and SWFAddress for URL rewriting (by using mod_rewrite in .htaccess). Every request is rerouted to index.php.
This is the base of your website. Its whole purpose is to initialise the Fleb Framework and to load the main website (main.swf, see 3). It contains only the neccessary setup and a preloader. This SWF should be kept as small as possible in order to display the preloader very soon.
This is where the “brain” of the website resides. In main.swf the global navigation is initialized, the content (pages) is handled (preloading, fading in/out, crossfading, unloading etc.) and event handlers are added (SWFAddress, navigation, language etc.). All is open for you to finetune, extend and so on.
Your actual content. I’ve put the name in square brackets because it could be any name, like “about_us.swf” or “products.swf”. It’s completely up to you how you create these content SWFs.
This is the “plan” of your website: It contains the title, description, keywords of your website as well as the navigation structure and the source XML files with the content. Check out the Flebsite Demo structure.xml and the Fleb XML docu
Holds the data of your content pages. This XML file is loaded in the SWF and also in PHP for SEO. I prefer to use XML whenever possible instead of JSON/PHP to store content because XML can be loaded directly into an SWF while testing in the Flash IDE. Here is an example:
<page> <title>Service</title> <body bgColor="AD551C"><![CDATA[SERVICE: No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure.]]></body> <pic url="images/b4architecture_interiors002.jpg">This is a nice description of the image for SEO!</pic> </page>
Of course this is only one way to access source data. Fleb is very flexible. For example, you could also have text or a MySQL query in page.php. In fact, you can have a different PHP source file for every button in structure.xml…
This file is included in index.php. Actually, you will not have to do anything with this file. It parses the structure.xml file, creates the navigation for the no-javascript version and stores the seo content data in an array to distinguish which content should be loaded by comparing the swfaddress value to the array. Title, description and keywords will also be parsed and provided for SEO. Have a look in the file itself, it is all commented.
As in point 6 I have used square brackets because these PHP files can have any name. Usually there is always a pair of a PHP and an XML file. I use this to parse the content XML file for SEO. page.php is only used to load data for SEO, either by parsing the XML file, by a MySQL query or JSON etc. In the SWF, the XML data is loaded directly.
In case the express install is cancelled, the user will be rerouted to noflash.php. This file has no SWFAddress and it has 2 purposes: Show the user at least something (otherwise he would sit infront of a blank screen) and also show your clients the no javascript version of their website without having them deactivate javascript.
In case a user is browsing the website on an iPhone, he/she will be redirected to a special page, which is optimized for the iPhone: the menu structure is displayed in a flat hierarchy, zooming is disabled etc.
Last but not least: you need to edit the .htaccess file and set the base directory for SWFAddress, otherwise it will not work. Here is the content:
<IfModule mod_rewrite.c> # Enables mod_rewrite RewriteEngine on # Sets the base folder RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php </IfModule>
For example, if you upload your site into a folder “test” on your server, set RewriteBase like this:
RewriteBase /test