Archive

Posts Tagged ‘Symfony’

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

May 17th, 2010 R Arun Raj No comments

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 field

$this->form->setDefault(‘customer_id’,$request->getParameter(‘customer’));

Categories: Symfony, framework Tags: , , ,

Symfony Study Guide – Small Project Implementation

May 15th, 2010 R Arun Raj No comments

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 below details

[symfony]
name=CRM
author=Arun Raj R
orm=Doctrine

Read more…

Symfony 1.4 Doctrine Pagination

May 14th, 2010 R Arun Raj No comments

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()!=”) { echo image_tag($post->getDn2()); } ?>
<?php $content=$post->getContent();
$stripcontent=substr($content,” “,700);
echo $stripcontent;
?>
<div style=”display:block;” > <?php echo $post->getCreatedAt(); ?><?php echo link_to(“Full Story”, ‘news/fullstory?expand=’.$post->getId(),’class=”fullstory”‘) ?> <br /><br />
</div></div>
<?php endforeach ?>

pagination

<?php if ($pager->haveToPaginate())  { ?>

<div id=”navv”>

<?php echo link_to(‘Latest’, ‘news/index?page=’.$pager->getFirstPage(),’class=”pager”‘) ?>
<?php echo link_to(‘prev’, ‘news/index?page=’.$pager->getPreviousPage(),’class=”pager”‘ ) ?>
<?php $links = $pager->getLinks(); foreach ($links as $page): ?>
<?php echo ($page == $pager->getPage()) ? $page : link_to($page, ‘news/index?page=’.$page,’class=”pager”‘) ;?>
<?php if ($page != $pager->getCurrentMaxLink()): ?> <?php endif ?>
<?php endforeach ?>
<?php echo link_to(‘next’, ‘news/index?page=’.$pager->getNextPage(),’class=”pager”‘) ?>
<?php echo link_to(‘Oldest’, ‘news/index?page=’.$pager->getLastPage(),’class=”pager”‘) ?>
<?php } ?></div>

How to deploy Symfony project using sync or rsync

March 6th, 2009 R Arun Raj No comments

install rsync

http://trac.symfony-project.org/wiki/SymfonySyncOnWindows

Download rsync and extract it to c:\windows\system32

Then run the command symfony project:deploy production

Using rsync for Incremental File Transfer

Uploading the whole project again and again is little irritating .. ! It is wastage of time bandwidth and money . We can reduce this by using rsync .If you want to update your application then just use rsync. It will upload modified files only.

for more details use this link

http://www.symfony-project.org/book/1_0/16-Application-Management-Tools

Categories: Misk, PHP, Projects Tags: , , ,

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

April 5th, 2008 R Arun Raj No comments

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 scalable and maintain them easily .

Symfony Features

Symfony was built in order to fulfill the following requirements:

  • Easy to install and configure on most platforms (and guaranteed to work on standard *nix and Windows platforms)
  • Database engine-independent
  • Simple to use, in most cases, but still flexible enough to adapt to complex cases
  • Based on the premise of convention over configuration–the developer needs to configure only the unconventional
  • Compliant with most web best practices and design patterns
  • Enterprise-ready–adaptable to existing information technology (IT) policies and architectures, and stable enough for long-term projects
  • Very readable code, with phpDocumentor comments, for easy maintenance
  • Easy to extend, allowing for integration with other vendor libraries

Automated Web Project Features

Most of the common features of web projects are automated within symfony, as follows:

  • The built-in internationalization layer allows for both data and interface translation, as well as content localization.
  • The presentation uses templates and layouts that can be built by HTML designers without any knowledge of the framework. Helpers reduce the amount of presentation code to write by encapsulating large portions of code in simple function calls.
  • Forms support automated validation and repopulation, and this ensures a good quality of data in the database and a better user experience.
  • Output escaping protects applications from attacks via corrupted data.
  • The cache management features reduce bandwidth usage and server load.
  • Authentication and credential features facilitate the creation of restricted sections and user security management.
  • Routing and smart URLs make the page address part of the interface and search-engine friendly.
  • Built-in e-mail and API management features allow web applications to go beyond the classic browser interactions.
  • Lists are more user-friendly thanks to automated pagination, sorting, and filtering.
  • Factories, plug-ins, and mixins provide a high level of extensibility.
  • Ajax interactions are easy to implement thanks to one-line helpers that encapsulate cross-browser-compatible JavaScript effects.

Before you get started with symfony, you should understand a few basic concepts. OOP, ORM, RAD, DRY, KISS, TDD, YAML, Prototype , PROPEL, and PEAR

http://symfony-project.org

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin