Colorbox: resize iframe dynamically

July 30th, 2010

As Colorbox can not auto calculate iframe’s width and height, therefore developer has to give a specific width and height when using Colorbox with iframe.

And here is my solution to resize iframe dynamically, meaning using this workaround, you can leave it for Colorbox to calculate iframe’s width and height and resize it.


$(".colorbox").colorbox(

{iframe:true,

innerWidth:0,

innerHeight:0,

scrolling:false,

onComplete:function(){

$.colorbox.resize(

{

innerHeight:($('iframe').offset().top + $('iframe').height()),

innerWidth:($('iframe').offset().left + $('iframe').width())

}

);

}

}

);

What we did here is firstly we create Colorbox with 0 width and 0 height, when it is loaded, we calculate the document size of the iframe content and resize it using Colorbox’s API

admin 2-Javascript, General Javascript, JQuery , , ,

CakePHP common errors part 3

July 9th, 2010

This is a very strange error I have met in my last project, which is JSON data being cut off on my server when it is working fine on my localhost.

The case is I have an array($arrayData) with 300 length, and I am using $javascript->object($arrayData) to encode it to JSON in the view(json-view.ctp). It gives correct JSON data on my localhost, however when I moved the application to live server, it keeps on giving an incomplete JSON, which causes an incorrect JSON format. I tried to google for the solutions, some guys suggested to look into the php config file, to set max_execution_time and so on, but it did not solve the problem.

I have not found the cause of the error so far, however I have found out a workaround, and I hope you find it helpful too:
instead of using CakePHP built-in JSON encode function($javascript->object), I used native php JSON encode function(json_encode), and I need to encode it direct inside my controller action, and that solves the problem. Taking my application as an example, for json_view.ctp, leave it blank, and inside controller action jsonView(), do $jsonData=json_encode($arrayData); echo $jsonData;

If you know the reason which is causing this, do let us know!

admin 1-CakePHP, General Cakephp , , , , ,

Map My Client

July 6th, 2010

mmc

MMC(map my client) combines the power of Google Map and CakePHP to give you an easy way to manage your clients(contacts) from a geography view.
With the power of Google Map, you enable yourself and coworkers to view your clients on a map. With the power of CakePHP,
you can update clients’ info from user-friendly admin panel and create different roles to view/manage the map.

Feature:

  1. Automally geocode from a valid address, no need to use any third party tools to find out the lat/lng of an address. MMC will do this for you.
  2. Authentication is required to view the map.
  3. Admin has the power to create two different roles of users which are admin user and member user. Admin user has the power to manage content, and member user only has the right to view the map.
  4. CakePHP made the installation even easier. Just upload the whole folder into your server and do some minor configuration.

DEMO:

Demo Page: http://www.the-di-lab.com/mmc

Admin: admin/admin

Client: client/client

Get it now from CodeCanyon: http://codecanyon.net/item/map-my-client/111279

admin 3-Code Canyon Items , , ,

Google Map API v3 polygon shape creator

June 24th, 2010

About

Polygon Creator is a javascript class which can be used to draw a ploygon shape on Google Map, and it currently has two public functions to return the polygon paths and its color.
It is useful if you are looking for a ready to use Javascript tool to create polygon for your Google Map application.
Polygon Creator is built with Jquery and written in a OOP coding style. It is written in Goolge Map API v3.
And of course, it is completely free, so please make use of it.

How

  1. Include scripts

    Include Google Map API:

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    Include JQuery:

    <script type="text/javascript" src="jquery-1.4.2.min.js"></script>

    Include Polygon Creator class:

    <script type="text/javascript" src="polygon.min.js"></script>
  2. Create a map object

    If you have already constructed a map object, then you can skip this step. And just keep in mind, you will use the same map object to create Polygon Creator.
    First make sure you have a Div with id=”main-map” in your page body,then construct a map object as below:

               var singapoerCenter=new google.maps.LatLng(1.37584, 103.829);
    		 var myOptions = {
    		  	zoom: 10,
    		  	center: singapoerCenter,
    		  	mapTypeId: google.maps.MapTypeId.ROADMAP
    		  }
    		 map = new google.maps.Map(document.getElementById('main-map'), myOptions);
              
  3. Construct Polygon Creator object

    The parameter of PolygonCreator is the map which we have created above.

                var creator = new PolygonCreator(map);
               
  4. Test and Run

    Now you should be able to draw polygon shape on your google map. And there are two class functions you can call to retrieve polygon information:

     creator.showData()  
     creator.showColor() 

Demo and Download

admin JQuery , , , , ,

Some eCommerce platform comparison

June 8th, 2010

As a PHP developer, I always need to pick up a weapon to complete a certain task. And recently I have met a potential client who wants to develop an eCommerce site. So the first things comes to my mind is to do a research on popular eCommerce platform. I google around and find four popular open source eCommerce platforms on the web. And they are magento, oscommerce, opencart and prestaShop.

