public function listar()
 {
     $template = new Template();
     $template->assignParam('objetos', Cliente::listar());
     return $template->render("cliente/listar.phtml");
 }
<?php

require_once 'Cliente.php';
$conexao = new Conexão('localhost', 'pc_help', 'root', '123');
$cliente = new Cliente($conexao);
$lc = $cliente->listar();
require_once 'cliente.list.php';
?>






<?php

require_once './Cliente.php';
try {
    $conexao = new \PDO('mysql:host=localhost;dbname=pdo', 'root', 'root');
} catch (\PDOException $e) {
    if ($e->getCode() === 1045) {
        echo "Usuário incorreto";
    }
}
//Intanciando o Cliente
$clienteErick = new Cliente($conexao);
//Setando o Cliente para efetuar a inclusão
$clienteErick->setName('Mssias')->setId('8');
//Inserindo o cliente
echo $clienteErick->inserir();
//Listando todos os clientes
foreach ($clienteErick->listar() as $value) {
    echo $value[0] . "-" . $value[1] . "<br>";
}
//Alterando o nome de um cliente
echo $clienteErick->alterar('7', 'Bull Peendranande');
//Listando um cliente selecionado
$value2 = $clienteErick->find('7');
echo $value2[0] . "-" . $value2[1] . "<br>";
//Excluindo um Cliente
echo $clienteErick->deletar('1');
//Listando todos os clientes para ver as alterações
foreach ($clienteErick->listar() as $value) {
    echo $value[0] . "-" . $value[1] . "<br>";
}
/**
 * Funcion de clienteListar a nivel comercio
 *
 * La funcion clienteListar se implementa a nivel Comercio, la cual
 * obtiene una lista de usuarios previamente registrado o un usuario especifico
 * , implementa la libreria de API-OpenOPay.
 *
 * @author Christian Hernandez <*****@*****.**>
 * @version 1.0
 * @copyright MásNegocio
 *  
 * @param $idCustomer	si el valor no existe o es blanco se obtendra 
 * 	la lista de usuarios registrados, en caso contrario regresara 
 *	el usuario especificado 
 *  
 */
function clienteListar($idCustomer = "")
{
    $app = Slim::getInstance();
    try {
        $app->log->info("Servicio cliente - Inicializando", array("test" => "caeena test"));
        $cliente = new Cliente();
        $cliente->listar($idCustomer, $app->request()->params());
        $response = $cliente->__get("response");
        $app->log->info("Servicio cliente - Proceso Completo ");
        $app->response->setStatus(201);
    } catch (Exception $e) {
        $app->log->info("Servicio cliente - Proceso Incompleto ");
        $app->log->info("Servicio cliente - " . $e->getMessage());
        $response = $cliente->__response();
        if ($e->getCode() == 3000) {
            $response['message'] = $e->getMessage();
        }
        $app->log->info(print_r($response, true));
        $app->response->setStatus(400);
    }
    $jsonStr = json_encode($response);
    $app->log->info("Servicio cliente - Response \n->{$jsonStr}<-");
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->body($jsonStr);
    $app->stop();
}
<?php

//listagem e insersao de clientes
require_once "Cliente.php";
$objCliente = new Cliente();
$clientes = $objCliente->listar();
?>

<table>
	<tr>
		<td>ID</td>
		<td>Nome</td>
		<td>Email</td>
	</tr>
	<?php 
foreach ($clientes as $cliente) {
    ?>
	<tr>
		<td><?php 
    echo $cliente["id"];
    ?>
</td>
		<td><?php 
    echo $cliente["nome"];
    ?>
</td>
		<td><?php 
    echo $cliente["email"];
    ?>
</td>
	</tr>
<?php

require_once './header.php';
require_once './Cliente.php';
//Cria uma instancia de clientes
$Cliente = new Cliente();
if (isset($_GET['name'])) {
    $ArrayClientes = $Cliente->buscar($_GET['name']);
    $name = $_GET['name'];
} else {
    //Lista clientes
    $ArrayClientes = $Cliente->listar();
}
?>

<div class="container">
    <h1>Cadastro de Clientes</h1>
    <div CLASS="row">
        <form method="get">
            <div class="col-lg-4">
                <label class="control-label">Nome</label>
                <input class="form-control" name="name" value="<?php 
if (isset($name)) {
    echo $name;
}
?>
"/>
            </div>

            <button type="submit"   class="btn btn-info">Pesquisar</button>
        </form> 
Exemple #7
0
			</thead>
			<tbody>
			
					
				<?php 
try {
    $conexao = new \PDO('mysql:host=localhost;dbname=clientes', 'root', 'admin');
} catch (Exception $e) {
    echo $e->getMessage();
}
require_once 'cliente.php';
$cliente = new Cliente($conexao);
$cliente->setNome('Kylo Ren');
$cliente->setEmail('*****@*****.**');
$cliente->setId(1);
$cli = $cliente->listar();
foreach ($cli as $resultado) {
    echo "<tr><td>" . $resultado['id'] . "</td>";
    echo "<td>" . $resultado['nome'] . "</td>";
    echo "<td>" . $resultado['email'] . "</td>";
    echo "<td class='actions'>\n\t\t\t\t\t\t\t<a class='btn btn-success btn-xs' href='view.php?id={$resultado['id']}'>Visualizar</a>\n\t\t\t\t\t\t\t<a class='btn btn-warning btn-xs' href='edit.php?id={$resultado['id']}'>Editar</a>\n\t\t\t\t\t\t\t<a class='btn btn-danger btn-xs'  href='#' data-toggle='modal' data-target='#delete-modal'>Excluir</a>\n\t\t\t\t\t\t  </td>\n\n\t\t\t\t\t\t  <tr>";
}
?>
				
				
			</tbody>
		</table>
	</div>
	
	</div> <!-- /#list -->