PHP | Techbirds | Page 2

Posted on: June 19, 2014 /

Categories: PHP / Author Name: Diksha Verma

I am writing this post ..because  i hv strucked  in a problem in binding  jquery events with classes which were created dynamically in future.  i.e. the content(table) was made with Ajax. As we know, in document.ready function : The jQuery document ready function executes when the DOM (Document Object Model) is completely loaded in the

Read More →

691 total views, no views today

Posted on: May 25, 2014 /

Categories: PHP / Author Name: Anand Kumar

Problem : model which doesn’t actually have a table. for example validating a form on site e.g contact form Solution :

class ContactForm extends AppModel { var $name = ‘contactForm’; var $useTable = false; var $_schema = array( ‘name’ => array(‘type’=>’string’, ‘length’=>100), ’email’ => array(‘type’=>’string’, ‘length’=>255), ‘details’ => array(‘type’=>’text’) ); var $validate = array( ‘name’ => array( ‘rule’=>array(‘minLength’, 1), ‘message’=>’Name is required’ ), ’email’ => array( ‘rule’=>’email’, ‘message’=>’Must be a valid email address’ ), ‘details’ => array( ‘rule’=>array(‘minLength’, 1), ‘message’=>’Feedback is required’ ) ); }

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

class ContactForm extends AppModel {

    var $name = ‘contactForm’;

    var $useTable = false;

    var $_schema = array(

        ‘name’        =>    array(‘type’=>’string’, ‘length’=>100),

        ’email’        =>    array(‘type’=>’string’, ‘length’=>255),

        ‘details’    =>    array(‘type’=>’text’)

    );

    var $validate = array(

        ‘name’ => array(

            ‘rule’=>array(‘minLength’, 1),

            ‘message’=>’Name is required’ ),

        ’email’ => array(

            ‘rule’=>’email’,

            ‘message’=>’Must be a valid email address’ ),

        ‘details’ => array(

            ‘rule’=>array(‘minLength’, 1),

            ‘message’=>’Feedback is required’ )

    );

}

Note: just use var $useTable = false; 573 total views, no views today

573 total views, no views today

Posted on: May 22, 2014 /

Categories: PHP / Author Name: Shivek Parmar

In some projects we may need to convert HTML content to PDF for various reasons: transfer, storage, print.The presentation below will try to guide you how to do it, using PHP.When available, we concentrate on open-source or free solutions as first choice. This solution uses DOMPDF project. It simply gets a HTML text and generates a

Read More →

803 total views, 1 views today

Posted on: May 15, 2014 /

Categories: PHP / Author Name: Rahul

When working on php websites made from scratch and without a framework, speed can often be an issue. Caching is extremely useful in order to speed up PHP webpages. In this article, I’ll show you a super easy and efficient way to dynamically cache php pages that need to be faster. Step one: Create the

Read More →

724 total views, no views today

Posted on: May 14, 2014 /

Categories: PHP / Author Name: Rahul

I recently needed to display a list of authors within a WordPress blog.  The goal was to sort the author list by number of posts before outputting the list.  The method for calculating number of posts isn’t a sortable key within WordPress’ get_posts, so I had to sort the result list myself.  PHP’s usort method, along with a

Read More →

697 total views, no views today