• Page:

The Production Tool Roots

The Production Tool

I’ve come up with several methods for building the tool as well. One way was to build all of the tools as modules that get loaded based on URL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
http://actingshowcase.com/tools/typr/3
Should load the module under /tools/typr/index.php

the folder structure is as such:
/sitename
  |--ajax
  |--css
     |--main.css
  |--js
     |--main.js
  |--tools
     |--cast
        |--ajax
        |--css
        |--js
        |--index.php
     |--planr
        |--ajax
        |--css
        |--js
        |--index.php
     |--shootr
        |--ajax
        |--css
        |--js
        |--index.php
     |--typr
        |--ajax
        |--css
        |--js
        |--index.php
  .htaccess
  index.php
  tools.php
*/

The apache file contained the code needed to grab any request made to a tool and filter it through a query string.

1
2
3
4
5
6
7
8
9
10
SetEnv PHP_VER 5

RewriteEngine on
RewriteBase /
Options +FollowSymLinks

AddDefaultCharset UTF-8

ErrorDocument 404 /404page.php
RewriteRule ^tools/(.*)$ tools.php?query=$1 [QSA,L]

That’s done. Next, was to have the tools.php file load up the right module. Here’s its code.

1
2
3
$query = explode("/",$_GET['query']);
var_dump($query);
include ($_SERVER['DOCUMENT_ROOT'].'/tools/'.$query[0].'/index.php');

That’s it. Done. Basically, whatever you get in the URL, parse it out and load the right folder / file / module.

The next step will require another page.