Discussion:
URLS
Luke Mackenzie
2007-07-24 08:42:07 UTC
Permalink
Hi,

Is there a way in Jaws to not include index.php and admin.php in the
URL? Does this have to be done with rewrite rules (mod-rewrite) or is
there a built-in method for doing this? Jaws version is 0.7.2

thanks,

Luke.
Pablo Fischer
2007-07-24 17:23:22 UTC
Permalink
Hi,
Post by Luke Mackenzie
Hi,
Is there a way in Jaws to not include index.php and admin.php in the
URL? Does this have to be done with rewrite rules (mod-rewrite) or is
there a built-in method for doing this? Jaws version is 0.7.2
Sometime ago Jonathan (ion, lead developer) sent the tip to the list:

http://www.mail-archive.com/jaws-general-***@public.gmane.org/msg00178.html

Cheers,
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Cel: (044-55) 2689-6351
Fingerprint: 5973 0F10 543F 54AE 1E41 EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx
http://www.jaws-project.com
Luke Mackenzie
2007-07-28 05:49:28 UTC
Permalink
Hi,

Thanks for this link. However, it doesn't really resolve my problem. I
think If I am going to get anywhere with Jaws (and be able to help
provide some documentation), I need to understand the following:

What are maps in Jaws and how do they work?
What are aliases in Jaws, how do they work and what is the difference
between these and maps?
If the above are set up and activated, what effect will this have on any
htaccess rules?
If the .htaccess file is being used, what effect does this have on the
maps and aliases.

I'm looking for some specifics in terms of what the PHP code is doing
within the maps & aliases functionality. Yes, I can look at the code
but the reality is that I am never going to have time to look at all of
it and would probably end up ditching Jaws for something else with more
documentation. I think this is a likely scenario for many developers
with a casual interest in the Jaws project.

I hope someone can help me understand this functionality so that I can
contribute to the project. I have tried asking in the IRC channel but
(with all due respect to those who tried to help) but did not find
definitive answers or a native english speaker.

thanks,

Luke M.
Post by Pablo Fischer
Hi,
Post by Luke Mackenzie
Hi,
Is there a way in Jaws to not include index.php and admin.php in the
URL? Does this have to be done with rewrite rules (mod-rewrite) or is
there a built-in method for doing this? Jaws version is 0.7.2
Cheers,
Luke Mackenzie
2007-07-28 08:24:18 UTC
Permalink
This is what I have managed to deduce so far.

URL Mapping


JawsInitApplication.php creates new Jaws application:

// Create application
require JAWS_PATH . 'include/JawsApplication.php';
$GLOBALS['app'] =& new JawsApplication();
$GLOBALS['app']->create();


JawsApplication.php creates the JawsUrlMapping object from
JawsUrlMapping.php

function create()
{
require_once JAWS_PATH . 'include/JawsRegistry.php';
$this->Registry =& new JawsRegistry();
$this->Registry->Init();

$this->SetDefaults();

require_once JAWS_PATH . 'include/JawsTypes/JawsTranslate.php';
$GLOBALS['i10n'] =& new JawsTranslate;

// This is needed for all gadgets
require_once JAWS_PATH . 'include/JawsGadget.php';

$GLOBALS['i10n']->LoadTranslation('_GLOBAL_');

// URL Map
require_once JAWS_PATH . 'include/JawsURLMapping.php';
$this->Map =& new
JawsURLMapping($this->Registry->Get('/map/enabled') == 'true',

$this->Registry->Get('/map/use_file') == 'true',

$this->Registry->Get('/map/use_rewrite') == 'true',

$this->Registry->Get('/map/use_aliases') == 'true',

$this->Registry->Get('/map/map_to_use'),

$this->Registry->Get('/map/extensions')
);

$this->Map->Load();

}


Methods of this class are accessed by the individual gadgets e.g.
StaticPageMap.php:

