Blog Archives

How to set default values (input field) in symfony 1.4 generated forms

I was trying to set default values for an input field. public function executeNew(sfWebRequest $request) { $this->customer = Doctrine::getTable(‘Customer’)->find(array($request->getParameter(‘customer’))); $this->forward404Unless($this->customer); $this->form = new CallLogForm(); $this->form->setDefault(‘customer_id’,$request->getParameter(‘customer’)); } This is the way to set hidden values of default values for an input

Tagged with: , , ,
Posted in framework, Symfony

Symfony Study Guide – Small Project Implementation

Download Symfony Sandbox 1.4 Source : www.symfony-project.org/installation Requirement : Xampp or Wamp Package PHP: 5.2 Above Download Symfony and put this into your website root Rename sf_sandbox to your project name. Here it is CRM open config/properties.yml file and put

Tagged with: , , , , , , ,
Posted in framework, PHP, Projects, Symfony

Symfony 1.4 Doctrine Pagination

Doctrine Pagination is made very simple . public function executeIndex(sfWebRequest $request) { $this->pager = new sfDoctrinePager(‘TableName’, sfConfig::get(‘app_max_jobs_on_homepage’); $this->pager->setQuery(Doctrine::getTable(‘TableName’)->createQuery(‘a’)); $this->pager->setPage($request->getParameter(‘page’, 1)); $this->pager->init(); } Success page <?php foreach ($pager->getResults() as $post): ?><div> <?php if($post->getTitle()) { echo link_to($post->getTitle(), ‘news/fullstory?expand=’.$post->getId(),’class=”mhead”‘); } ?> <?php if($post->getDn2()!=”)

Tagged with: ,
Posted in database, framework, PHP, Project Managament, Symfony

Symfony 1.2 File Upload

class mymoduleActions extends sfActions { public function executeUpload($request) { if ($request->hasFiles()) { foreach ($request->getFileNames() as $uploadedFile) { $fileName = $request->getFileName($uploadedFile); $fileSize = $request->getFileSize($uploadedFile); $fileType = $request->getFileType($uploadedFile); $fileError = $request->hasFileError($uploadedFile); $uploadDir = sfConfig::get(‘sf_upload_dir’); $request->moveFile($uploadedFile, $uploadDir.’/’.$fileName); } } }

Tagged with:
Posted in framework, PHP

Symfony – The PHP Frame work :: Based on MVC architecture !!

Symfony is a full-stack framework, a library of cohesive classes written in PHP5 . Symfony provides an architecture, components and tools for developers to build complex web applications faster. Symfony help you to develop your applications @ early, low cost, secure

Tagged with: , , , , , ,
Posted in framework