Below I have a function that gives me a url for every listingId that is found.
Is it possible to do this via a route?
At this stage I want to load a view for each $subCatbut use the $mainCatas a main navigational item with the $subCat as a sub dropdown option that loads the specific view.
$detailsFunction = $this->createCategoryDetails();
$ld = array();
$url = array();
foreach ($detailsFunction as $main)
{
$ld = array('listingId' => $main['listingId']);
foreach($ld as $id)
{
$mainlisting = $main['listingId'];
$mainCat = strtolower($main['mainCat']);
$subCatO = strtolower($main['subCat']);
$subCat = str_replace(" ", "-", $subCatO);
$structure = base_url().'listings/'.$mainCat.'/'.$subCat;
var_dump($structure);
}
Well that’s what routing is for.
You can do something like this (not sure about the syntax, play around with it):
and your listings should be :
EDIT:
Not sure about your question now that i read it again, u might be needing is (in case theres a difference between mainCat and subCat to just pass 1 segment to listings and just act accordingly