YUI Based Lightbox – Final
symfony tips: Global app.yml for Multiple Applications
I will be writing several posts related to tips I have learn or discovered in developing websites using symfony. For readers who don't know that symfony is, it is a PHP 5 based wed development frame which enables developers to rapidly build feature-rich websites by providing a set of reusable codes and common tools required by day-to-day web development. You can read more about symfony here.
Read more »A Simple Yet Powerful PHP Template Engine
This is not yet another regular expression replacement template engine. The template engine uses PHP itself to render the template. The template itself is very intuitive to people who are already familiar with PHP. There is no extra learning for additional syntax - the template code itself is just plain PHP code. Though I haven't done any benchmark, from my past experience of using it, it is pretty fast - consider that it consists of less than 100 lines of code. Thinking of using Smarty?
Read more »
ctRotator – A Flexible Item/Image Rotator Script for jQuery
I was taking part in developing an interesting web application - the Thank You Project. During which I made an item rotator script that swaps a list of messages in and out from the message board. I find the rotator script is very useful, so I decide to share it. To get an overview of what the script can do, you can check the demonstration page first.
Ajax Response Helper for PHP
In Ajax programming development, passing data back and forth between client and server is a common task. There are two major data formats that one can use for this purpose, namely XML and JSON. My personal preference is JSON because I find it's less verbose and easier to parse.
Although latest PHP provides a very handy function (json_encode) for outputting data in JSON format, for almost every Ajax request I handle on the server side, I have to routinely format the data in a certain way so I can use it conveniently on the client side. For example, to indicate whether it is a valid Ajax request, I embed an field called has_error in every response. I find it's getting annoying after a while, so I wrote a class to automate things a bit.
Fading Effect with YUI’s Animation Utility
In YUI's Animation Utility example page there are demonstrations on how to create color and motion animations. However I couldn't find an example for how to create fading effect. After spending some time on trying different approaches, I came up with this code snip:
var aniObj = new YAHOO.util.Anim(
'DOM reference or ID' ,
{ opacity: {from: 0, to: 1 } },
'duration in second',
'easing'
);
where easing can be one of the following:
YAHOO.util.Easing.backBoth YAHOO.util.Easing.backIn YAHOO.util.Easing.backOut YAHOO.util.Easing.bounceBoth YAHOO.util.Easing.bounceIn YAHOO.util.Easing.bounceOut YAHOO.util.Easing.easeBoth YAHOO.util.Easing.easeBothStrong YAHOO.util.Easing.easeIn YAHOO.util.Easing.easeInStrong YAHOO.util.Easing.easeNone YAHOO.util.Easing.easeOut YAHOO.util.Easing.easeOutStrong YAHOO.util.Easing.elasticBoth YAHOO.util.Easing.elasticIn YAHOO.util.Easing.elasticOut
Creating a Digg This Button for Your WordPress Blog
Creating a Digg This button is very easy. Here's a non-plugin approach:
<script type="text/javascript"> digg_url = '< ?php the_permalink() ?>'; digg_title = '< ?php the_title() ?>'; </script> <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
Copy and paste above script to anywhere between your WordPress' theloop:
Instead post specific Digg button, you can create a site wide button as well:
<script type="text/javascript">
digg_url = '< ?php bloginfo('url'); ?>';
digg_title = '< ?php bloginfo('name'); ?>';
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>

