0
Feature SDK / API<br />Presentation By:<br />Kumar Pratikpratikk@langoor.net<br />
Overview: Feature Development<br />What a developer should know before coding?<br />How widgets work on editor?<br />How t...
What should you know before coding?<br />HTML & CSS<br />JavaScript (Jqueryframework)<br />PHP 5.3<br />MySQL <br />ZendDB...
Youtube widget<br />
Creating your first feature (hello world)<br />
Feature Database<br />Every feature has its own database<br />When a feature is installed on a domain, it creates a new da...
Feature Database Access database using phpMyAdmin<br />
Feature Database Access database using phpMyAdmin<br />
// feature.php  - Feature Main Installer Class<br />// Class pratikHelloWorld extends baseFeature {<br />	private $key = ‘...
// pratikHelloWorldView/widget.php  - Feature Main Installer Class<br />// Class pratikHelloWorldView extends baseWidget {...
SDK / API -  Response formatcreating a form response (install/getProperty function)<br />$response = array();<br />$respon...
SDK / API -  Responsecreating a html response (install/getProperty function)<br />$response = array();<br />$response['don...
SDK / API -  Responsefor opening widget panel (install/getProperty function)<br />$response = array();<br />$response['don...
SDK / API  -  Responsecreating a html response with form (install/getProperty function)<br />$html = “<br /><h2>html conte...
Creating a form handler for widget<br />// widget.php<br />Public function addcomment($params){<br />	$params= $params[0];...
Zend DB Sample Query<br />$stmt = $db->query(<br />            'SELECT * FROM bugs WHERE reported_by = ? AND bug_status = ...
Thank you!<br />Kumar  Pratik<br />pratikk@langoor.net<br />
Upcoming SlideShare
Loading in...5
×

Extend sdk

726

Published on

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
726
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Extend sdk"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×