Archives for 2008
I’m going to show a way that I’ve found to easily edit N1 relationships with the admin generator of symfony 1.2 Surely it can be polished, and maybe it could be done better another way, if you know how please let me know. We are going to use the next model schema: # config/schema.yml propel: lista: [...]
Today I needed to access a webserver with phpMyAdmin configured as default page if no virtual host matched the requested one. It was configured to deny access from outside so my solution was to use a SSH tunnel: carlos$ ssh -L 10080:192.168.1.3:80 user@host So I can access phpMyAdmin writting this in my browser address bar: localhost:10080 That’s all!
Recently I discovered that Firefox lets you override alert and confirm window object methods. I tried this with prototype and surprisingly it just worked! (Note that it is not tested in IE or Opera and others yet, but it also works in Safari). <div id="test" style="background:red;color:white;display:none;"></div> <script type="text/javascript"> window.confirm = function (s) { alert(s); }; window.alert = function (s) [...]
I hope the title is self-explanatory … Several times, in a symfony project or a project which runs with the help of the prototype library, some problems arise regarding the scope of certain javascripts variables declared inside ajax request (that can be theyselves declared within other ajax request). Usually , you need to access certain javascript varible [...]
dWhen executing this code: $this->items = $object->getItens(); ... foreach($this->items as $item) { ...yadda yadda $item->getId() yadda yadada } within a symfony action, the php engine throws: Notice: Indirect modification of overloaded property xxxActions::$items has no effect in xxxactions.class.php That’s related to a php bug , whose implications in symfony are described here. It looks like it’s related to php 5.2. I can see it [...]
You can see regular expression examples at this site. Very useful. This is the content: Examples Numeric Ranges Floating Point Numbers Email Addresses Valid Dates Credit Card Numbers Matching Complete Lines Deleting Duplicate Lines Programming Two Near Words
I was looking for some actions sharing methods weird solution (since I was trying to apply a per-action classes model, and I needed to use methods from one action onto another), and I had no luck at all. However, what I did find out was fabien saying repeteadly that actions code should not be messy, hard [...]
The concept around this is to serve a 1px image through a PHP script. This allows you to insert a new record or update an existing one about read mails. In your mail you only have to insert an image tag like this at the end of the template: <img src="<?php echo url_for('stats/image?bulletin='.$id, 'absolute=true') ?>" alt="px.gif" /> And [...]
Nuestros queridos amigos de Joomla / Joomla Spanish, ni sé ni quiero echar las culpas a nadie, se han olvidado un trozo de código en una query para borrar imágenes y saltaba el mensajito de: No tiene permiso para acceder a esta sección o algo similar. Lo que hay que hacer es, en la línea 251 del fichero [...]
Generating a CSV file from an action to bring it to the users of one of our websites I encountered myself with the problem of Symfony’s MVC model and decorator pattern. Although I was using echo statements directly, Symfony was waiting for the action to finish to send headers and allow the download, so the [...]
Las cabeceras X-JSON salen de un modo misterioso en la documentacion de Prototype, e incluso en la de symfony. Pues bien, tiene utilidad, vienen muy bien para enviar datos desde la operacion ajax hecha en el servidor hasta la funcion javascript que se suele ejecutar en el status ‘complete’ Pero pasemos a un ejemplo:
Es posible combinar los dos métodos de validación del symfony, de modo que se pueda usar el fichero yml para las validaciones más comunes, y el método validateXXX() para alguna validación más especial Para el caso – por ejemplo – donde uno o varios de los campos de un formulario requira una validación compleja, mientras [...]
Cuando escribimos con el symfony un form_remote_tag(), si luego pretendemos, a traves de javascript, realizar acciones cuando el evento ’submit’ del formulario ocurra, tendremos que andarmos con mucho ojo. Cuando en symfony escribimos: echo form_remote_tag(array( 'update'=>'formulario', 'url'=>'forms/microMasInfo', 'script'=>'true')); el symfony genera: <form onsubmit="new Ajax.Updater('formulario', [...]
Cuando el nombre de la tabla en la base de datos difiere del nombre en el modelo de objetos, necesitamos obtener el “phpName”. Una forma de hacer esto, útil cuando solamente tenemos un nombre de tabla y un ID, es: $tabla = Propel::getDatabaseMap()->getTable($miNombreDeTabla); $phpName = $tabla->getPhpName() ? $tabla->getPhpName() : sfInflector::camelize($tabla->getName()); return call_user_func(array($phpName.'Peer', 'retrieveByPK'), $miID); Por si a alguien le [...]
Pegándome con el widget de Plaxo para obtener contactos de correo desde cuentas de servicios web públicos he necesitado sacar por un lado el nombre del “individuo” y por otro su dirección de email para insertarlo en unos controles de un formulario. Como no tengo ni idea de expresiones regulares, etc, etc, etc… me ha llevado [...]
Sobre el flash y los links internos. Parece ser que, motivo de una medida de seguridad, el objeto flash tiene la siguiente ‘limitacion’ o restriccion: cuando el servidor donde está alojado el archivo flash (el definido en el parámetro “movie”) no coincide con el servidor donde está alojado el codigo html que realiza la llamada al flash (el [...]
/etc/init.d/openbsd-inetd restart Fácil ¿eh? A mí me llevó unos minutos encontrarlo.
Let me introduce a new category of “quick&dirty” tricks to apply when “quick&dirty” things happen in symfony (yes, they happen). After a new pear upgrade, a new “bug” may appear concerning sfPropelADministrator. something similar to this may show up: Notice: Undefined offset: 1 in /usr/share/php/symfony/config/sfGeneratorConfigHandler.class.php on line 69 and … [sfParseException] You must specify a “moduleName” This is related to [...]
Recent Comments