gnuherds-app-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Microformats and logical URLs -- mod_rewrite


From: Klaus Weiss
Subject: Re: Microformats and logical URLs -- mod_rewrite
Date: Sat, 05 May 2007 15:41:15 +0200

> I propose support the new URI design (see attached file) only at the new 
> Klaus' architecture, but not at the current one.
> 
> The new architecture must support that URI design without the need of 
> modrewrite. Realizing it directly with PHP will speed up the webapp.  Klaus, 
> should we do it at the Controller?.
> 
> So, I am going to cancell the that ?6819 task.
> 
> What do you think?

I wonder if it isn't better to move the redirection stuff to PHP
litself? Currently there is a dispatcher file which do this stuff and it
would be easy to add some special rules for backward compatibility. 

Here is some code of an example controller which tries to solve the
above issue:

<?php
class Offers extends Controller
{
        public $name = 'Offers';        

        public function view()
        {
                if(!$this->data['GET']['id'])
                        $this->redirect('/offers/viewList/');

                /* Show specific job entry. */
                ...
        }

        public function viewList()
        {
                /* Show all job entries. */
        }
}
?>

The requested URL should looks like '/offers/view/3' if mod_rewrite is
used. In the config file there is this option:

define('SITE_MOD_REWRITE', true);

which indicates whether mod_rewrite is enabled You can disable it easily
by setting this constant to false. This change will be detected and all
URL's which are described with the HTML helper method `link` will be
changed so everything run without the need of mod_rewrite.

There is some lowlevel code which extracts now the necessery information
from the URL. Currently this code understands the following layout:

/index.php/ControllerName/ActionName/Param1/Param2/...

However it can be easily changed. I think this is an interesting feature
due to its flexibility.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]