Alex Tech Adventures The webs best tutorials!

PhpFreeChat theme

E-mail Print PDF
(0 votes, average 0 out of 5)

My client requested chat that looks a certain way and he would not accept anything else. Without an existing chat foundation on the site, I had to get one and customize it. I chose phpfreechat and as it looks nothing like required I had to dig deep into CSS and fully reconstruct it. Unfortunately some of the customizations required were not as simple as editing the template file. After 3 days of struggle and finally a desperate call for help on twitter I finally was able to do the job.

The idea was to make some elements hidden and I thought visibility: hidden property would do the trick. After all, adding it as an attribute in FireBug editor produced expected results. When putting the property into the template, however, nothing changed. In fact, this new property did not even show up anywhere in DOM/CSS inspector. An attempt to create a new template also failed: even after putting my new template name into phpfreechat parameter list, the front-end JS would always call default. These two reasons led me to believe that there were caching problems, since what I put into the CSS file never got to the front-end. Clearing the cache directory manually produced no results: neither the theme would switch or new visibility property would show up in the inspector.
Two wonderful people from twitter,bensternthal and joeyrivera, volunteered to help me out. From what we discovered, PHC does not pass the CSS file directly to the browser as one would expect but is instead parsed by PHP and send to JS frontend in terms of attribute: value format which are then applied to their respective HTML elements using prototype's set method. For a long time we tried many things to bypass cache, which involved passing a random url paramter to the AJAX calls. None of this worked. All that we tried returned the same results.

According to the site, the best way to clear cache is to clear data directory. However, the real way to clear it is to rehash the request from the chat input using /rehash (suggested by bensternthal). This is the only way new object parameters, such as theme name, are accepted. So after /rehash at least the frontend was able to switch from default theme to my custom one. Yet my visibility attribute still would not show up. As mentioned by joeyrivera, I looked inside fschat.php?pfc_ajax=1&f=loadChat to see what exactly it was doing (this was actually how I figured out how CSS file is being parsed). To my surprise I noticed that my visibility parameter was passed to the frontend. So why was it not in the inspector?? Why is it that when I add it manually in FireBug it worked but did not show up when I put it in the theme file??

Changing some other random parameters I noticed that at this point cache was not a problem. I could change everything else like text colors. So problem was with my visibility attribute them. I've never been on good terms with CSS so please excuse me if I should have known this but after some further research I found that there is another way to make something invisible using display:none attribute which worked!!! Not knowing all the theory behind CSS I am still not sure why would visibility:hidden work in insepctor but not when passed through CSS while display:none worked as needed.

That said cache still was a problem to a certain extent: /rehash is still need to switch the themes and re-invoke the parser when something major changes and it is actually enough without having add random parameters to the urls in the source.

Big thanks to the forthmentioned developers for leading me into the right direction.
Last Updated ( Wednesday, 20 January 2010 00:14 )  
Discuss (5 posts)
PhpFreeChat theme
Jan 21 2010 02:23:35
Hello Alex.

After following your tutorials, my knowledge on Zend improved a few times before. I miss your next video tutorial (perhaps all of us). Come back Alex
#357
Re:PhpFreeChat theme
Jan 21 2010 04:03:10
Oh i know i know and I have so many requests to take care of too
My current project is keeping me busy and my client is not very happy with me going over the deadline.
In the mean time I am trying to answer as many questions around forum as I can.
#358
PhpFreeChat theme
Jan 22 2010 03:02:20
indeed you are missed! Now get done with that project, get paid, and get back to what you must really love!
#366
PhpFreeChat theme
Jan 22 2010 03:20:36
Alex, why don't you enable donation link?
I may not donate much but if you collect all such drops I believe you'll make ocean and you will always have very happy friends instead of many disturbing unhappy customers.
#367
PhpFreeChat theme
Jan 22 2010 04:55:18
>> instead of many disturbing unhappy customers
Well, at least this time around I am doing something programming related. Before this week during 4 months I had to teach high school kids MS Word :...(

Alright, I've been asked so many times by now I guess I'll give in and put it up.
#368

You need to login or register to post comments.
Discuss...
You are here: Home Development (X) HTML / CSS / JavaScript PhpFreeChat theme

Statistics

Members : 571
Content : 36
Web Links : 1
Content View Hits : 40321

Who's Online

We have 37 guests online