2012-08-03 2 views
0

반복 영역 질문이 있습니다. 내가 여기서하려고하는 것은 질의가 반복 될 때까지 반복되는 정보이다. 나는 그것의 한계를 5로 설정했다. 나는 정보가 반복되기를 원하지만, 반복 될 때마다 DIV id가 바뀌도록하고 싶다. 가능한가요? 내가 여기에서 만들려고 노력하는 것은 기능을 갖춘 jquery 슬라이더이며 그렇게하기 위해 슬라이드를 통과하거나 클릭 할 때 메인 박스에 이들을 끌어 들이기 위해 표시된 내용이 필요합니다. 미리 감사드립니다.반복 영역에서 변수를 변경하는 코드가 수정해야합니다.

<?php 
$idname = "fragment-"; 
$idnum = 1; 
echo $idname . $idnum; 
?> 

<?php do { ?> 
<div id="<?php for($idnum=1;$idnum<=5;$idnum++){ 

echo $idname . $idnum++; break;}?>" class="ui-tabs-panel" style=""> 
      <img src="<?php echo $row_getDisplay['picture']; ?>" alt="" /> 
      <div class="info" > 
       <h2><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" ><?php echo $row_getDisplay['title']; ?></a></h2> 
       <p><?php echo $row_getDisplay['preview']; ?><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" >Click Here</a></p>    </div> 
     </div> 
<?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?> 

이 코드의 전류 출력입니다 ..

<div id="fragment-1" class="ui-tabs-panel" style=""> 
      <img src="images/archives/2012/july/1343579505.jpg" alt="" /> 
      <div class="info" > 
       <h2><a href="fetch?id=39" >Testing Preview Box Character Count max out on the total number</a></h2> 
       <p>Other things have to go here to show the preview seems like other things don't really fit<a href="fetch?id=39" >Click Here</a></p>   </div> 
     </div> 

답변

0
<?php 
$idnum = 1; 

do { ?> 
<div id="fragment-<?php echo $idnum; ?>" class="ui-tabs-panel" style=""> 
     <?php $idnum++; ?> 
     <img src="<?php echo $row_getDisplay['picture']; ?>" alt="" /> 
     <div class="info" > 
      <h2><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" ><?php echo $row_getDisplay['title']; ?></a></h2> 
      <p><?php echo $row_getDisplay['preview']; ?><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" >Click Here</a></p>    
     </div> 
     </div> 
<?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?> 
+0

덕분에이 완벽했다. – user1557936

관련 문제