<?php
$GLOBALS['app']->Map->Connect('StaticPage', 'Index', 'page/index');
$GLOBALS['app']->Map->Connect('StaticPage',
'Page',
'page/{id}',
'index.php',
array(
'id' =>
'[[:alnum:][:space:][:punct:]]+$',
)
);
?>
Post by Luke Mackenzie
Hi,
Thanks for this link. However, it doesn't really resolve my problem. I
think If I am going to get anywhere with Jaws (and be able to help
What are maps in Jaws and how do they work?
What are aliases in Jaws, how do they work and what is the difference
between these and maps?
If the above are set up and activated, what effect will this have on
any .htaccess rules?
If the .htaccess file is being used, what effect does this have on the
maps and aliases.
I'm looking for some specifics in terms of what the PHP code is doing
within the maps & aliases functionality. Yes, I can look at the code
but the reality is that I am never going to have time to look at all
of it and would probably end up ditching Jaws for something else with
more documentation. I think this is a likely scenario for many
developers with a casual interest in the Jaws project.
I hope someone can help me understand this functionality so that I can
contribute to the project. I have tried asking in the IRC channel but
(with all due respect to those who tried to help) but did not find
definitive answers or a native english speaker.
thanks,
Luke M.
Post by Pablo Fischer
Hi,
Post by Luke Mackenzie
Hi,
Is there a way in Jaws to not include index.php and admin.php in the
URL? Does this have to be done with rewrite rules (mod-rewrite) or is
there a built-in method for doing this? Jaws version is 0.7.2
Cheers,
------------------------------------------------------------------------
_______________________________________________
Jaws-general mailing list
http://forge.novell.com/mailman/listinfo/jaws-general
Pablo Fischer
2007-07-28 18:44:49 UTC
Permalink
Hi,
Post by Luke Mackenzie
What are maps in Jaws and how do they work?
Maps are shortcuts (that you can customize with the URL Mapper tool)
that makes an URL more easily to remember, for example, if you want to
see the Phoo photos you have in the 2nd album you can go to:

index.php?gadget=Phoo&action=ShowPhotos&album=2

With an URL map it would be:

index.php/phoo/album/2

These shortcuts can be configured in two ways:

- With a Map.php gadget (on Trunk) or a $gadgetMap.php. These maps will
get installed once you install the gadget (/phoo/album/[numeric])
- Via the URLMapper, you can configure your URLMaps
(/phoo/album/[alpha]).

The advantage of using Map.php is that you can 'validate' an URL by
telling Jaws which params should be numberic, string, emails, etc.. With
the URLMapper you can't, you only define 'generic' params.

Please take a look to:

http://wiki.rubyonrails.org/rails/pages/HowToRouteGenericURLsToAController

Cause we used a similar idea.
Post by Luke Mackenzie
What are aliases in Jaws, how do they work and what is the difference
between these and maps?
An alias is that, an alias, just one word to access faster an URL, for
example, you have a page in StaticPage for information about you, so you
can access it by going to:

index.php/pages/1 or index.php/pages/About_Me

An alias would be something like:

index.php/AboutMe.html
Post by Luke Mackenzie
If the above are set up and activated, what effect will this have on
any .htaccess rules?
It depends, if you want to use mod_rewrite, you need to also activate
the use of it in Jaws (I already sent you a mail about this), otherwise
your .htaccess and Jaws will get confused.
Post by Luke Mackenzie
If the .htaccess file is being used, what effect does this have on the
maps and aliases.
Depends if you use mod_rewrite.
Post by Luke Mackenzie
I'm looking for some specifics in terms of what the PHP code is doing
within the maps & aliases functionality. Yes, I can look at the code
but the reality is that I am never going to have time to look at all
of it and would probably end up ditching Jaws for something else with
more documentation. I think this is a likely scenario for many
developers with a casual interest in the Jaws project.
You are right, we lack of documentation. Its very common (and not to
excuse us) that most developers hate to document, they prefer to do it
on the code (phpdoc).

We are open to receive help from developers and users who wish to
document little pieces of Jaws.
Post by Luke Mackenzie
I hope someone can help me understand this functionality so that I can
contribute to the project. I have tried asking in the IRC channel but
(with all due respect to those who tried to help) but did not find
definitive answers or a native english speaker.
My job doesn't let me chat all day in IRC, I've access to it but can't
stay there all day, sorry :P.

Cheers,
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Cel: (044-55) 2689-6351
Fingerprint: 5973 0F10 543F 54AE 1E41 EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx
http://www.jaws-project.com
Pablo Fischer
2007-07-29 16:23:21 UTC
Permalink
Hi Luke,
Many thanks for your reply - I will investigate this further. The devs
seem to refer to a URL Mapper - is this the URL Manager? Has the name
changed in a later version? Also, is phoo the Photo Organizer gadget?
Yes sorry, the gadget name is URL Manager, and also yes, phoo is the
Photo Organizer gadget (gadgets/Phoo).
I totally understand about the documentation issue but it seems a
shame that what looks like a great project is suffering from a lack of
documentation. How would I go about contributing if I chose to do so?
Well, documenting things like this or take a look at:

http://dev.jaws-project.com/cgi-bin/trac.cgi/wiki/StartingJawsWiki

Some documentation is already at:

http://wiki.jaws-project.com/doku.php

We are cleaning & updating the documentation (dropping for a while doc
translations). Please use the http://dev.jaws-project.com site for
documenting.

Cheers,
PS. Please reply-to-the-list ;)
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Cel: (044-55) 2689-6351
Fingerprint: 5973 0F10 543F 54AE 1E41 EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx
http://www.jaws-project.com
Pablo Fischer
2007-07-29 16:31:21 UTC
Permalink
Hi,
do the individual mapping scripts just look at the current URL, do
some work on it and convert it to something the jaws internals
understand? Is this coming from function GetURILocation() in
JawsApplication.php?
Yes, these 'maps' are converted to _GET variables, you can do a
print_r/var_dump on $_GET once the maps have been processed (tip: take a
look to index.php).

