CodeIgniter Forums
[Solved] Isset question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: [Solved] Isset question (/showthread.php?tid=61370)



[Solved] Isset question - wolfgang1983 - 04-11-2015

I will try to explain it better.

I have been working on my directory paths. Which now have got working. $this->uri->segment(4) gets the directory name.

In my code below I need to be able to get the previous folders name in the elseif() but don't know how or if there is a better way.

I looked into str_replace(array('../', '..\\', '..'), '', $this->uri->segment(4)), '/'); but did not work.

PHP Code:
// Get's the name of the directory.
$foldername $this->uri->segment(4);

if (isset(
$foldername)) {

// first sub level

$directory FCPATH 'image/catalog' .'/'$foldername '/'// Working

} elseif ($foldername) { // Is finds if folder down level

// How can I get previous folder name
$directory FCPATH 'image/catalog/' .'/'$previousfolder .'/'$foldername '/';

}

} else {

$directory FCPATH 'image/' 'catalog/'// Working


Any suggestions.


RE: Isset question - tildemark - 04-11-2015

have you tried

Code:
$previous = $this->uri->segment(3);



RE: Isset question - wolfgang1983 - 04-11-2015

(04-11-2015, 04:42 AM)tildemark Wrote: have you tried


Code:
$previous = $this->uri->segment(3);

Thanks I had to set it in my main index and then echo to my json code then able to grab it for my upload function. I should of thought of that I think i had another brain fart Confused