Mistři v programování na #hovnokod

PHP #777

cyklus? :)

<?php

class class_snipplet_news
{
  public $col=4;
  public $aIndices=array
  (
    "","","","",
    "","","","",
    "","","","",
    "","","","",
    "","","","",
    "","","","",
    "","","","",
  );
  public function getTime($i)          {return $this->aIndices[$i*$this->col+0];}  
  public function setTime($i,$val)     { $this->aIndices[$i*$this->col+0]=$val;}  

  public function getIdNews($i)        {return $this->aIndices[$i*$this->col+1];}  
  public function setIdNews($i,$val)   { $this->aIndices[$i*$this->col+1]=$val;}  
  
  public function getHeadline($i)      {return $this->aIndices[$i*$this->col+2];}  
  public function setHeadline($i,$val) { $this->aIndices[$i*$this->col+2]=$val;}  
    
  
  public function getHeadlineSub($i)      {return $this->aIndices[$i*$this->col+3];}  
  public function setHeadlineSub($i,$val) { $this->aIndices[$i*$this->col+3]=$val;}  
}

<table>
<tr><?$i=0?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
  </tr>
<tr><?$i++?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
  </tr>
<tr><?$i++?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
  </tr>
<tr><?$i++?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
  </tr>
<tr><?$i++?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
  </tr>
<tr><?$i++?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
  </tr>
<tr><?$i++?>
  <td><?=$oNews->getTime($i)?></td>
  <td><a href="/<?=url_helper('/detail/news_detail')?><?=$oNews->getIdNews($i)?>" title="<?=$oNews->getHeadline($i)?>"><?=$oNews->getHeadlineSub($i)?></a></td>
</tr>
</table>

Marek Petráš,