bpr
04-28-2010, 04:49 AM
Hi guys,
I got a question about excluding parts of my php files in combination with the db class.
First of all, lets call my file "test.php". In that file I got like 500 Lines of php code, lets say 100 lines is all over the same something like this:
$dataForSquadTodo = array();
while ($tododata = $vbulletin->db->fetch_array($DATAFROMOUTSIDEFUNCTION) )
{
//make a class so that you can adjust bg for tr
switch ($tododata['priority'])
{
case "Sehr Hoch":
$style = 'rhigh';
break;
case "Hoch":
$style = 'high';
break;
case "Mittel":
$style = 'medium';
break;
case "Niedrig":
$style = 'low';
break;
}
// nun stehen die Daten in $userdata zur Verf?gung
$data = array(
'id' => $tododata['id'],
'title' => $tododata['title'],
'description' => $tododata['description'],
'squad' => $tododata['squadname'],
'status' => $tododata['status'],
'priority' => $tododata['priority'],
'style' => $style
);
$dataForSquadTodo[] = $data;
}
foreach ($dataForSquadTodo as $item => $value)
{
$templater = vB_Template::create('todo_table_list');
$templater->register('item', $item);
$templater->register('value', $value);
$todoDataSquad .= $templater->render();
}
I tried to put this in a function such and called it something like
"getDataAndProduceArray( $data )"
However, there was no way, that I was able to use "$DATAFROMOUTSIDEFUNCTION" - I just got a blank site. It was even in the test.php and I didnt give it to another php file in includes/ or somewhere else. Does anybody know, why I cant do it like that ? Why is my script not recognising my function ?
All the best
bpr
I got a question about excluding parts of my php files in combination with the db class.
First of all, lets call my file "test.php". In that file I got like 500 Lines of php code, lets say 100 lines is all over the same something like this:
$dataForSquadTodo = array();
while ($tododata = $vbulletin->db->fetch_array($DATAFROMOUTSIDEFUNCTION) )
{
//make a class so that you can adjust bg for tr
switch ($tododata['priority'])
{
case "Sehr Hoch":
$style = 'rhigh';
break;
case "Hoch":
$style = 'high';
break;
case "Mittel":
$style = 'medium';
break;
case "Niedrig":
$style = 'low';
break;
}
// nun stehen die Daten in $userdata zur Verf?gung
$data = array(
'id' => $tododata['id'],
'title' => $tododata['title'],
'description' => $tododata['description'],
'squad' => $tododata['squadname'],
'status' => $tododata['status'],
'priority' => $tododata['priority'],
'style' => $style
);
$dataForSquadTodo[] = $data;
}
foreach ($dataForSquadTodo as $item => $value)
{
$templater = vB_Template::create('todo_table_list');
$templater->register('item', $item);
$templater->register('value', $value);
$todoDataSquad .= $templater->render();
}
I tried to put this in a function such and called it something like
"getDataAndProduceArray( $data )"
However, there was no way, that I was able to use "$DATAFROMOUTSIDEFUNCTION" - I just got a blank site. It was even in the test.php and I didnt give it to another php file in includes/ or somewhere else. Does anybody know, why I cant do it like that ? Why is my script not recognising my function ?
All the best
bpr