function GetTestimonial() { App::import('Model', 'Testimonial'); $objtestimonial = new Testimonial(); $testimonial = $objtestimonial->find('first', array("fields" => array("Testimonial.testimonial", "Testimonial.id", "Testimonial.name", "Testimonial.image", "Testimonial.created"), "order" => "rand()", 'limit' => '0,1', "conditions" => "status='1'")); return $testimonial; }
public function getById($id) { return \Testimonial::find($id); }
<?php require '../../inc/admin/config.php'; $session->auth_or_redirect('admin', '/', true); $admin_title = 'Manage Testimonials'; include ROOT . '/inc/admin/header.php'; $testimonials = new Testimonial(); $paginator = new Paginator($testimonials->find()); ?> <p><a href="/admin">Back to Admin Home</a></p> <a href="./new.php"><img src="/images/admin/button_add.jpg" alt="Add New Testimonial" id="button_add" /></a> <div id="testimonials_index"> <table> <tr> <th>Name</th> <th>Company</th> <th>Text</th> </tr> <?php foreach ($paginator->this_page() as $testimonial) { ?> <tr> <td><?php echo $testimonial->name; ?> </td> <td><?php echo $testimonial->company;