This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
plugins:creation [2014/02/07 09:17] datiswous [Additional plugin files] |
plugins:creation [2014/02/07 09:43] datiswous [Register & Queue Your Styles] |
||
---|---|---|---|
Line 135: | Line 135: | ||
Similarly you can have subfolders for javascript files, images, etc. For all directories whose files need to be directly accessed by the browser, add a ''.htaccess'' file for Apache with the line | Similarly you can have subfolders for javascript files, images, etc. For all directories whose files need to be directly accessed by the browser, add a ''.htaccess'' file for Apache with the line | ||
- | <code php> | + | <code> |
Allow from all | Allow from all | ||
</code> | </code> | ||
Thus a sample plugin structure for a plugin ''my_plugin'' with additional php files and images that supports multiple languages might be: | Thus a sample plugin structure for a plugin ''my_plugin'' with additional php files and images that supports multiple languages might be: | ||
- | <code php> | + | <code> |
- my_plugin.php | - my_plugin.php | ||
- my_plugin (directory) | - my_plugin (directory) | ||
Line 188: | Line 188: | ||
To use your script you must first register it with the system. | To use your script you must first register it with the system. | ||
- | <code> | + | <code php> |
// register_script($handle, $src, $ver, $in_footer=FALSE) | // register_script($handle, $src, $ver, $in_footer=FALSE) | ||
// $handle name for the script, must be unique for each script loaded | // $handle name for the script, must be unique for each script loaded | ||
Line 201: | Line 201: | ||
To queue and load a registered script use: | To queue and load a registered script use: | ||
- | <code> | + | <code php> |
// queue_script($name,$where); | // queue_script($name,$where); | ||
// $name name of the script to load | // $name name of the script to load | ||
Line 212: | Line 212: | ||
To register a script from your plugin folder use | To register a script from your plugin folder use | ||
- | <code> | + | <code php> |
register_script('pluginscriptname', $SITEURL.'plugins/my_plugin_folder/your.script.js', '0.1', FALSE); | register_script('pluginscriptname', $SITEURL.'plugins/my_plugin_folder/your.script.js', '0.1', FALSE); | ||
</code> | </code> | ||
Line 223: | Line 223: | ||
To use your own stylesheets you must first register them with the system. | To use your own stylesheets you must first register them with the system. | ||
- | <code> | + | <code php> |
// register_sstyle($handle, $src, $ver) | // register_sstyle($handle, $src, $ver) | ||
// $handle name for the style, must be unique for each style loaded | // $handle name for the style, must be unique for each style loaded | ||
Line 237: | Line 237: | ||
To queue and load a registered style use: | To queue and load a registered style use: | ||
- | <code> | + | <code php> |
// queue_style($name,$where); | // queue_style($name,$where); | ||
// $name name of the style to load | // $name name of the style to load |