Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/03/2009, 19:41
gratereaux
 
Fecha de Ingreso: marzo-2009
Mensajes: 2
Antigüedad: 15 años, 1 mes
Puntos: 0
Información como traer solo los primeros 15 proyectos del bucle

tengo un codigo que me ha pasado un amigo que usa "foreach", el problema es que me trae todos los proyectos que tiene la matriz pero yo solo quiero los primeros 15, si he insertado 100 proyectos con este codigo me los trae los 100. que tengo que modificarle al codigo para que solo me traiga los ultimos 15 proyectos que he insertado??

aqui les dejo el codigo:

Código PHP:

<div id="featured">
    <h3>Proyectos mas recientes</h3>
    <table width="100%">
        <tr>
            <th>Nombre del Proyecto</th>
            <th>Propuestas</th>
            <th>Tipo</th>
            <th>Iniciado</th>
            <th>Termina</th>
        </tr>
        <?php
        
foreach ($standard as $feature):
        
?>
            <tr>
                <td width="350">
                   <a href="/project/<?php echo $feature['Project']['project_id'];?>"> <?php echo $feature['Project']['name'];?> </a>
                    <?php
                        
if ($feature['Project']['featured'] == 1) {
                    
?>
                        <span class="featureproject">Urgente</span>
                    <?php ?>
                </td>
                <td align="center" width="50">
                    <?php
                        
echo $feature['Project']['count'];
                    
?>
                </td>
                <td width="250">
                    <?php
                    $tmp 
"";
                    for (
$x 1$x<=5$x++) {
                        if (
$feature['Project']['cat'.$x] != "0") {
                            
$tmp.=$feature['Project']['cat'.$x].", ";
                        }
                    }
                    
$tmp trim($tmp", ");
                    echo 
$tmp;
                    
?>
                    
                </td>
                <td width="100" align="center">
                    <?php echo date("m-d-Y",  $feature['Project']['date_created']);?>
                </td>
                <td width="100" align="center">
                    <?php echo date("m-d-Y",  $feature['Project']['date_end']);?>
                </td>
            </tr>
        <?php
        
endforeach;
        
?>
    </table>    
</div>