One can override the myUser class in the frontend/lib directory. One can put new functions like getViewedHistory(), setViewedHistory() there. To get a table info, use DoctrineCore::getTable() Once get the table, use ->createQuery() Basics of getting history – getAttribute(), setAttribute(). In the template use $sf_user-> to call the methods. in apps/backend/config/security.yml, default: is_secure change to true. … Continue reading

Dev diary

Went to work usual time. But am quite exhausted so finds it hard to focus. Took a few minutes to gather my thoughts and get started. Found the place where John described- but not sure how and where to do this? Finds it hard to think because am unfamiliar. Started writing anyway. Also figured out … Continue reading

Symfony partial

Include partial in the same module, can skip module name. Because it can be included by other modules, partials requires all params to pass to it.


Component- for example, having a news component that depends on user preferences which can be included in several pages. Action.class.php—- component.class.php SfAction- sfComponent ExecuteMyAction- executeMyXxx MyActionSuccess.php- _myxxx.php

Symfony view more

Helpers. If you override a helper file make sure you override all as there is no inheritance. Symfony uses the decorator pattern to form the page. Layout.php has a sf_data to hold the template data. To include code fragments, use partial to include simple HTML, component to include some logic, and slot to replace stuff … Continue reading

Symfony helpers

Helpers uses underscore naming convention, rather than camel case, as they are functions rather than class methods. Default helpers included in every template are: URL, Helper, Tag, Asset, Partial, Cache, Form. They can configurable in the settings.yml file. To use a helper outside of the template, use sfLoader::loadHelpers(‘Text’)

Symfony links

Action names and URL can be completely different. In template we can use link_to() from the route tags. Link_to() can also have params like class, confirm, absolute. Getting request from the user, In action $this->getRequestParameter(‘name’); In template, $sf_params->get(‘name’);

Symfony template

Already has some global variables such as sf_context, sf_request (request), sf_params (request parameters), sf_user (sessions)

Goal this week

– Be familiar with how component works. In particular how the banner component work. Can understand how it is generated and included. – Write a component myself.