当前位置: 首页>>代码示例>>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;未经允许,请勿转载。