.
|-- apache
|-- docs
| `-- GNU General Public License.txt
|-- lib
| |-- autoLoad.php
| |-- FrameView.class.php
| |-- StringView.class.php
| `-- tinyMVC.php
`-- vendor
`-- restserver
I say "general" because many of the items in my tinyMVC are not shown in this
listing for brevity sake. Here is what we have:
chown apache:users . -R chmod g+rw . -Rand must be run as root. I need this for my local server, but not for my remote server. Of course, the details may be different on your machine.
vendor `-- restserverThe vendor directory contains the various packages you install. Simply create the package subdirectory (e.g. ezsql, tbs) and unpack your package in it. I've also created projects that are demos of the included packages. The examples supplied with most packages don't take MVC into consideration, so adjustments need to be made. Restserver is included with all versions of tinyMVC, for without it tinyMVC's RESTful navigation won't work.
.
|-- apache
|-- app
| |-- controllers <-- PHP files here
| |-- installers
| |-- models
| `-- views <-- HTML templates here
|-- config
| |-- config.php
| `-- routes.php
|-- data
|-- docs
| `-- readme.txt
|-- public
| |-- index.php
| |-- php_errors.log
| `-- stylesheet.css
|-- script
`-- test
Here is a description of its contents:
chown apache:users . -R
chmod g+rw . -R
and must be run as root. I need it for my local server, but not for
my remote server. Of course, the details may be different on your machine.
define('ROOT',DS.'home'.DS.'alan'.DS.'develop'.DS.'php'.DS);
define('PROJECT_ROOT_DIR',ROOT.'demos'.DS.'my_project'.DS);
define('TINY_MVC_DIR',ROOT.'tinyMVC'.DS);
When a project is to be installed on a remote server after being tested on a local server, one could write two sets of defines, one for each in an "if" block that identifies which is which. If you have such a block, you'll want to have your database login information here, too.
$rest->addMap("GET","/?","HomeController");
$rest->getResponse()->cleanHeader();
$rest->getResponse()->addHeader("Location: ?q=/");
return $rest;
The location will be one of those you've defined in routes.php.
RestServer will use that header to check the map which will tell it which
controller (and possibly method) to execute.
Check your php.ini file to make sure that you are producing an error file. The error file will be written in the your_project/public/ directory. That should be your first line of analysis. (I found that out the hard way.)
Here are tinyMVC downloads, zipped up and ready to be installed on your server. There is a bare-bones version of tinyMVC with only the RestServer package installed. There are three examples that were written by RestServer's author, Diogo Souza da Silva, and modified by Alan Lake to fit in and work with tinyMVC. In their docs directories are explanations for how they work. restserver_ex2, in particular, has documentation written into the code, so you can examine how it works as it is working. To use these examples on your local server, you'll have to create links from Apache's "document root" to their directories called "public".
More detailed information in the use of RestServer is found in the tinymvc/docs directory.
Bare-bones tinyMVC
Restserver Example 1,
Example 2 and
Example 3.