Your SlideShare is downloading. ×
0
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Extend sdk
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Extend sdk

721

Published on

This presentation contains description about how to use Developer SDK/API to develop features for langoor.net website builder.

This presentation contains description about how to use Developer SDK/API to develop features for langoor.net website builder.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
721
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Feature SDK / API
    Presentation By:
    Kumar Pratikpratikk@langoor.net
  • 2. Overview: Feature Development
    What a developer should know before coding?
    How widgets work on editor?
    How to create your own feature?
    Creating your first feature ( Hello World! )
    Adding components (widget) to your feature
    SDK / API – Quick Overview
    Response from feature/widgets to editor & website
    Form
    Html
    Code framework functions
    Install
    setProperty
    getProperty
    hasProperty
    Zend DB API
  • 3. What should you know before coding?
    HTML & CSS
    JavaScript (Jqueryframework)
    PHP 5.3
    MySQL
    ZendDB
  • 4. Youtube widget
  • 5. Creating your first feature (hello world)
  • 6. Feature Database
    Every feature has its own database
    When a feature is installed on a domain, it creates a new database (copying from the feature master database)
    Developer can access the database using phpMyAdmin
    A feature can have multiple widgets in it, and all the widgets will use the same database for accessing its data.
  • 7. Feature Database Access database using phpMyAdmin
  • 8. Feature Database Access database using phpMyAdmin
  • 9.
  • 10.
  • 11.
  • 12. // feature.php - Feature Main Installer Class
    // Class pratikHelloWorld extends baseFeature {
    private $key = ‘d21a868268f8a43b268ee4937a1d8161';
    var $db;
    var $instance_id;
    public function __construct($db, $instance_id = -1){
    $this->db = $db;
    $this->instance_id = $instance_id;
    }
    public function setInstanceId($instance_id){
    $this->instance_id = $instance_id;
    }
    public function install($data = array()){
    if(LFeature::setupComplete($this->key,$this->instance_id)){
    $response['done'] = 1;
    $response['action'] = "openWidgetPopup";
    $response['new_widgets'] = LWidget::getWidgetIdsByFeatureKey($this->key);
    }else{
    throw new Exception('Unable to Complete setup');
    }
    return $response;
    }
    //---------------- Developer Code ----------------
    // }
  • 13. // pratikHelloWorldView/widget.php - Feature Main Installer Class
    // Class pratikHelloWorldView extends baseWidget {
    //---------------- Developer Code ----------------
    var $id;
    public function __construct($id, $params=array(), $db){
    $this->db = $db;
    $this->id = $id;
    }
    public function getId() { return $this->id; }
    public function hasProperty() { return 0; }
    public function delete() { }
    private function get() { }
    public function getData() { }
    public static function install($params = array()){
    $response['done'] = 1;
    $response['widget_instance_id'] = -1;
    return $response;
    }
    public functiongetHtml($extra_class=array(),$extra_in_line_style=''){
    $html = '<div style="width:100%; padding-bottom:10px;">';
    $html .= "Hello world!";
    $html .= '</div>';
    return $html;
    }
    public functiongetEditorHtml($extra_class=array(),$extra_in_line_style=''){ return $this->getHtml($extra_class,$extra_in_line_style);}
    // }
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. SDK / API - Response formatcreating a form response (install/getProperty function)
    $response = array();
    $response['done'] = 0;
    $response['action'] = "openDialog";
    $response['dialogContent'] = array( "title"=>'User Comment Widget', "contentType"=>'form', "formaction"=>'install', "content" => array( "fields" => array( array( "label" => 'Name', "name" => 'name', "value" => '', "inputType" => 'input', "class" => 'required' // jQuery Validators ) ) ), "buttonLabel"=>"Install", "type" => "centered“
    );
  • 19. SDK / API - Responsecreating a html response (install/getProperty function)
    $response = array();
    $response['done'] = 0;
    $response['action'] = "openDialog";
    $response['dialogContent'] = array( "title"=>'User Comment Widget', "contentType"=>‘html', "content" => “<h2>html content</h2><br /> This is a test content”, "buttonLabel"=>"Install", "type" => "centered“
    );
  • 20. SDK / API - Responsefor opening widget panel (install/getProperty function)
    $response = array();
    $response['done'] = 1;
    $response['step'] = ++$step;
    $response['widget_instance_id'] = $this->db->lastInsertId();
  • 21. SDK / API - Responsecreating a html response with form (install/getProperty function)
    $html = “
    <h2>html content</h2>
    <br /> This is a test content
    <form action=“addcomment”><table>
    <tr> <td>Name</td>
    <td><input type = “text” name=“name”></td>
    </tr><tr>
    <td>Age</td>
    <td><input type = “text” name=“age” class=“requirednumber”></td>
    </tr>
    </table></form>
    “;
    $response = array();
    $response['done'] = 0;
    $response['action'] = "openDialog";
    $response['dialogContent'] = array( "title"=>'User Comment Widget', "contentType"=>‘html', "content“ => $html,
    "buttonLabel"=>“Add Entry", "type" => "centered“
    );
  • 22. Creating a form handler for widget
    // widget.php
    Public function addcomment($params){
    $params= $params[0];
    $name = $params['name'];
    $age= $params[‘age'];
    $sql = "insert into `l_w_pratikHelloWorld_entry` (`name`, `age`) values (?,?)";
    $res = $this->db->query($sql,array($name,$age));
    return true;
    }
  • 23. Zend DB Sample Query
    $stmt = $db->query(
                'SELECT * FROM bugs WHERE reported_by = ? AND bug_status = ?',
                array('goofy', 'FIXED')
            );
    $stmt = $db->query('SELECT * FROM bugs');
     while ($row = $stmt->fetch()) {
        echo $row['bug_description'];
    }
    $stmt = $db->query('SELECT * FROM bugs');
     $rows = $stmt->fetchAll();
     echo $rows[0]['bug_description'];
  • 24. Thank you!
    Kumar Pratik
    pratikk@langoor.net

×