documentation:create_first_plugin
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| documentation:create_first_plugin [2015/08/24 05:12] – external edit 127.0.0.1 | documentation:create_first_plugin [2015/09/03 04:08] (current) – [Create an element] mooeditor | ||
|---|---|---|---|
| Line 686: | Line 686: | ||
| Create new ctp file in **/ | Create new ctp file in **/ | ||
| + | |||
| + | > New in version 2.2.1> Your ctp file must be place at / | ||
| + | |||
| <file php myNotes.ctp> | <file php myNotes.ctp> | ||
| Line 762: | Line 765: | ||
| //]]> | //]]> | ||
| <?php $this-> | <?php $this-> | ||
| + | </ | ||
| + | |||
| + | |||
| + | > New in version 2.2.1> You don't have to use $this→requestAction() method to get the need variables anymore e.g: <font 10.0ptline-height: | ||
| + | <file php myNotesWidget.ctp> | ||
| + | |||
| + | <?php | ||
| + | App:: | ||
| + | class MyNotesWidget extends Widget { | ||
| + | public function beforeRender(Controller $controller) { | ||
| + | $this-> | ||
| + | $notes = $this-> | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | )); | ||
| + | $controller-> | ||
| + | } | ||
| </ | </ | ||
| Line 1034: | Line 1055: | ||
| <file php NoteSettingsController.php> | <file php NoteSettingsController.php> | ||
| - | |||
| <?php | <?php | ||
| class NoteSettingsController extends NoteAppController{ | class NoteSettingsController extends NoteAppController{ | ||
| Line 1100: | Line 1120: | ||
| Which case do we need? In common, almost plugin settings needn' | Which case do we need? In common, almost plugin settings needn' | ||
| + | |||
| + | > New in version 2.2** ** > In version 2.2, the " | ||
| ==== Create boot setting ==== | ==== Create boot setting ==== | ||
| Line 1262: | Line 1284: | ||
| * Update **/ | * Update **/ | ||
| - | <code file Note.php> | + | Note.php |
| + | <code file> | ||
| <?php | <?php | ||
| App:: | App:: | ||
| Line 1305: | Line 1328: | ||
| <file php bootstrap.php> | <file php bootstrap.php> | ||
| - | |||
| <?php | <?php | ||
| App:: | App:: | ||
| Line 1410: | Line 1432: | ||
| <file sql / | <file sql / | ||
| - | |||
| CREATE TABLE IF NOT EXISTS {PREFIX}notes ( | CREATE TABLE IF NOT EXISTS {PREFIX}notes ( | ||
| id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, | id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, | ||
| Line 1438: | Line 1459: | ||
| <file sql Copy SQL to / | <file sql Copy SQL to / | ||
| - | |||
| DROP TABLE IF EXISTS {PREFIX}notes; | DROP TABLE IF EXISTS {PREFIX}notes; | ||
| DELETE FROM {PREFIX}core_blocks WHERE path_view = ' | DELETE FROM {PREFIX}core_blocks WHERE path_view = ' | ||
| Line 1723: | Line 1743: | ||
| <file php NotesController.php> | <file php NotesController.php> | ||
| - | |||
| if ($this-> | if ($this-> | ||
| - | //Tag system | + | //Tag system |
| $this-> | $this-> | ||
| $this-> | $this-> | ||
| // | // | ||
| - | + | ||
| $this-> | $this-> | ||
| return $this-> | return $this-> | ||
| Line 1737: | Line 1756: | ||
| <file php add.ctp> | <file php add.ctp> | ||
| - | + | //Tag system | |
| - | //Tag system | + | |
| <div class=" | <div class=" | ||
| < | < | ||
| Line 1754: | Line 1772: | ||
| <code php> | <code php> | ||
| - | |||
| if ($this-> | if ($this-> | ||
| $this-> | $this-> | ||
| $this-> | $this-> | ||
| if ($this-> | if ($this-> | ||
| - | //Tag system | + | //Tag system |
| $this-> | $this-> | ||
| // | // | ||
| - | + | ||
| $this-> | $this-> | ||
| return $this-> | return $this-> | ||
| Line 1774: | Line 1791: | ||
| </ | </ | ||
| - | |||
| <file php edit.ctp> | <file php edit.ctp> | ||
| - | |||
| //Tag system | //Tag system | ||
| <li> | <li> | ||
| Line 1783: | Line 1798: | ||
| < | < | ||
| </ | </ | ||
| - | <? | + | <?php |
| $tags_value = ''; | $tags_value = ''; | ||
| if (!empty($tags)) $tags_value = implode(', | if (!empty($tags)) $tags_value = implode(', | ||
| Line 1799: | Line 1814: | ||
| <file php NoteHelper.php> | <file php NoteHelper.php> | ||
| - | |||
| - | |||
| //Tag system | //Tag system | ||
| public function getTagUnionsNote($noteids) | public function getTagUnionsNote($noteids) | ||
| Line 1811: | Line 1824: | ||
| { | { | ||
| return $this-> | return $this-> | ||
| - | + | ||
| return $url; | return $url; | ||
| } | } | ||
| Line 1821: | Line 1834: | ||
| <file php NotesController.php> | <file php NotesController.php> | ||
| - | |||
| //Tag system | //Tag system | ||
| $this-> | $this-> | ||
| Line 1829: | Line 1841: | ||
| </ | </ | ||
| - | |||
| - | |||
| <file php view.ctp> | <file php view.ctp> | ||
| - | |||
| //Tag system | //Tag system | ||
| <div class=" | <div class=" | ||
| Line 1841: | Line 1850: | ||
| </ | </ | ||
| - | |||
| - | |||
| ===== How to using like system ===== | ===== How to using like system ===== | ||
| Line 1849: | Line 1856: | ||
| <file php NotesController.php> | <file php NotesController.php> | ||
| - | |||
| //Like system | //Like system | ||
| MooCore:: | MooCore:: | ||
| Line 1857: | Line 1863: | ||
| <file php view.ctp> | <file php view.ctp> | ||
| - | |||
| //Like system | //Like system | ||
| <div class=" | <div class=" | ||
| Line 1864: | Line 1869: | ||
| <?php echo $this-> | <?php echo $this-> | ||
| </ | </ | ||
| - | </ | + | </ |
| </ | </ | ||
| // | // | ||
| </ | </ | ||
| - | |||
| ===== How to using comment system ===== | ===== How to using comment system ===== | ||
| Line 1876: | Line 1880: | ||
| <file php notescontroller.php> | <file php notescontroller.php> | ||
| - | |||
| //Comment system | //Comment system | ||
| MooCore:: | MooCore:: | ||
| Line 1882: | Line 1885: | ||
| </ | </ | ||
| - | |||
| <file php view.ctp> | <file php view.ctp> | ||
| - | |||
| //Comment system | //Comment system | ||
| <div class=" | <div class=" | ||
| Line 1895: | Line 1896: | ||
| </ | </ | ||
| - | |||
| <file php NoteHelper.php> | <file php NoteHelper.php> | ||
| - | |||
| //Comment system | //Comment system | ||
| public function checkPostStatus($note, | public function checkPostStatus($note, | ||
| { | { | ||
| if (!$uid) | if (!$uid) | ||
| - | return false; | + | return false; |
| - | | + | |
| $friendModel = MooCore:: | $friendModel = MooCore:: | ||
| if ($uid == $note[' | if ($uid == $note[' | ||
| return true; | return true; | ||
| - | + | ||
| if ($note[' | if ($note[' | ||
| { | { | ||
| return true; | return true; | ||
| } | } | ||
| - | + | ||
| if ($note[' | if ($note[' | ||
| { | { | ||
| Line 1920: | Line 1919: | ||
| return true; | return true; | ||
| } | } | ||
| - | + | ||
| - | + | ||
| return false; | return false; | ||
| } | } | ||
| Line 1931: | Line 1929: | ||
| </ | </ | ||
| - | |||
| - | |||
| ===== How to using report system ===== | ===== How to using report system ===== | ||
| Line 1939: | Line 1935: | ||
| <file php view.tcp> | <file php view.tcp> | ||
| - | |||
| //Report system | //Report system | ||
| <? | <? | ||
| Line 1956: | Line 1951: | ||
| ====== Plugin Development Suggestions ====== | ====== Plugin Development Suggestions ====== | ||
| - | * Do not hardcode the mooSocial database table prefix | + | * Do not hardcode the mooSocial database table prefix into your Plugins . |
| * Use the existing database tables instead of creating new custom tables if possible. | * Use the existing database tables instead of creating new custom tables if possible. | ||
| * SELECT only what you need.Naming conventions are very important in CakePHP. By naming our model Post, CakePHP can automatically infer that this model will be used in the PostsController, | * SELECT only what you need.Naming conventions are very important in CakePHP. By naming our model Post, CakePHP can automatically infer that this model will be used in the PostsController, | ||
documentation/create_first_plugin.1440393152.txt.gz · Last modified: (external edit)