How we 'convert' a map to _GET (or POST) variables?. Take a look to the
following map:

$GLOBALS['app']->Map->Connect('StaticPage',
'Page',
'page/{id}',
'index.php',
array(
'id' =>
'[[:alnum:][:space:][:punct:]]+$',
)
);

Params are (and how they get converted to _GET/_POST vars):

* First param is converted to $_GET['gadget']
* Second param is converted to $_GET['action']
* Third param is the 'map'. All values inside {} are 'variables', for
example {id} can be 1,2,3..4. In this case we will have $_GET['id']
* Fourth param is an array of 'validations'. In this the id variable
(inside {}) can be alphanumeric and contain spaces and punctuations.
This fourth param is optional.

So once the map has been processed we have: $_GET['gadget'],
$_GET['action'], $_GET['id'].

Cheers,
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Cel: (044-55) 2689-6351
Fingerprint: 5973 0F10 543F 54AE 1E41 EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx
http://www.jaws-project.com
Luke Mackenzie
2007-07-30 18:24:22 UTC
Permalink
Thanks again for your help Pablo. Another potentially stupid question:

hi. should the .htaccess file provided with jaws 0.7.2 work 'out of the
box' or do you have to go in and set the maps up inside the url manager?

i'm referring specifically to the rewrite rules for the blog gadget.

RewriteRule ^blog/([0-9]+) index.php?gadget=Blog&action=SingleView&id=$1
RewriteRule ^blog/archive/ index.php?gadget=Blog&action=Archive
RewriteRule ^blog/*$ index.php?gadget=Blog

if i switch the registry flag for mod_rewrite to true, the links for the
blog no longer work.

thanks,

Luke.
Post by Pablo Fischer
Hi,
do the individual mapping scripts just look at the current URL, do
some work on it and convert it to something the jaws internals
understand? Is this coming from function GetURILocation() in
JawsApplication.php?
Yes, these 'maps' are converted to _GET variables, you can do a
print_r/var_dump on $_GET once the maps have been processed (tip: take a
look to index.php).
How we 'convert' a map to _GET (or POST) variables?. Take a look to the
$GLOBALS['app']->Map->Connect('StaticPage',
'Page',
'page/{id}',
'index.php',
array(
'id' =>
'[[:alnum:][:space:][:punct:]]+$',
)
);
* First param is converted to $_GET['gadget']
* Second param is converted to $_GET['action']
* Third param is the 'map'. All values inside {} are 'variables', for
example {id} can be 1,2,3..4. In this case we will have $_GET['id']
* Fourth param is an array of 'validations'. In this the id variable
(inside {}) can be alphanumeric and contain spaces and punctuations.
This fourth param is optional.
So once the map has been processed we have: $_GET['gadget'],
$_GET['action'], $_GET['id'].
Cheers,
------------------------------------------------------------------------
_______________________________________________
Jaws-general mailing list
http://forge.novell.com/mailman/listinfo/jaws-general
Loading...