|
Revision 1, 0.8 kB
(checked in by aarkerio, 18 months ago)
|
|
Initial Import
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | class NewHelper extends Helper |
|---|
| 3 | { |
|---|
| 4 | public $tab = " "; |
|---|
| 5 | |
|---|
| 6 | public function show($name, $data) |
|---|
| 7 | { |
|---|
| 8 | list($modelName, $id, $titulo, $cuerpo, $fecha) = explode('/', $name); |
|---|
| 9 | |
|---|
| 10 | $output = $this->list_element($data, $modelName, $id, $titulo, $cuerpo, $fecha); |
|---|
| 11 | |
|---|
| 12 | //return to view |
|---|
| 13 | return $this->output($output); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | public function list_element($data, $modelName, $id, $titulo, $cuerpo, $fecha) |
|---|
| 17 | { |
|---|
| 18 | |
|---|
| 19 | $output = ""; |
|---|
| 20 | |
|---|
| 21 | foreach ($data as $key=>$val) |
|---|
| 22 | { |
|---|
| 23 | $idnew = $val[$modelName][$id]; |
|---|
| 24 | $output .= "<div class=\"new_title\">".$val[$modelName][$titulo] . $val[$modelName][$fecha] . "</div>"; |
|---|
| 25 | $output .= "<div class=\"new_body\">".$val[$modelName][$cuerpo] . "<br /><br /><br />" ; |
|---|
| 26 | $output .= '<a href="/news/single/'.$idnew.'">Link to full new</a> <br /></div>'; |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | return $output; |
|---|
| 30 | } |
|---|
| 31 | } |
|---|
| 32 | ?> |
|---|