CodeIgniter Forums
Could I use a route for this? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Could I use a route for this? (/showthread.php?tid=56028)



Could I use a route for this? - El Forum - 11-22-2012

[eluser]jzmwebdevelopement[/eluser]
Hey,

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
Code:
$subCat
but use the
Code:
$mainCat
as a main navigational item with the
Code:
$subCat
as a sub dropdown option that loads the specific view.

Code:
$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);

   }