add()
getInstance()
getPrettyUrlParts()
__construct()
_chunkSetPrettyUrlParts()
_extractUrl()
_makeStackId()
$_aConParams
$_aStack
$_aTab
$_aUrls
$_idLang
$_instance
$_oDb
Mod rewrite url stack class. Provides features to collect urls and to get the pretty path and names of categories/articles at one go.
Main goal of this class is to collect urls and to get the urlpath and urlname of the related categories/articles at one go. This will reduce the queries against the database. Therefore the full advantage will be taken by rewriting the urls at codeoutput in front_content.php, where you will be able to collect all urls at once...
Usage:
// get the instance
$oMRUrlStack = ModRewriteUrlStack::getInstance();
// add several urls to fill the stack
$oMRUrlStack->add('front_content.php?idcat=123');
$oMRUrlStack->add('front_content.php?idart=321');
$oMRUrlStack->add('front_content.php?idcatart=213');
$oMRUrlStack->add('front_content.php?idcatlang=213');
$oMRUrlStack->add('front_content.php?idartlang=312');
// now the first call will get the pretty path and names from database at one go
$aPrettyParts = $oMRUrlStack->getPrettyUrlParts('front_content.php?idcat=123');
echo $aPrettyParts['urlpath']; // something like 'Main-category-name/Category-name/Another-category-name/'
echo $aPrettyParts['urlname']; // something like 'Name-of-an-article'
author | Murat Purc |
---|---|
package | Contenido Backend plugins |
subpackage | ModRewrite |
add(string $url)
string
Url, like front_content.php?idcat=123...
getInstance() : \ModRewriteUrlStack
getPrettyUrlParts(string $url) : array
string
Url, like front_content.php?idcat=123...
array
Assoziative array like $arr['urlpath'] $arr['urlname']
__construct()
_chunkSetPrettyUrlParts()
Composes the query by looping thru stored but non processed urls, executes the query and adds the (urlpath and urlname) result to the stack.
_extractUrl(string $url) : array
string
Url, like front_content.php?idcat=123...
array
Components containing result of parse_url with additional 'params' array_makeStackId(array $aParams) : string
array
Parameter array
string
Composed stack id$_aConParams : array
$_aStack : array
$_aTab : array
$_aUrls : array
$_idLang : int