关于订购行结果的快速php问题

时间:2010-03-09 18:35:01

标签: php this

请考虑以下事项:

$img_pathm = JURI::root().'images/properties/images/'.$this->datos->id.'/';
$peque_path = JURI::root().'images/properties/images/thumbs/'.$this->datos->id.'/';

$result = count($this->Images);
$resultf = $result-1;

while ($resultf>=0){ ?>

<span class="editlinktip hasTip" title="<?php echo $this->datos->image1;?>::

<img border=&quot;1&quot; src=&quot;<?php echo $peque_path.$this->Images[$resultf]->name; ?>&quot; name=&quot;imagelib&quot; alt=&quot;<?php echo JText::_( 'No preview available'.$img_pathm ); ?>&quot; width=&quot;206&quot; height=&quot;100&quot; />">

<img src="<?php echo $peque_path.$this->Images[$resultf]->name; ?>" alt="Additional image <?php echo $resultf+1 ?>" width="65px" height="50px"/></span>  <?php

$resultf--; }

目前这是一个接一个地打印图像。我需要做的就是将这些图像的打印顺序反转给用户。我不知道在这段代码中我在哪里或如何插入类似于ORDER的东西?提前谢谢!

2 个答案:

答案 0 :(得分:1)

以其他方式循环:

$img_pathm = JURI::root().'images/properties/images/'.$this->datos->id.'/';
$peque_path = JURI::root().'images/properties/images/thumbs/'.$this->datos->id.'/';

$result = count($this->Images);
$resultf = 0;

while ($resultf<$result){ ?>

<span class="editlinktip hasTip" title="<?php echo $this->datos->image1;?>::

<img border=&quot;1&quot; src=&quot;<?php echo $peque_path.$this->Images[$resultf]->name; ?>&quot; name=&quot;imagelib&quot; alt=&quot;<?php echo JText::_( 'No preview available'.$img_pathm ); ?>&quot; width=&quot;206&quot; height=&quot;100&quot; />">

<img src="<?php echo $peque_path.$this->Images[$resultf]->name; ?>" alt="Additional image <?php echo $resultf+1 ?>" width="65px" height="50px"/></span>  <?php

$resultf++; }

答案 1 :(得分:0)

也许你可以使用array_reverse