PHP list to an Array to a foreach Joomla Module -


i have following php, needs take list of article ids , run through function them database.

i beginner in php far have:

list($slide1, $slide2, $slide3, $slide4, $slide5) = explode(" ", $params->get('id'));  $a = array(     $item => $slide1,     "two" => $slide2, //    "three" => $slide3, //    "four" => $slide4, //  "five" => $slide5 );  foreach ($a $k) {     $args['id'] = $k;     $item = modarticleslider::getarticles($args); } 

and class:

class modarticleslider {      public function getarticles($args){         $db = &jfactory::getdbo();         $item = "";          $id = $args['id'];         if($id > 0){              $query  = "select * ";             $query .= "from #__content  id =".$id." , state=1 " ;              //echo $query;             $db->setquery($query);             $item = $db->loadobject();         }          return $item;     }  } 

how instead of specifying $item have dynamic can selected articles , place them in different variables.. or have place them in array?

any advice/answers appreciated.

i beginner of php. please try this:

foreach ($a $k => $val) {     $args = $val;     $item[] = modarticleslider::getarticles($args);     var_dump($item); } 

in class

simply

$id = $args; 

i hope you!


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -