Hi,
i have 3 Tables: events - categories - cache
Every time i create a new event ,i get the categories via json from an external server via Json (curl).
Now i will put the Categories (id,name) to the "categories" table (inside helper).
Anyone have an idea how?
Here the code inside the helper to get the categories:
function enumList($ctrl, $fieldName)
{
$url='http://**************';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$get = curl_exec($curl) or die('Error.');
curl_close($curl);
$data = json_decode($get);
$cats = $data->data;
//build the select with categorie names
$lists = array();
$lists["events"]["kategorie"] = array();
foreach($cats as $cat){
if($cat->id==$id) $title = $cat->title;
$lists["events"]["kategorie"][$cat->id] = array("value" => $cat->id, "text" => $cat->title);
}
return $lists[$ctrl][$fieldName];
}