lundi 30 mai 2016

PHP & HTML Conditional Syntax Formating Assitance

I have been struggling to make this code work as I am a novice who just started coding. The php code works fine but i would like to add some condition html formatting instead of creating another page to display element.

$fileContent =
    '<tr class="file-sort" data-name="'.strtolower($filename).'" data-date="'.date("Y-m-d", strtotime($object['LastModified'])).'>" data-size="'.$object['Size'].'">
        <td>'.$y.'</td>
        <td><img src="'.$img.'">'.$filename.'</td>
        <!--<td><a href="'.$img.'" data-lightbox="image-set" data-title="'.strtolower($filename).'" ><img src="'.$img.'"style="width:65px;height:60px;cursor:zoom-in;" class="center_image"><span style="cursor:zoom-in">'.$filename.'</span></td>-->
        <td>'.date("M j Y, g:i A", strtotime($object['LastModified'])).'</td>
        <td>'.formatBytes($object['Size'], 0).'</td>  
        <td>
            <a href="download_file.php?key='.$s3->getObjectUrl($config['s3']['bucket'], $filepath).'" download="'.$filename.'" class="btn btn-primary"><img src="img/download.png"></a>
    ';

    if ($_SESSION['crew'] == 1) echo '<a href="files.php?key=' .$filepath. '" class="btn btn-danger"><img src="img/delete.png">';

    '</td>
    <!--<td class="center">
        <div class="checkbox">
            <label>
                <input type="checkbox" name="delete[]" value="'.$filepath.'">
            </label>
        </div>
    </td>-->
</tr>';

/***********************************/

$folderContent =
    '<tr class="file-sort" data-name="'.strtolower($subDir).'" data-date="'.date("Y-m-d", strtotime($object['LastModified'])).'>" data-size="'.$object['Size'].'">
        <td>'.$y.'</td>
        <td><img src="img/folder.png" style="width:35px;height:30px;"><a href="http://' . $_SERVER['HTTP_HOST'] . $SubFolderPath . '?prefix=' . urlencode($filepath) . '" >'.$subDir.'</a></td>
        <td>-</td>
        <td>-</td>
        <td>


        </td>
     </tr>';

Aucun commentaire:

Enregistrer un commentaire