Monday, July 03, 2006

some more Ajax where it really makes sense

I've put some more Ajax into BAOssimo!
looking around at the different frameworks it was quickly evident that the minimal solution would be the best: my-bic just does the dirty work around the asynchronous communication - all the set-up is completely configurable by the developer
This means more manual work but also more flexibility.
Another big plus for me is that it is readily wrapped in PHP.
I want to share some points that made initial deployment difficult for me:

1. in one of the tutorials given by my-bic an element id of 'content' is used - this seems to be a keyword for the global document --> changing the innerHTML of 'content' replaced the entire document for me
Solution: use a different id like 'changingContent'.

2. depending on the browser special characters got mixed up. BAOssimo is a site in French language and therefore uses lots of special characters everywhere (using iso-8859-1) .
Solution: edit mybic_server.php and add the following line
header("Content-type: text/html; charset=iso-8859-1");
echo $response;
similarly if you need to convert postings back to iso-8859-1 on the server side (they arrive there as utf-8) as follows before plugging them into your mysql database:
$posted_text = mb_convert_encoding(urldecode($this->queryVars['posting_textfield']), "ISO-8859-1", "UTF-8");

In general: be careful not to open up any new holes in your secure CMS ;) - SQL injection etc...

For an example have a look at the filter implementation on BAOssimo! Resto (site in French, as I said, but you'll see how it works easily enough).

Several other blogs have discussed my-bic before me:


Post a Comment

Links to this post:

Create a Link

Send Forret trackback ping

<< Home