2013-08-03 3 views
1

비디오 플러그인을 사용하여 비디오 링크 갤러리를 생성하는 사이트를 만들고 있습니다. 문제는 이러한 이미지와 링크가 내 사이트의 반응 형 디자인과 호환되지 않는 테이블에 저장된다는 것입니다. 웹 디자이너이자 PHP 개발자가 아니기 때문에 테이블을 생성하고 간단한 div 컨테이너로 대체하는 모든 요소를 ​​제거하는 방법에 대해이 코드를 살펴볼 때 손실이 있습니다. PHP 사용자에게는 간단합니다.PHP로 생성 된 테이블 레이아웃을 div로 변환

<table id="media_galery"> 
    <?php 
    $t = 0; 

      for ($i = 0; $i < count($cArray); $i++) { 
       $t++; 
       $file = $cArray[$i]; 
       $remote = null; 
       $name = $file->getFileName(); 
       $file_path = BASE_URL.DIR_REL.$file->getDownloadURL(); 
       $ak_d = FileAttributeKey::getByHandle('media_date'); 
       $date = $file->getAttribute($ak_d); 

       $ak_a = FileAttributeKey::getByHandle('media_artwork'); 
       $image = $file->getAttribute($ak_a); 
       if($image==null){ 
        $image_path=$uh->getBlockTypeAssetsURL($bt).'/tools/mp3.png'; 
       }else{ 
        $image = File::getByID($image->fID); 
        $image_path=$image->getURL(); 
       } 


       $file_src = BASE_URL.DIR_REL.$file->getRelativePath(); 

       $ak_s = FileAttributeKey::getByHandle('media_audio'); 
       $audio = $file->getAttribute($ak_s); 
       if($audio){ 
        $audio_array = $mh->getMediaTypeOutput($audio); 
        $audio_path = $audio_array['path']; 
        $file_src = $audio_path; 
       } 

       $video = null; 
       $ak_s = FileAttributeKey::getByHandle('media_video'); 
       $video = $file->getAttribute($ak_s); 

       if($video){ 
        $video_array = $mh->getMediaTypeOutput($video); 
        $video_path = $video_array['path']; 
        var_dump($video_array['id']); 
        $image_path = $mh->getMediaThumbnail($video_array['id'],$video_array['type']); 
        //$video_src = $video_path.'?width='.$width.'&height='.$height; 
        //$file_src = $video_src; 
        if($video_array['type'] == 'vimeo'){ 
         $file_src = 'http://player.vimeo.com/video/'.$video_array['id']; 
        }else{ 
         $file_src = $video_path; 
        } 
       } 
       ?> 
       <td valign="top"> 

        </a><img src="<?php echo $image_path?>" href="#popup_prep" alt="<?php echo $file_src?>" class="<?php echo $playerID?>player_get<?php echo $i?> gallery_thumb" href="<?php echo $file_src?>"/> 

       </td> 
      <?php 
      if($t == $spread){ 
       $t=0; 
       echo '</tr>'; 
      } 
    } 

    for($d=$t;$d<$spread;$d++){ 
     echo '<td></td>'; 
     if($t == $spread){ 
      echo '</tr>'; 
     } 
    } 
    ?> 
    </table> 

이 문제에 대한 도움은 매우 감사하겠습니다.

+2

어디에서 시작 하시겠습니까? ? –

답변

0
<div id="media_galery"> 
    <?php 
    $t = 0; 

      for ($i = 0; $i < count($cArray); $i++) { 
       $t++; 
       $file = $cArray[$i]; 
       $remote = null; 
       $name = $file->getFileName(); 
       $file_path = BASE_URL.DIR_REL.$file->getDownloadURL(); 
       $ak_d = FileAttributeKey::getByHandle('media_date'); 
       $date = $file->getAttribute($ak_d); 

       $ak_a = FileAttributeKey::getByHandle('media_artwork'); 
       $image = $file->getAttribute($ak_a); 
       if($image==null){ 
        $image_path=$uh->getBlockTypeAssetsURL($bt).'/tools/mp3.png'; 
       }else{ 
        $image = File::getByID($image->fID); 
        $image_path=$image->getURL(); 
       } 


       $file_src = BASE_URL.DIR_REL.$file->getRelativePath(); 

       $ak_s = FileAttributeKey::getByHandle('media_audio'); 
       $audio = $file->getAttribute($ak_s); 
       if($audio){ 
        $audio_array = $mh->getMediaTypeOutput($audio); 
        $audio_path = $audio_array['path']; 
        $file_src = $audio_path; 
       } 

       $video = null; 
       $ak_s = FileAttributeKey::getByHandle('media_video'); 
       $video = $file->getAttribute($ak_s); 

       if($video){ 
        $video_array = $mh->getMediaTypeOutput($video); 
        $video_path = $video_array['path']; 
        var_dump($video_array['id']); 
        $image_path = $mh->getMediaThumbnail($video_array['id'],$video_array['type']); 
        //$video_src = $video_path.'?width='.$width.'&height='.$height; 
        //$file_src = $video_src; 
        if($video_array['type'] == 'vimeo'){ 
         $file_src = 'http://player.vimeo.com/video/'.$video_array['id']; 
        }else{ 
         $file_src = $video_path; 
        } 
       } 
       ?> 
       <div class="img_div<?php if($t == ($spread + 1)){$t=0; echo ' first';}?>"> 

        </a><img src="<?php echo $image_path?>" href="#popup_prep" alt="<?php echo $file_src?>" class="<?php echo $playerID?>player_get<?php echo $i?> gallery_thumb" href="<?php echo $file_src?>"/> 

       </div> 
      <?php 
     } 

    ?> 
    </div> 

나는 $spread의 가치가 무엇인지 알고 있지만하지 않는 코드를 위하면 다음과 같은 결과물을 출력 할 것 위의 예제 2 (그래서 2 열의 확산을 가정

<div id="meda_galery"> 
    <div class="img_div"> 
     ... 
    <div> 
    <div class="img_div"> 
     ... 
    <div> 
    <div class="img_div first"> 
     ... 
    <div> 
    <div class="img_div"> 
     ... 
    <div> 
</div> 

). 각 div를 왼쪽으로 플로팅 할 수 있지만 clear를 사용하여 "first"클래스로 각 행에 대한 새 행을 시작하십시오.

+0

또한 무엇이 ' Revent

관련 문제