随笔分类 - Symfony
摘要:Custom 400 page:In config/settings.yml,all:.actions: error_404_module: error error_404_action: 404Then when a page is not found, it will forward to "<your_domain>/error/404".Custom 500 page:1. Create "error" folder under "config"2. create "error.html.php"
阅读全文
摘要:Most of my web application have some kind of hierarchical structure in their models. It gives my users the ability to categorize their data in a pleasant way. The only problem is that its hard to create a user interface for editing these hierarchies. I made a prototype which adds nested set support
阅读全文
摘要:$mailFrom = GrapheConfig::get('app_admin_email'); $mailTo = $request->getParameter('email'); $mailSubject = 'Merci pour votre pré-inscription!'; /*$view = new sfPartialView($this->getContext(), $this->getModuleName(), $this->getActionName(), 'confi...
阅读全文
摘要:From:http://jasonswett.net/blog/inheritance-with-symfony-and-doctrine-orm/ The Problem Doctrine ORM claims to support some kind of inheritance but I have yet to see a good example. The inheritance documentation on the Doctrine ORM site could be worse but it certainly has a lot of room for improveme.
阅读全文
摘要:Here we go !The sort in admin generator is for a single field only, but in some complex list, it can be usefull to sort by multiple criterias. This is the main goal of this snippet. Those functions therefore override the ones of your auto-generated class.(1)And to display what are the ongoing sort c
阅读全文
摘要:From:http://trac.symfony-project.org/wiki/ConvertingPropelProjectToDoctrineI encourage everyone to add / edit this page to make it more useful to others. In this page I have used and linked to other sources. By no means do I claim ownership/credit or anything else about this page, it's simply a
阅读全文
摘要:In Symfony 1.4, we dont have Javascript Helper anymore, instead, we have a JavascriptBase helper.
阅读全文
摘要:这是一个在从Symfony中, 当从Propel转换到Doctrine时,会出现在错误在propel中, 可以使用 parent::getName()class Image extends BaseImage{ public function getName() { return parent::getName(); } ...在doctrine中,若想实现同样的效果, 要改为$this->_get('name');public function getName(){ return $this->_get('name');}
阅读全文
摘要:First, in sfWidgetFormTextareaTinyMce class we set:protected function configure($options = array(), $attributes = array()) { ...... $this->addOption('imagemanager_rootpath', 'mydir'); ...... }public function render($name, $value = null, $attributes = array(), $errors = array()) {
阅读全文
摘要:Up to last week I was exclusively an XCache user if we talk about PHP accelerators. Recently I needed to use APC with a symfony application. As symfony offers nice APC integration it went quite smooth.Note that just enabling PHP accelerator (any) improves performance because of the opcode caching. T
阅读全文
摘要:Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)...I hate this message, in fact it says «You suck, you don’t even know what you’re doing with your objects». It happened recently when I was writing a script which retrieves old data from an old database, comp
阅读全文
摘要:This is a simple helper to create a tag cloud from an array of tags.Creating a tag cloud is as easy as calling the helper:<?php use_helper('Tagcloud'); TagcloudHelper::showCloud($tags);Where tags is an array that is defined in the following syntax: array('tag1' => 10, 'tag2
阅读全文
摘要:the link is : http://garakkio.altervista.org/datepickerui/#
阅读全文
摘要:A few weeks ago I had a talk with @meandmymonkey about using app.yml in your symfony tasks. His special use case was that he wanted to make use of the options configured in his global app.yml. So we took a closer look at the task again and found something that turned out to be fix of our problem.Wha
阅读全文
摘要:1. Create the class:<?phpclass grapheWidgetFormFrequency extends sfWidgetForm{ protected function configure($options = array(), $attributes = array()) { $this->addRequiredOption('number'); $this->addRequiredOption('type'); $this->addOption('template', '%number
阅读全文
摘要:If you need to export database data as a CSV file in Symfony, try this;In the action:public function executeRegistrantsToCsv(){ $id = $this->getRequestParameter('id'); $c = new Criteria(); $c->add(RegistrantPeer::EVENT_ID, $id); $c->add(RegistrantPeer::STATUS, 1); $this->aObjReg
阅读全文
摘要:You need to modify your EntityFormFilter (where Entity is your object class - Article, Book, etc.).Three easy steps1) configure functionAdd an input for each field you want to include in your filter$this->widgetSchema['name'] = new sfWidgetFormFilterInput(array('with_empty' =>
阅读全文
摘要:In the class, add this:$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);$context = sfContext::createInstance($configuration);$configuration->loadHelpers('url', 'Partial');then try to call the helplers
阅读全文
摘要:A symfony project is made of one or more applications. Applications share nothing, but the model classes. But sometimes, you need the ability to create links to a frontend application from a backend one. Think about a CMS backend where you want the user to edit an article and then link to the corres
阅读全文
摘要:Lets consider sfWidgetFormDoctrineChoice form select object with multiple elements:$this->setWidgets(array('books' => new sfWidgetFormDoctrineChoice(array('model' => 'Book', 'expanded' => true, 'multiple' => true)),));So it will obviously take a
阅读全文