![]() |
|
Snippets |
|
How to use sfMail to encode Body of Japanese Email.
The Japanese Email usually use ISO-2022-JP. But, I want to use UTF-8 of any Email template files. For example...
I create PROJECT_DIR/lib/myMail.class.php
myMail.class.php
<?php class myMail extends sfMail { public function setBody ($body) { parent::setBody(mb_convert_encoding($body, "JIS", "UTF-8")); } } ?>
OK, Use this class from your Action.
actions.class.php
public function executeSendmail() { $mail = new myMail(); .... }
The boolean is set to The third argument.
<?php echo radiobutton_tag('status', 'value1', true) ?> <?php echo radiobutton_tag('status', 'value2', false) ?>
It write like this.
<?php echo radiobutton_tag("status", "value1", $sf_params->get("status") == 'value1'); ?> <?php echo radiobutton_tag("status", "value2", $sf_params->get("status") == 'value2'); ?>
if you using multiple database from Propel, It can be solve by writing two or more schema files.
PROJECT_DIR/config/databases.yml
all:
database1:
class: sfPropelDatabase
param:
dsn: pgsql://foo:bar@hostname/database1
database2:
class: sfPropelDatabase
param:
dsn: mysql://foo:bar@hostname/database2
PROJECT_DIR/config/database1.schema.xml
<?xml version="1.0" encoding="UTF-8"?> <database name="database1" defaultIdMethod="native" noxsd="true"> <table name="foo" phpName="Foo"> .... </table> </database>
PROJECT_DIR/config/database2.schema.xml
<?xml version="1.0" encoding="UTF-8"?> <database name="database2" defaultIdMethod="native" noxsd="true"> <table name="bar" phpName="Bar"> .... </table> </database>
Last, build model command.
$ symfony propel-build-model
Build complete.
Example, getting multiple databases connection handler.
$database1_connection_handler = Propel::getConnection(FooPeer::DATABASE_NAME); $database2_connection_handler = Propel::getConnection(BarPeer::DATABASE_NAME);