Flex and URLRewriting >> FlexRewrite
DIGG IT!
2
Comments
Published
Friday, June 17, 2005
at
8:55 AM
.
Combined with URLRewriting, Flex and Flash makes an ideal templating solution. It takes apache/mod_rewrite to make this work but it is very clean and solves many problems with using Flash Player as a template in the presentation layer.
Before I explain the solution, you should see this in action. Hopefully the lightbulb will go off for you shortly.
Try these URLS:
http://www.powersdk.com/FlexRewrite/I/think/that/Flex/is/really/great
http://www.powersdk.com/FlexRewrite/Using/URL/Rewriting/any/url/is/valid
http://www.powersdk.com/FlexRewrite/Search/engines/will spider/every/page/and/you/can/change/the/html/content/to/feed/them
http://www.powersdk.com/FlexRewrite/Also/as/you/link/to/other/pages/the/back/button/works/as/expected/even/with/HistoryManager
http://www.powersdk.com/FlexRewrite/Joe/user/can/bookmark/a/page/of/content
First, these paths and directories do not really exist, they are generated via mod_rewrite and apache. Basically any path past the /FlexRewrite/ directory is dynamic via a single php document. You can use any server side language that is supported on apache to generate the HTML output.
Second, the Flex SWF file always has the same URL, thus it caches in the browser and is not downloaded but once. Using one template swf, I can make N pages. With an inner viewstack, I can also change the view depending on the path.
Using this technique, you can make a massive directory of content and have a single template swf file to drive the whole thing. The data changes but you reuse a client site template. For each page you can have unique data on the base HTML page for spiders and search engines. Also as the URL works as expected, both the back button and bookmarks work as expected.
Also the bandwidth math works well. Assume you have 1000 pages of data and 1 SWF file. Using Flex the SWF is 130KB, so the first page is 130KB and each additional is the size of the base HTML or (<2Kb). That beats the bandwidth profile for most HTML sites without images or interactivity.
When you open this ZIP file you are going to laugh at the contents. Yes that is all it takes. The key is the .htaccess file that sets up the dynamic directory.
SOURCE FOR FlexRewrite
Happy Templating with Flex and Flash.
Cheers,
ted ;)

Well... there is nothing new for the serverside world and the benefits are not so Flex related. The technique is good, but it breaks another Flash strength - the lack of page refresh, something that AJAX-ians are trying to achieve lately. Something that is really interesting is how this thing can be combined with http://www.klynch.com/apps/flashlinking/index.html
Not really, sub content within the SWF can use the HistoryManager to navigate sub-pages without a refresh. You get static URLs that are bookmarkable, search engine optimized, and can have nested content as needed.
Ideally using this model you make the most fo the URL path, optimized client rendering, Flex layout, and subpage content.
I intentionally kept the SWF simple as an example.
Cheers,
ted ;)