Latest Updates: symfony RSS

    Symfony application with UI and development code under same structure

  • Muhammad Rizwan 5:22 pm on August 5, 2010 Comments
    Tags: symfony

    I have been thinking,for quite a long time, of some technique by which one can share the same view files between the developer and the designer inside a symfony based application.

    So lets try to do something interesting with symfony and make this possible.
    The basic idea behind it is to devise a method that can make it possible to share the assets (JS files, CSS files, Images etc etc) between the two key persons involved, the developer and the designer so that if any change is made by the guy who is designing something, it automatically gets visible in the application( without the need for the developer to implement it ).

    Let’s say the designer is working on the theme of the application, which includes changes in images, CSS and JS files while keeping the structure of pages intact. What happens in routine practice is, the designer makes the changes and hands the updated files over to the developer who embeds the modifications into the CSS and images. The separation of two tasks requires more time and it becomes somewhat difficult for the two people to work on the same view file(s).

    For a symfony project the directory structure looks like this:

    1-riz

    Now inside the ‘web’ folder, there are ‘Images, CSS and JS’ folders which contain the Images, CSS and JS files by default.

    Let’s play a little with symfony configuration and create a theme structure!

    Create a ‘theme’ folder and within this, create ‘frontend’ and ‘backend’ sub folders. Each of these sub folders will contain themes for the frontend and backend separately, so that we can switch between themes easily in case the need arises.
    Having accomplished this, we will have a directory structure which will look somewhat like this:

    3-riz

    Notice that we have moved the ‘images, css and js’ folders from main ‘web’ folder to their respective UI folders. We get two advantages by doing so: separation of assets of different applications (Layouts) and managing them inside different themes.

    Now lets change the application configuration classes so that the default directories for frontend and backend are changed and symfony knows where to look for the required files.

    You can make following changes in ‘apps/frontend/config/frontendConfiguration.class.php

    Notice that we are changing only the configure() function.

    public function configure()
         {
           $current_theme = 'first_ui';
           sfConfig::add (
                          array (
                                   'sf_web_images_dir_name' = 'themes' . '/' . 'frontend' . '/' . $current_theme . '/' . 'images',
                                   'sf_web_css_dir_name' = 'themes' . '/' . 'frontend' . '/' . $current_theme . '/' . 'css',
                                   'sf_web_js_dir_name' = 'themes' . '/' . 'frontend' . '/' . $current_theme . '/' . 'js'
                                 )
                          );
         }

    This is the time to move all of your images, css anf js files to the respective folders inside the theme folder and symfony will automatically load them from this location.
    Now for the last point, in order for the designers to use the same css,js and images lets create a folder ‘xhtml’ inside the main project directory. For this the directory structure will be as follows:

    2-riz

    Put the html files inside frontend and backend ‘first_ui’ folder and use relative paths for images,css and js files.
    To summarize, the benefits which can be obtained by using the above mentioned technique, are:

    1. No need of the developers to implement minor changes given by designers, designers can directly edit design changes right into the application.
    2. No need to manage separate svn for application code and application Ui, each UI change will be there side by side the application code inside the same svn repository.

Zigron Launches DareMyCompany.com

  • Qurratulain Akhtar 10:52 am on November 14, 2008 Comments
    Tags: AJAX, , symfony

    After the successful launch of PingMyCompany, Zigron decided to develop a more interactive site where employees of different companies can have real fun. It’s DareMyCompany, whereby one company can dare others to compete in anything. For instance, lately a team of MOHAA players from Zigron had a match with MediaLinkers.

    It’s not only about daring companies locally, instead you can dare an overseas company, for instance for design and development contests. So be as innovative as you can to dare companies in the areas where no one has ever dared them.

    Each company when registered will have a Dare Profile with all their stats. There’s a ladder also for company’s position, and it gets updated as any two companies have a contest, and post their result.

    Soon we will publish the exact rules for using the ladder and how positions are calculated. Till then please enjoy the site and start challenging other firms.

  • CodeIgniter, does one really need it?

  • Jawad Khan 3:23 pm on October 21, 2008 Comments
    Tags: codeigniter, MVC framework, OOP, , php cake framework, symfony

    Few weeks ago, I started work to make my own PHP based MVC framework, all I wanted was a simpler and lighter MVC framework. I just intended to write a controller which can communicate with the model and views. In my googling, I found out CodeIgniter reviews, which were something like “a light weight PHP framework”. I started to look into CodeIgniter. I found it exactly as I was looking for. There was no need to re-invent the wheel, so I spent next few nights with the codeIgniter. I had already worked with Symfony and little bit with cakePHP, so the question arises why to look for any other PHP MVC framework? even when these both are the top frameworks in most comparisons. The answer is yes, Actually Symfony is really great framework for medium to large web applications. It’s good if project is very much scalable and got proper time-line. But If you got a project in which you really need to apply RAD ‘Rapid application development’, in which you do not have much time for deployments, framework installations, PEAR installations, framework plugins supports, You don’t want to do Propel build models and re-generate ORM classes or you simply can’t spend time on writing YAML schema files. In addition to these you also do not want your code to get messy, you really don’t want the business-logic and presentation together in single files OR you just want nothing fancy but a simple MVC framework where you just code and execute. So that’s where CodeIgniter fits in.

    Not only CI is light weight, but to assist Programmers write faster code, it comes up with already made classes like: File uploading Class, FTP class, Email class (which supports HTML email, attachments), Pagination, Data encryption, calendar classes and few more. These all classes are by default part of CI. To use those classes, programmers need to include them in their actions. CI uses Active Record for database access, which is fairly simple. CI does all error logging just like the giant frameworks. CI also uses Search Engine Friendly URLs by default.

    Now with open source PHP frameworks like CI, symfony and cakePHP, coding is done OOPs way, code remains managed and re-usable. Also Web-applications are built faster and scalable. The good thing about PHP related technologies is that they are open-source, which also means greater and world wide support through a healthy and ever growing community.