當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Photo::find_by_id方法代碼示例

本文整理匯總了PHP中Photo::find_by_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Photo::find_by_id方法的具體用法?PHP Photo::find_by_id怎麽用?PHP Photo::find_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Photo的用法示例。


在下文中一共展示了Photo::find_by_id方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display_sidebar

 public static function display_sidebar($photo_id)
 {
     $photo = Photo::find_by_id($photo_id);
     $output = "<a class='thumbnail' href='#'><img width='100' src='{$photo->picture_path()}' ></a>";
     $output .= "<p>{$photo->filename}</p>";
     $output .= "<p>{$photo->type}</p>";
     $output .= "<p>{$photo->size}</p>";
     echo $output;
 }
開發者ID:Jojnas,項目名稱:gallery_php,代碼行數:9,代碼來源:photo.php

示例2: redirect_to

<?php

include "includes/header.php";
if (!$session->is_signed_in()) {
    redirect_to("login.php");
}
if (empty($_GET['id'])) {
    redirect_to("photos.php");
} else {
    $photo = Photo::find_by_id($_GET['id']);
    if (isset($_POST['update'])) {
        if ($photo) {
            $photo->title = $_POST['title'];
            $photo->caption = $_POST['caption'];
            $photo->alternate_text = $_POST['alternate_text'];
            $photo->description = $_POST['description'];
            $photo->save();
        }
    }
}
?>

    <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
        <?php 
include 'includes/top_nav.php';
?>
        <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
        <?php 
include "includes/side_nav.php";
開發者ID:swestphal,項目名稱:gallery,代碼行數:31,代碼來源:edit_photo.php

示例3: redirect

<?php

include "includes/init.php";
if (!$session->is_signed_in()) {
    redirect('login.php');
}
if (empty($_GET['id']) && !isset($_GET['id'])) {
    redirect("photos.php");
}
$id = urldecode($_GET['id']);
$photo = Photo::find_by_id($id);
if ($photo && file_exists($photo->full_path_directory . DS . $photo->filename)) {
    $photo->delete_picture();
    redirect("photos.php");
} else {
    redirect("photos.php");
}
開發者ID:kamy333,項目名稱:rajah,代碼行數:17,代碼來源:delete_photo.php

示例4: foreach

                        <th>ID</th>
<!--                        <th>Photo</th>-->
                        <th>Author</th>
                        <th>Comment</th>
                        <th>Date tine</th>
                        <th colspan="2" class="text-center">Action</th>

                    </tr>
                    </thead>
                    <tbody>
                    <?php 
$comments = Comment::find_all();
$output = "";
$blank = "&nbsp;&nbsp;&nbsp;";
foreach ($comments as $comment) {
    $photo = Photo::find_by_id($comment->photo_id);
    $output .= "<tr>";
    $output .= "<td>{$comment->id}</td>";
    //                        $output.="<td style='text-center'><img  class='user-image' src=\"{$photo->picture_path()}\" alt=''></td>";
    $output .= "<td>{$comment->author}</td>";
    $output .= "<td>{$comment->body}</td>";
    $output .= "<td>" . strftime("%d %M %Y @ %Hh%M", strtotime($comment->input_date)) . "</td>";
    $output .= "<td class='text-center'><a class='btn btn-danger btn-xs page-table-action' href='delete_comment.php?id=" . urlencode($comment->id) . "'>Delete</a></td>{$blank}";
    $output .= "<td class='text-center'><a class='btn btn-primary btn-xs  btn-xs page-table-action' href='edit_comment.php?id=" . urlencode($comment->id) . "'>Edit</a></td>{$blank}";
    $output .= "</tr>";
}
unset($photo);
echo $output;
?>

開發者ID:kamy333,項目名稱:rajah,代碼行數:29,代碼來源:manage_comments.php

示例5: array

<?php

require "init.php";
$image_info = array();
$photo = Photo::find_by_id($_POST['image_id']);
$image_info['filename'] = $photo->filename;
$image_info['type'] = $photo->type;
$image_info['size'] = $photo->size;
echo json_encode($image_info);
開發者ID:amirus2303,項目名稱:gallery,代碼行數:9,代碼來源:ajax_photo_info.php


注:本文中的Photo::find_by_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。