4) make a file named .htaccess that looks like this:
+php_flag register_globals off
+php_flag magic_quotes_gpc off
+AddDefaultCharset UTF-8
RewriteEngine on
RewriteBase /metaform/
RewriteRule .*\.tgz$ /metaform/index.php
<table>
<tr><th>foo</th><th>bar</th></tr>
-<!--~foobar_row start~--><tr><td>~foo~</td><td><input value="~bar~"></tr><!--~end~-->
+<!--~foobar_row {~--><tr><td>~foo~</td><td><input value="~bar~"></tr><!--~}~-->
</table>
tem_load('foobar.html');
sub templates:
key: foobar_row
value: <tr><td>~foo.....html~</td><td><input value="~bar.attr~"></tr>
-
-
-tmpl_insert('foobar_row');
function download_tar() {
$name = $GLOBALS['file_name'];
$data = array(
+ "INSTALL" => read_whole_file('code/wfpl/metaform/INSTALL'),
".htaccess" => make_htaccess(),
#"run.php ->" => 'code/wfpl/run.php',
"style.css" => read_whole_file('code/wfpl/metaform/style.css'),
--- /dev/null
+INSTALL INSTRUCTIONS FOR THE FILES IN THIS DIRECTORY:
+
+If your directory is already set up for WFPL, then all you have to do is copy the files from this directory (except INSTALL and .htaccess) to that directory, and it should run as-is.
+
+INSTRUCTIONS FOR SETTING UP A DIRECTORY FOR WFPL:
+
+1) "cd" to the directory that will contain all your content and code files.
+
+2) make a "code" directory:
+
+mkdir code
+
+3) download wfpl:
+
+cd code
+git clone git://gitorious.org/wfpl/wfpl.git
+cd ..
+
+4) make the run.php link:
+
+ln -s code/wfpl/run.php
+
+5) Install the .htaccess file from this directory (it's a hidden file, but you
+can see it with ls -a)
+
+6) If you have a domain name pointing directly at the directory you're setting
+up (for example, it's accessible as http://example.com/) then you're done! But
+if this directory is acessed with a directory (or multiple directories) in the
+URL path (for example: http://example.com/foo/bar/) then you'll need to edit
+the RewriteRule in .htaccess (read the comments in that file for further
+explanation and examples.
+
+
+That's it! Now that you've got the directory set up, just place your php files
+and your html templates in there, and you should be good to go. Remember to
+omit the file extension in the URL.
+# Tell php not to mangle form data or let the user set globals.
php_flag register_globals off
php_flag magic_quotes_gpc off
-Options -MultiViews
+
+# All your files are UTF-8... RIGHT?
AddDefaultCharset UTF-8
+
+############ START OF PRETTY URLS SETTINGS
+# This section contains directives to enable pretty URLs, and instruct apache
+# to run wfpl on them. This runs code/config.php if it exists, then loads
+# templates, then loads the php file, and call's it's main function. See
+# code/wfpl/run.php and code/wfpl/README for more details.
+
+# To have "pretty" urls (no file extension at the end) we use mod_rewrite. But
+# first we've got to disable a couple url-mangling features of apache that take
+# precedence over mod_rewrite:
+Options -MultiViews
+DirectorySlash Off
+
+# Activate mod_rewrite:
RewriteEngine on
-RewriteRule ^[^/.]*$ /~form~/run.php
+
+# Unfortunately, the rewrite rules only work with absolute paths, so if your
+# files are not at the top level of the domain, you'll have to customize this
+# part. Here's the config for running at the top level:
+RewriteRule ^[^/.]*$ /run.php
+
+# use this line instead if you have this (.htaccess) file and your php and html
+# files in the ~form~ directory:
+#RewriteRule ^[^/.]*$ /~form~/run.php
+############ END OF PRETTY URLS SETTINGS