Brent W
Well-known member
In the process of moving one of my forums from vBulletin to xenForo, I need to port over this: http://www.fordforumsonline.com/recalls/
It has a rather simple URL structure as you can see. http://www.fordforumsonline.com/recalls/2011/e_450/60854/
I have the landing page /recalls/ working in xenForo but now I am a bit unsure on how to do the minor routes for the year, model and recall id in the last url above.
Here is my code so far (don't make fun
)
How do I go from here and create the other urls?
It has a rather simple URL structure as you can see. http://www.fordforumsonline.com/recalls/2011/e_450/60854/
I have the landing page /recalls/ working in xenForo but now I am a bit unsure on how to do the minor routes for the year, model and recall id in the last url above.
Here is my code so far (don't make fun

PHP:
<?php
class BamaStangGuy_Database_Route_Prefix_Recalls implements XenForo_Route_Interface
{
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithStringParam($routePath, $request, 'recalls');
return $router->getRouteMatch('BamaStangGuy_Database_ControllerPublic_Recalls', $action, 'recalls');
}
/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'recalls');
}
}
PHP:
<?php
class BamaStangGuy_Database_ControllerPublic_Recalls extends XenForo_ControllerPublic_Abstract
{
public function actionIndex()
{
$viewParams = array('recalls' => $this->_getRecallsModel()->getDistinctYears(), 'latest' => $this->_getRecallsModel()->getLatestRecalls());
return $this->responseView('XenForo_ViewPublic_Base', 'bamastangguy_database', $viewParams);
}
/**
* Get the simple text model.
*
* @return SimpleText_Model_SimpleText
*/
protected function _getRecallsModel()
{
return $this->getModelFromCache ( 'BamaStangGuy_Database_Model_Recalls' );
}
}
PHP:
<?php
class BamaStangGuy_Database_Model_Recalls extends XenForo_Model
{
/**
* Get all the rows of our table.
*
*/
public function getDistinctYears()
{
return $this->fetchAllKeyed('SELECT DISTINCT vehicle_year FROM ext_data_recall WHERE vehicle_make = \'FORD\' ORDER BY vehicle_year DESC', 'recall_id');
}
public function getLatestRecalls()
{
return $this->fetchAllKeyed('SELECT *
FROM ext_data_recall
WHERE vehicle_make = \'FORD\'
AND vehicle_model <> \'FORD\'
ORDER BY creation_date DESC
LIMIT 10', 'recall_id');
}
}
How do I go from here and create the other urls?