|
Class TUrlManager
TUrlManager class
TUrlManager is the base class for managing URLs that can be recognized by
PRADO applications. It provides the default implementation for parsing and
constructing URLs.
Derived classes may override TUrlManager::constructUrl() and TUrlManager::parseUrl() to
provide customized URL schemes.
By default, THttpRequest uses TUrlManager as its URL manager. If you
want to use your customized URL manager, load your manager class as an
application module and set THttpRequest::setUrlManager
THttpRequest.UrlManager with the ID of your URL manager module.
-
TComponent
-
TApplicationComponent
-
TModule
implements
IModule
-
TUrlManager
Methods summary
public
string
|
#
constructUrl( string $serviceID, string $serviceParam, array $getItems, boolean $encodeAmpersand, boolean $encodeGetItems )
Constructs a URL that can be recognized by PRADO.
Constructs a URL that can be recognized by PRADO.
This method provides the actual implementation used by THttpRequest::constructUrl() . Override this method if you want to provide your
own way of URL formatting. If you do so, you may also need to override TUrlManager::parseUrl() so that the URL can be properly parsed.
The URL is constructed as the following format:
/entryscript.php?serviceID=serviceParameter&get1=value1&... If THttpRequest::setUrlFormat THttpRequest.UrlFormat is 'Path', the following
format is used instead:
/entryscript.php/serviceID/serviceParameter/get1,value1/get2,value2... If THttpRequest::setUrlFormat THttpRequest.UrlFormat is 'HiddenPath', then
entryscript.php will be hidden and the following format is used instead:
/serviceID/serviceParameter/get1,value1/get2,value2... In order to use the
'HiddenPath' format you need proper url rewrite configuration; here's an example
for Apache's .htaccess: <cdde> Options +FollowSymLinks RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L] </code>
Parameters
- $serviceID
string service ID
- $serviceParam
string service parameter
- $getItems
array GET parameters, null if not provided
- $encodeAmpersand
boolean whether to encode the ampersand in URL
- $encodeGetItems
boolean whether to encode the GET parameters (their names and values)
Returns
string URL
See
|
public
array
|
#
parseUrl( )
Parses the request URL and returns an array of input parameters. This method
is automatically invoked by THttpRequest when handling a user
request.
Parses the request URL and returns an array of input parameters. This method
is automatically invoked by THttpRequest when handling a user
request.
In general, this method should parse the path info part of the requesting URL
and generate an array of name-value pairs according to some scheme. The current
implementation deals with both 'Get' and 'Path' URL formats.
You may override this method to support customized URL format.
Returns
array list of input parameters, indexed by parameter names
See
|
Methods inherited from TComponent
__call(),
__construct(),
__destruct(),
__get(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
addParsedObject(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
|