handling checkboxes in symfony forms 1.2

Checkboxes aren’t really covered in the tutorial for forms in 1.2.  However, it’s covered pretty well on the blog over here:

http://www.symfony-project.org/blog/2008/10/14/new-in-symfony-1-2-make-your-choice

One thing to note:  if you need a multiple checkboxes for one value (in php it’s handled like so: varname[]), you would use the sfWidgetFormChoice with the multiple=>true and expanded=>true.

Also, if it’s an array of values, use sfValidatorChoiceMany instead of sfValidatorChoice.

-d

escaping output in symfony – wtf is going on????

Ok, I was a little confused as to what the hell was happening when I escaped my output in symfony.  It looks like the 1.2 framework takes all your values and objectifies them, putting them into classes.  For your arrays, they go into sfOutputEscaperArrayDecorator.

What this means is that now when you are trying to use the array in a view, you need to call the getRaw function that sfOutputEscaperArrayDecorator has.  SO:

in your action:

$my_array = array(1,2,3,4);

in your view print_r($my_array) will throw in error.  what you need to do instead is:

print_r($my_array->getRawValue());

I haven’t tested the rest of the objects out, but im assuming you can get the actual object by calling getRaw() on the variable name.

-d

You is the closer!

So I worked on a quick one pager site (http://www.isthecloser.com) with a co-worker (Jason) from Tribal that merged two wav files to create a funny short wav clip.  Check it out.

To build the site, I used two technologies:

1) Flite – an open source text-to-speech system developed by CMU.  It was a low quality wav, but did the job well.  I also used Espeak, but the code looked like it required the server to a sound card installed, which mine does not.  So I switched over to flite instead.

2)  SOX – an open source sound exchange application.  I originally used the default one that came with CentOS 5, but it lacked the feature of sequencing the sounds together instead of merging them on top of each other.  So I uninstalled the default rpm and downloaded the code base and recompiled the latest version.

The code wasn’t too complicated, it was just figuring out how to get all the stuff to work together.  First get flite to spit out a wav:

/usr/local/bin/flite -t “‘ . $name . ‘” -o /tmp/closertemp/’ . $rand . ‘.wav’

the -t option is to use the text that’s passed in instead of a file

then I push it to sox:

/usr/local/bin/sox –combine concatenate /tmp/closertemp/’ . $rand . ‘.wav /tmp/TheCloser_1.wav /tmp/’ . $rand . ‘.wav’

the rand # is to make sure i always produce a unique file name for every request.