Symfony - settings.yml (escaping_strategy: true)
Wednesday, May 30, 2012
use
htmlspecialchars_decode(htmls);
not use
escaping_strategy: false
quick notes
use
htmlspecialchars_decode(htmls);
not use
escaping_strategy: false
class PhotoForm extends BasePhotoForm
{
public function configure()
{
$this->setWidgets(array(
'photo' => new sfWidgetFormInputFile(array('label' => 'Зураг')),
));
$this->setValidators(array(
'photo' => new sfValidatorFile(
array(
'required' => false,
'max_size' => 5242880,
'path' => sfConfig::get('sf_upload_dir'),
'mime_types' => array(
'image/jpeg',
'image/pjpeg',
'image/png',
'image/x-png',
'image/gif',
),
'validated_file_class' => 'sfValidatedFileLocations'
),
array(
'required' => 'Та зураг оруулна уу',
'max_size' => 'Таны оруулсан зурагны хэмжээ иx байна. Хамгийн иxдээ 5MB.',
'mime_types' => 'Та зөвxөн зурган файл оруулаx боломжтой')),
));
$this->widgetSchema['photo'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Зураг',
'file_src' => FtpHandler::FTPFOLDER . 'files/' . $this->getObject()->getPhoto(),
'is_image' => true,
'edit_mode' => !$this->isNew(),
), array('width' => 500));
$this->widgetSchema->setNameFormat('photo[%s]');
}
}
Doctrine RUD
READ
$row = Doctrine_Query::create()
->select('count(t.id) as cnt')
->from('Table t')
->where('t.field = ?', 1)
->addWhere('t.field2 = ?', 'blabla')
->fetchArray();
echo $row['0']['cnt'];
pager
$query = Doctrine_Query::create()->from('Table a');
$pager = new sfDoctrinePager('Table', self::PER_PAGE);
$pager->setQuery($query);
$pager->setPage($page);
$pager->init();
return $pager
public function save(Doctrine_Connection $conn = null)
{
if ($this->isNew()) {
$this->setUserId(sfContext::getInstance()->getUser()->getId());
$this->setCreatedAt(date('Y-m-d H:i:s'));
}
return parent::save($conn);
}
HttpServletRequest request = FlexContext.getHttpRequest();
String clientIP = request.getRemoteAddr();
class newsComponents extends sfComponents
{
public function executeCall()
{
echo $this->id_bna;
return sfView::NONE;
}
}
// FORM SUBMIT HANDLER
$(document).ready(function() {
$('#formId').submit(function() {
if ($('#formId input[type=checkbox]:checked').length) {
return confirm("Устгах уу?");
} else {
alert('Ядаж нэг утга сонгоно уу!');
return false;
}
});
});
$pdo = Doctrine_Manager::connection()->getDbh();
$sql = 'select id, name, descr, created_at from news where name like :name-value and descr like :descr-value';
$stmt = $pdo->prepare($sql);
$params = array("name-value" => $name, "descr-value" => '%' . $descr . '%');
$stmt->execute($params);
// or
$sql = 'select id, name, descr, created_at from news where name like ? and descr like ?';
$stmt = $pdo->prepare($sql);
$params = array($name, '%' . $descr . '%');
$stmt->execute($params);
return $stmt->fetchAll();
Apple monopoly цаг нь өнгөрчээ. Google.s android.g гаргаснаас хойш nokia болон apple.n утаснуудаас бусад нь android.g aшиглах болсон. Android бол Linux юм. Энэхүү нээллтэй систем маш хурдацтай хөгжиж байна.
Аndroid дээр програм бичихэд юу мэдэж байвал зүгээр вэ?
Back to TOP