From 96fa997ecdcd1e7a6cb27c61969a1c3ce6c648f8 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Fri, 23 Jul 2010 01:21:49 -0400 Subject: [PATCH] make metaform tarballs come with install doc --- INSTALL | 3 +++ doc/template.php.txt | 5 +---- metaform.php | 1 + metaform/INSTALL | 36 ++++++++++++++++++++++++++++++++++++ metaform/htaccess | 29 +++++++++++++++++++++++++++-- 5 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 metaform/INSTALL diff --git a/INSTALL b/INSTALL index 4894263..09fa003 100644 --- a/INSTALL +++ b/INSTALL @@ -29,6 +29,9 @@ ln -s code/wfpl/metaform.php index.php 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 diff --git a/doc/template.php.txt b/doc/template.php.txt index 0abfb73..416b6ac 100644 --- a/doc/template.php.txt +++ b/doc/template.php.txt @@ -17,7 +17,7 @@ This should work for simple templates such as: foo: '~foo~' - +
foobar
~foo~
~foo~
tem_load('foobar.html'); @@ -37,6 +37,3 @@ tem_load('foobar.html'); sub templates: key: foobar_row value: ~foo.....html~ - - -tmpl_insert('foobar_row'); diff --git a/metaform.php b/metaform.php index ed10c8d..3e8c380 100644 --- a/metaform.php +++ b/metaform.php @@ -522,6 +522,7 @@ function preview() { 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'), diff --git a/metaform/INSTALL b/metaform/INSTALL new file mode 100644 index 0000000..0ae06bb --- /dev/null +++ b/metaform/INSTALL @@ -0,0 +1,36 @@ +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. diff --git a/metaform/htaccess b/metaform/htaccess index 4073890..acd597b 100644 --- a/metaform/htaccess +++ b/metaform/htaccess @@ -1,6 +1,31 @@ +# 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 -- 1.7.10.4