CodeIgniter Forums
[Solved] Isset question - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- 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

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

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

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

$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