Blogs

Symfony Tips: Use the referer to customize messages on Symfony

On symfony is a good idea to use the referer to costomize some messages, like this one below.

in template, you have to make a condition:

<?php if( $sf_request->getReferer() != '' ): ?>
  The page <?php echo $sf_request->getParameter('page'); ?> was changed.
<?php else: ?>

Usando o case do bash

Exemplo de código que demonstra a utilização do uso de CASE no bash.


#!/bin/bash
clear
echo "Diga o que deseja fazer:"
echo "1)Criar diretório"
echo "2)Criar arquivo"
echo "7)Sair do script e voltar ao console"

read n

case $n in 

[1])
  echo "Digite um nome para o diretório"
  read nome1
  touch "./"$nome1
;;

[2])
  

How to configure a symfony app on plesk 9.0.1

I'm running plesk 9.0.1 and I configured my app on a subdomain, I did these steps to configure the app:

1) remove all default directories of domain

rm -rf /var/www/vhosts/example.com.br/subdomains/myapp/*

2) I put my files on document_root, like this
/var/www/vhosts/example.com.br/subdomains/myapp/conf,
/var/www/vhosts/example.com.br/subdomains/myapp/symfony

Symfony date widget limit 5 years forward/backward + admin generator

I was creating a new project and I wanted to create on model Client a field called birthday as DATE field. I noticed that the admin generator form created a limited year's select to 5 forward and backward. I'm too change the format of field of mm/dd/yyyy to dd/mm/yyyy. How can I did it?

You need to override the formClass, like this:

class ClientForm extends BaseClientForm
{
  

How to create a cacheable xml-rpc request on Symfony

Recently I needed to use the xml-rpc lib with symfony. I created a function to make cache of xml-rpc requests using the symfony's sfFileCache and it work good.

I'm using the xml-rpc library that you can get on http://phpxmlrpc.sourceforge.net/


public function callCache( $methodName, $params ){
  // generated a key to cache file
  
Syndicate content