Recent Comments

    Search

    Rss Posts

    Rss Comments

    Login

     

    General Billing

    Sep 17 2011

    As a freelance developer, I’m always struggling to find the right billing application to send invoices to my clients.

    I have used many billing applications (like freshbooks.com), but I’m not always happy with the limitations of a free license. For example you can only add 10 clients, send 20 invoices a month etc. For any person trying to start a business, you don’t always have money to spend on a billing application. You try to keep things as cheap as possible.

    While there are many free applications you can use to do your billing, none of them really have all the features you require, or are sufficient enough.

    So I decided to write my own billing application. I am a huge fan of open-source, so I decided to create my application as an open-source project. This will hopefully get the community involved, and help make a kick-ass application that will benefit many.

    I’m basing the project on the Zend framework with the jQuery and jQuery UI library. The basic features I’m starting with is client management and send quotes and invoices. I’m hoping to add some project management modules, and some general features that will benefit every kind of business.

    The first alpha release should be available in the next couple of months. Let me know if you think of any crucial features the application should have, or just leave your comments or ideas of what you think of a general open-source billing application

    Bookmark and Share

    Detect mobile devices with the WURFL API

    Dec 07 2009

    This component uses the WURFL API to detect any mobile or wireless device, and sets custom paths for your views and css, so you can easily create a mobile version of your website.

    Lets get started.

    The WURFL API

    First of all, download the WURFL API package here (Make sure to download the 1.1 version).

    Extract the entire WURFL folder in the package to your /app/vendors folder.
    Create a directory /app/configs/wurfl, and extract everything in the resources folder to that directory.

    In the examples/resources directory, extract the file in the wurfl-regression.zip to your /app/configs/wurfl directory.
    Edit the wurfl-config.xml file to look like the following:

    < ?xml version="1.0" encoding="UTF-8"?>
    
        
    		
    wurfl.xml
    web_browsers_patch.xml
    file dir=../../tmp/cache/wurfl null

    Create the folder /app/tmp/cache/wurfl.

    The Component

    Create a file /app/controllers/components/mobiledetect.php and put the following in the file:

    < ?php
    class MobiledetectComponent extends Object
    {
        var $isMobile = false;
        function startup(&$controller)
        {
            $this->controller =& $controller;
        }
        function detect()
        {
    		App::import( 'Vendor', 'WURFL', array( 'file' => 'WURFLManagerProvider.php'));
    		$wurflConfigFile = CONFIGS.'wurfl/wurfl-config.xml';
    		$wurflManager = WURFL_WURFLManagerProvider::getWURFLManager($wurflConfigFile);
    		$requestingDevice = $wurflManager->getDeviceForHttpRequest($_SERVER);
    		if($requestingDevice->getCapability('is_wireless_device') == 'true')
    		{
                            $this->isMobile = true;
    			$this->setMobile();
                            $this->controller->theme = 'mobile';
              		$this->controller->layoutPath = 'mobile';
    		}
        }
    }
    

    In your app_controller, remember to include the component like this:

    < ?php
    var $components = array('Mobiledetect');
    ?>
    

    and add to the beforeFilter function the following:

    < ?php
    function beforeFilter()
    {
        $this->Mobiledetect->startup($this);
        $this->Mobiledetect->detect();
    }
    

    And thats it! Now you can create a custom layout file for your mobile website, located under /app/views/layouts/mobile.
    You also need to put your css in a directory in /app/webroot/themed/mobile/css
    and (optional)images in /app/webroot/themed/mobile/css/img.
    Your views need to go to /app/views/themed/mobile.

    Your done! Now you can create a mobile version of your website.

    Bookmark and Share

    Getting correct url for cakePHP link

    Dec 02 2009

    Many cakephp newbies might not know how to correctly generate a url for their app, for maybe a link or a redirect etc, especially if your cake app is in a subdirectory.

    So let’s say you have a website www.example.com, and you have a blog written with cakePHP in a sub directory www.example.com/blog.

    it is very easy to just make a link like this:

        <a href="/blog/post/view/2">link to post</a>
    

    Of course you can’t just use ‘post/view/2′ as the link href, because you would then end up at www.example.com/post/view/2 or any other weird directory which is not what we want.

    So the best way for cake to generate the correct url that we want every time would be to use:

    < ?php
        App::import('Router');
        echo '<a href="'.Router::url(array('controller' => 'post', 'action' => 'view', 2)).'>Link to post</a>';
    ?>
    

    With the Router class and its function ‘url’, cake would always create the correct url for all your links.
    And another great thing about it is that you can move your app around to any directory or sub directory or sub domain and all your links would still work without a problem.

    Of course it would be best to use

    <?php
        echo $html->link('Link to post', array('controller' => 'post', 'action' => 'view', 2));
    ?>
    

    in your views, but you can use Router::url() anywhere in your app, if for some reason you would want to create a link outside of a view.

    Bookmark and Share
     

    Page optimized by WP Minify WordPress Plugin

    Optimized by SEO Ultimate