And below are some factors I found useful to myself.

  Magento Oscommerce Opencart PrestaShop
Default Template elegant simple elegant normal
Code Design Pattern MVC unknown MVC MVC
Template engine Zend Framework template system unknown simple template smarty template engine
Extensibility excellent poor medium medium
Url link link link link
Remarks Developed by Zend Framework It has been market for long, and it is considered as a old solution    

I hope you find my simple research useful for you too.

admin General Cakephp , , , ,

From Faces Magazine

May 29th, 2010
Joshua Turk, Publisher
Faces Magazine



Now to find a developer who you can give that much trust to is definitely worth mentioning in this testimonial.  “

The-Di-Lab exuded speed and precision in an outstanding display of programming to complete my desired project. Our company provided the creative files, The-Di-Lab executed the programming for the project. I needed a very specialized and custom application built that was very unique. The-Di-Lab met with every project requirement I had in a streamline fashion.


With his wealth of knowledge and experience in programming, The-Di-Lab was able to provide excellent programming consultation when it came down to decisions and options I would have to make in order to complete the project. After receiving valuable advice from The-Di-Lab I was able to create a more stable and efficient application then I had ever thought before.


When I had first posted the request for this specialized application, I received his response the same day, and after a few emails was able to start the project that very same day. Due to his very well spoken English, I had no problem working with a developer overseas.


He was very easy to work with and was easy to reach a deal with a set of payment terms. Trust is another trait I look for while dealing with programming developer, and The-Di-Lab kept the construction of my unique application confidential.


The-Di-Lab also installed all the necessary files right on my server and were given login and password information for future proects.


Now to find a developer who you can give that much trust to is definitely worth mentioning in this testimonial.


It was such a delight to work with The-Di-Lab, and after witnessing his awesome skill and completion of an entire project  at The-Di-Lab, I will definitely return to him with more work, In fact The-Di-Lab have been promoted to my go-to Programming developer.


admin 4-Testimonials ,

Simple Private Message System

May 26th, 2010

pms

PMS(private message system) is a very simple PM system, which can be used for communication.
It can be integrated into your existing application even.

Feature:

  1. It is lightweight with pure PHP scripts and only two database table.
  2. Thread messages(messagea are categorized according to senders).
  3. WYSIWYG text editor.

DEMO:

Demo Page: http://www.the-di-lab.com/pms-demo/index.php

Username: userA Password: admin

Username: userB Password: admin

Username: userC Password: admin

Username: userD Password: admin

Username: userE Password: admin

cc_180x100_v2

Get it now at CodeCanyon: http://codecanyon.net/item/simple-private-message-system/104565

admin 3-Code Canyon Items , , , , ,

str_ireplace() crashes my server[php function]

May 24th, 2010

I think this is a bug from PHP.

Here is my server info:

php version 5.2.1

Apache/2.2.4 (Win32)

The crash happens when I use str_ireplace() with subject string with duplicated characters, such as testtest,testtttttt etc.

So check your application and make sure str_ireplace() is used safely.

admin General Cakephp

Node(dynamic menu)

May 12th, 2010

node

Node is a dynamic menu system based on pure PHP without any framework requirement. Node comes with a control panel where you can add/edit/delete menu items as well as shift menu item’s position.

Basically Node outputs a <ul> markup, and leave it yourself to choose any Javascript and Css to form its look and feel.

The real magic thing about Node is that it gives you a tree control panel, where you can easily change your menu’s content. It makes coding a dynamic menu as easy as writing a few lines in your code.

Feature:

  1. It is lightweight with pure PHP scripts and only one database table.
  2. It comes with very user friendly control panel (tree editor).
  3. 3Built your dynamic menu with only 4 lines coding.

 

DEMO:

Client Page: http://www.the-di-lab.com/node-demo/node/demo/
Control panel: http://www.the-di-lab.com/node-demo/node/admin/node_c.php

cc_180x100_v2

Get it now at CodeCanyon: http://codecanyon.net/item/node-dynamic-menu-made-easy/101754

admin 3-Code Canyon Items , ,

jChasing menu(Simple JQuery Plugin)

March 26th, 2010

jchasing

Online Demo: http://www.the-di-lab.com/jchasing-demo/demo.html

Source: http://github.com/dilab/jchasing

jChasing menu simulates the effect of mouse pointer being chased by the menu button. It is a high configurable plug-in. With the help of jQuery easing plug-in (http://gsgd.co.uk/sandbox/jquery/easing/), you will have the freedom to use 20 plus animation effects provided. Since jChasing is built with CSS, you can easily change its design as well.

Please post issues here, So I could keep track of it.

admin JQuery ,

Get Adobe Flash playerPlugin by wpburn.com wordpress themes