23.02.2015 Views

www.it-ebooks.info

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

if (!empty($p[0])) {<br />

$module = $p[0];<br />

} else {<br />

$module = $this->getFront()->getDefault('module');<br />

$request->setAlias(Mage_Core_Model_Url_Rewr<strong>it</strong>e::<br />

REWRITE_REQUEST_PATH_ALIAS, '');<br />

}<br />

}<br />

if (!$module) {<br />

if (Mage::app()->getStore()->isAdmin()) {<br />

$module = 'admin';<br />

} else {<br />

return false;<br />

}<br />

}<br />

Chapter 2<br />

Next, the match function will <strong>it</strong>erate through each of the available modules and try<br />

to match the controller and action, using the following code:<br />

…<br />

foreach ($modules as $realModule) {<br />

$request->setRouteName<br />

($this->getRouteByFrontName($module));<br />

PATH_ALIAS,<br />

// get controller name<br />

if ($request->getControllerName()) {<br />

$controller = $request->getControllerName();<br />

} else {<br />

if (!empty($p[1])) {<br />

$controller = $p[1];<br />

} else {<br />

$controller =<br />

$front->getDefault('controller');<br />

$request->setAlias(<br />

Mage_Core_Model_Url_Rewr<strong>it</strong>e::REWRITE_REQUEST_<br />

}<br />

}<br />

);<br />

ltrim($request-><br />

getOriginalPathInfo(), '/')<br />

// get action name<br />

if (empty($action)) {<br />

if ($request->getActionName()) {<br />

[ 35 ]<br />

<strong>www</strong>.<strong>it</strong>-<strong>ebooks</strong>.<strong>info</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!