Jump to content


Member Since 31 Mar 2005
Offline Last Active Feb 01 2015 05:59 PM

Posts I've Made

In Topic: PHP developer section

23 December 2014 - 12:12 AM

like wtf?

In Topic: getting $_GET in a framework

21 December 2014 - 10:30 PM

The point I'm trying to make is why have the rewrite at all if you're just going to use normal querystring parameters? I understand you want to force everything through a front controller, but why stop there?

But yeah, you could just use the QSA flag to have apache append existing parameters.
RewriteRule ^(.*)$ index.php?uri=$1 [PT,L,QSA]

In Topic: getting $_GET in a framework

21 December 2014 - 10:10 PM

That rewrite rule removes the need for typical GET parameters by making your urls "pretty".

So instead of this:

You would use something more like:

Of course then you need some sort of "router" to parse and handle these parameters for you.

If this is your own framework you need to decide how your urls are going to be formed.

In Topic: Alternatives to $_GLOBALS

21 November 2014 - 11:11 PM

I would rather not pass each given property on a need to use basis, but just pass the whole object.

Why? The only reason to do this is laziness. It is making your code tightly coupled to whatever this "god" object is.

A controller has no interest in your connection settings for instance.

Objects should be passed their dependencies (and only their dependencies) at construction time.

Most frameworks handle this in an easy to manage manor by providing a configurable dependency injection container which allows you to configure how objects are to be created.

In Topic: Rookie needs help - filtering path?

17 November 2014 - 06:03 AM

You don't need a regex unless you actually need to match a pattern..

<?php if (substr_count($path, '/') > 2) { echo "Directories too deep"; }

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime