php - Get a value of an array within an array -
not sure on 1 , hoping able me out on 1 ...
here's code
loader::library('file/types'); $ih = loader::helper('image'); $names = explode("||",$this->tname); $urls = explode("||",$this->turl); $fids = explode("||",$this->fid); loader::model('file'); $i = loader::helper('image'); $v = array(); $cc = 0; foreach ($names $k=>$n){ if (intval($fids[$k]) > 0 ) : $img = $test = file::getbyid($fids[$k]); $fv = $img->getextension(); $ft = filetypelist::gettype($fv); $img = $ft->type == 1 ? $img : false; else : $img = false; endif; $v[$cc]['name'] = $n; $v[$cc]['url'] = $urls; $v[$cc]['src'] = $img ? $ih->getthumbnail($img,100,100)->src : false; $cc ++; } return $v;
and i'm having issues getting array values $urls within code. (5th last one)
foreach ($names $k=>$n){ if (intval($fids[$k]) > 0 ) : $img = $test = file::getbyid($fids[$k]); $fv = $img->getextension(); $ft = filetypelist::gettype($fv); $img = $ft->type == 1 ? $img : false; else : $img = false; endif; $v[$cc]['name'] = $n; $v[$cc]['url'] = $urls; $v[$cc]['src'] = $img ? $ih->getthumbnail($img,100,100)->src : false; $cc ++; } return $v;
thanks help. appreciate it.
i think have this:
$i = 0; foreach ($names $k=>$n){ if (intval($fids[$k]) > 0 ) : $img = $test = file::getbyid($fids[$k]); $fv = $img->getextension(); $ft = filetypelist::gettype($fv); $img = $ft->type == 1 ? $img : false; else : $img = false; endif; $v[$cc]['name'] = $n; $v[$cc]['url'] = $urls[$i]; //changed $v[$cc]['src'] = $img ? $ih->getthumbnail($img,100,100)->src : false; $cc ++; $i++; //changed } return $v;
Comments
Post a Comment