Overview   Package   Tree   Index 
Tv2 documentation
PREV  NEXT FRAMES  NO FRAME 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

pyramid-framework
Class ctlUrlMapper


class ctlUrlMapper

This class analyzes URL and calls the appropriate module.

Authors:
Emilis Dambauskas (emilis@gildija.lt)
Version:
$Id: ctlUrlMapper.class.php,v 1.4 2003/08/17 11:46:17 lunaticlt Exp $
Copyright:
2002–2003 Emilis Dambauskas under Artistic license

Field Summary
private array$map
Array containing "addresses" of modules
private string$url
Relative url from SITE_BURL

Constructor Summary
object ctlUrlMapper()
Constructor.

Method Summary
string buildUrl(string $url, [string $par])
Creates and returns full URL made of partial URL $url and optional additional GET parameters.
string doMapping(string $url)
Maps partial URL to the appropriate module.
string getUrl([boolean $full])
Returns partial or full URL.
boolean loadMap(mixed $mymap)
Fills $this->map with values from an array or file
private string runModule(array $addr, [array $nurls])
This method loads a module and returns result from the module's method.


Field Detail

map

private array $map

Array containing "addresses" of modules


url

private string $url

Relative url from SITE_BURL


Constructor Detail

ctlUrlMapper()

object ctlUrlMapper()

Constructor. Gets URL into $url attribute, creates other attributes.

Returns:
Returns ctlControl object.

Method Detail

buildUrl()

string buildUrl(string $url, [string $par])

Creates and returns full URL made of partial URL $url and optional additional GET parameters.

Parameters:
url - partial URL
par - Parameter part of the URL (e.g. var1=val1&var2=val2)
Returns:
URL
Uses the global variables:
protocol, SITE_URL
To Do:
  • It still needs to be tested if HTTP/HTTPS matching can be used conveniently.

doMapping()

string doMapping(string $url)

Maps partial URL to the appropriate module. Calls $site->showIndex() or $this->runModule, or $site->showError(404)

Parameters:
url - URL from request
Returns:
HTML of the page
Uses the global variables:
site, MAP_FULL, MAP_PARTIAL, protocol

getUrl()

string getUrl([boolean $full])

Returns partial or full URL. Partial URLs are relative to SITE_URL.

Parameters:
full - Should the URL returned be full or partial? (Default: partial).
Returns:
URL
Uses the global variables:
protocol, SITE_URL
To Do:
  • It still needs to be tested if HTTP/HTTPS matching can be used conveniently.

loadMap()

boolean loadMap(mixed $mymap)

Fills $this->map with values from an array or file

Parameters:
mymap - Name of file containing map or map array itself
Returns:
TRUE on success, FALSE onfailure

runModule()

private string runModule(array $addr, [array $nurls])

This method loads a module and returns result from the module's method.

Parameters:
addr - module "address" from map
nurls - remaining part of the URL split by '/'
Returns:
output from module
Uses the global variables:
CLASS_DIR, site

 Overview   Package   Tree   Index 
Tv2 documentation
PREV  NEXT FRAMES  NO FRAME 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug

This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)