Archive

Posts Tagged ‘symfony’

Types of PHP Framework: Glue and Full-Stack

May 10th, 2008

PHP frameworks are in great news from 1-2 years in PHP community. Lots of PHP frameworks are available to choose from. Framework is good for development for few reasons. This provides lots of developed code for reuse. All frameworks have community where developers can get help. Discussing your problem there… READ MORE

Simple Login Code in PHP for Symfony

Apr 12th, 2008

This post is for login code in Symfony Framework. Here is a simple PHP Login Code!
This is very simple login script written for symfony framework. This will ask for loginid and password like any login page. After successful login it will send user to list page. If unsuccessful, this… READ MORE

Forms Error Catching and Displaying in Symfony

Apr 8th, 2008

In actions.class.php page of symfony framework, you can catch errors and display those errors in template. Set errors in your action/method using:

<?php
if ($error) {
$this->getRequest()->setError(‘userName’, ‘The user Name field cannot be left blank’);
$this->getRequest()->setError(‘email’, ‘The Email field cannot be left blank’);
return false;
}
?>

Return false is… READ MORE

YML vs XML Schema Files in Symfony

Feb 9th, 2008

Schema file is used for defining your database schema for your application. Schema file will generate all the required data structure for you. This schema provides backbone for generating model to Symfony.
Schema.xml file allows database specific content declaration for your table. It also allows complex database declaration for your… READ MORE

Restore Data When Rebuilding Model in Symfony

Feb 9th, 2008

Whenever you rebuild your model, you have to loose your old data in Symfony. You will need to rebuild model whenever you change or add something new to your schema. If you are learning Symfony then you may not bother to loose data and may not feel too much for… READ MORE

Assign File Extension to pages in Symfony

Feb 3rd, 2008

You can very easily assign file extension of your choice to pages in Symfony framework. Go to your modules’s ./config/settings.xml file and assign page extension of your choice. If settings.yml page is not available then create it.

prod:
.settings:
no_script_name: off
suffix: .html

dev:
.settings:
error_reporting: 4095
web_debug: on
no_script_name:… READ MORE

Add your own pages in Symfony

Feb 3rd, 2008

For adding any template page in symfony, add your template to apps/appName/modules/urModule/templates/ dir. Name it like listSuccess.php. Now for accessing this page from browser, you need to associate this page from an action. Define an action for this page. As you named your page like listSuccess.php, you need to create… READ MORE