symfony: import sfGuardUser data

Categories: misc, bookmark, frameworks | Tags: import, sfguard, symfony

since i need to run ‘symfony propel:build-all-load‘ constantly while developing a symfony project, to save myself from creating users for sfGuard plugin everytime it’s run, data from related table were dumped then saved as fixture data so that they are automatically loaded when i run the command.

i ran into problem that i’m unable to login after data were imported.

it seems that the encrypted passwords were encrypted again during the import process.

thankfully i was able to find a forum post with the exact problem. and there is a solution! (just scroll down the page)

remember to specify the application when you run ‘build-all-load’!


xajax and IE: append table row

Categories: html, php, ajax | Tags: ie, table, xajax

append a table row should sound straight forward when using with a xajax function.

you have a table, and a button within a form,

Code:

<table>
  <th><td>header1</td><td>header2</td></th>
  <tbody id="tbody_id">
  </tbody>
</table>
 
<input type="button" onClick="xajax_add_row(xajax.getFormValues('form_id'));" />

the code to append a row to table:

PHP:

function add_row($data) {
  $obj = new xajaxResponse();
  $obj->append('tbody_id''innerHTML'
    '<tr><td>' $data['input1'] . '</td><td>' $data['input2'] . '</td></tr>');
  return $obj;
}

it works perfectly in firefox. but nothing is happening when you click the button in IE.

i’ve wasted a lot of time trying to find out why. and finally found this forum post,

Read more »

javascript calling xajax functions with boolean parameter

Categories: javascript, ajax | Tags: boolean, javascript, string, xajax

when passing a boolean value from javascript to a xajax function, the value is converted to string in the xajax function.

you need to compare the string value of the boolean value (from javascript) in your xajax function.

eg, if you have the following code in your xajax function, this will not work:

PHP:

function my_xajax_function($flag) {
  $obj = new xajaxResponse();
  $obj->assign('some_id_name''className'$flag'true_class' 'false_class');
  return $obj;
}

in the above code, the ‘false_class’ will always be assigned.

replace line 3 from above with the following:

$obj->assign(’some_id_name’, ‘className’, ($flag == “true") ? ‘true_class’ : ‘false_class’);


b2evo: comments or trackback spams

Categories: b2evo | Tags: antispam, b2evo, block ip address, htaccess

every now and then i get spams in my trackbacks and comments with non-sense message. not those that tell you how to be a man kind of spam. nor advestisements of some sites or services. just some random string that doesn’t make sense.

i can’t block it because it’s using google’s various urls as url. this blog is setup to allow traffics from search engines and that will block 99% of my traffic!

so i found whoo’s antispam technique to rename url for comments and trackbacks:

Read more »

symfony: renaming application and module

Categories: bookmark, frameworks | Tags: rename, symfony

while working a symfony project and decided that you don’t like the name of the module (blame it on bad design or insufficient plan) and wanted to rename it?

i tried what seems the right thing to do, rename the directory name of the module. it didn’t work! you get this error:

Action “new_module_name/index” does not exist

even the magical symfony cc does not work.

so i asked google and found how to rename a symfony module. and also found how to rename a symfony application. both written by the founder of symfony!

i’m going to keep this bookmark handy for my future references.

additional step for renaming application

the tip didn’t mention V1.2. when i followed the instruction, it wasn’t working. i got error the the application does not exist.

just do this extra step. go to your new_application/config. rename the file [old_application]Configuration.class.php to [new_application]Configuration.class.php.


1 2 3 4 5 6 7 8 9 10 11 ... 23 »

Affliates

Spreadfirefox Affiliate Button

Programming Blog Directory