<option value="0">... <?php echo __('Seleccione uno'); ?> ...</option><?php $a = new Criteria(); $europeans_pids = array('3', '12', '19', '28', '38', '46', '157', '54', '55', '57', '62', '63', '69', '80', '85', '92', '102', '107', '108', '115', '136', '143', '144', '147', '149', '158', '176'); foreach ($europeans_pids as $pid) { $b = new Criteria(); $b = $a->getNewCriterion(PaisesPeer::PID, $pid); $a->addOr($b); } $paises = PaisesPeer::doSelect($a); foreach ($paises as $pais => $pa) { ?> <option title="<?php echo $pa->getPais(); ?> " value="<?php echo $pa->getPid(); ?> "> <?php echo $pa->getPais(); ?> </option><?php }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(PaisesPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(PaisesPeer::DATABASE_NAME); $criteria->add(PaisesPeer::PID, $pks, Criteria::IN); $objs = PaisesPeer::doSelect($criteria, $con); } return $objs; }
<option value="0">... <?php echo __('Seleccione uno'); ?> ...</option><?php $paises = PaisesPeer::doSelect(new Criteria()); foreach ($paises as $pais => $pa) { if (isset($id_pais) && $id_pais == $pa->getPid()) { ?> <option title="<?php echo $pa->getPais(); ?> " value="<?php echo $pa->getPid(); ?> " selected="selected"><?php echo $pa->getPais(); ?> </option><?php } else { ?> <option title="<?php echo $pa->getPais(); ?> " value="<?php echo $pa->getPid(); ?> "><?php echo $pa->getPais(); ?> </option><?php }