簡體   English   中英

關於排序行結果的快速php問題

[英]Quick php question about ordering row results

考慮以下 :

$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的內容? 提前致謝!

只需循環另一種方式:

$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++; }

也許你可以使用array_reverse

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM