joomla developer manual

168 284 0
joomla developer manual

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

signwork Developer Eyes on signwork ® Manual Preface ( 2 items ) Basic Templating and Site Design ( 3 items ) Advanced Templating ( 4 items ) Modules ( 4 items ) Mambots ( 8 items ) Components ( 3 items ) Language ( 1 items ) Packaging ( 1 items ) Access Control ( 1 items ) Accessibility, Usability and Standards ( 4 items ) Development Standards ( 2 items ) API Reference ( 16 items ) Appendix ( 5 items ) Preface ( 2 items ) i. Preface ii. Preamble 1.Basic Templating and Site Design ( 3 items ) Templating Overview The Layout File Style Sheets 2. Advanced Templating ( 4 items ) Overview Administrator Templates Function Reference Template Standards 3. Modules ( 4 items ) Writing a Simple Module Module Hello World 1 Module Hello World 2 Module Hello World 3 4. Mambots ( 8 items ) Mambots - Overview Writing a Mambot An onSearch Mambot An onPrepareContent Mambot Editor Mambots Using Parameters within a Mambot Extending Mambots Legacy Mambots - The Old Way 5. Components ( 3 items ) Chapter 5. Components Hello World 1 - The first steps Hello World 2 - Getting personal Preface ( 2 items ) i. Preface ii. Preamble 1.Basic Templating and Site Design ( 3 items ) Templating Overview The Layout File Style Sheets 2. Advanced Templating ( 4 items ) Overview Administrator Templates Function Reference Template Standards 3. Modules ( 4 items ) Writing a Simple Module Module Hello World 1 Module Hello World 2 Module Hello World 3 4. Mambots ( 8 items ) Mambots - Overview Writing a Mambot An onSearch Mambot An onPrepareContent Mambot Editor Mambots Using Parameters within a Mambot Extending Mambots Legacy Mambots - The Old Way 5. Components ( 3 items ) Chapter 5. Components Hello World 1 - The first steps Hello World 2 - Getting personal Index Joomla! Developer Manual 6. Language ( 1 items ) Chapter 6. Language Support 7. Packaging ( 1 items ) Chapter 7. Packaging Custom Work 8. Access Control ( 1 items ) Chapter 8. Access Control 9. Accessibility, Usability and Standards ( 4 items ) Terms of Reference Accessibility Statement WCAG Checklist Semantic Ideas 10. Development Standards ( 2 items ) Coding Standards Comment Coding Standards 11. API Reference ( 16 items ) mosHTML class mosHTML::BackButton mosHTML::CloseButton mosHTML::emailCloaking mosHTML::idBox mosHTML::integerSelectList mosHTML::makeOption mosHTML::monthSelectList mosHTML::PrintIcon mosHTML::radioList mosHTML::selectList mosHTML::sortIcon mosHTML::treeSelectList mosHTML::yesnoRadioList mosHTML::yesnoSelectList Chapter 9. API Reference Appendix ( 5 items ) A. Updates for 4.5.1 B. Using Parameters C. mosHTML Reference D. Code and Commenting Standards E. Porting MiniXML to the DOMIT Library 6. Language ( 1 items ) Chapter 6. Language Support 7. Packaging ( 1 items ) Chapter 7. Packaging Custom Work 8. Access Control ( 1 items ) Chapter 8. Access Control 9. Accessibility, Usability and Standards ( 4 items ) Terms of Reference Accessibility Statement WCAG Checklist Semantic Ideas 10. Development Standards ( 2 items ) Coding Standards Comment Coding Standards 11. API Reference ( 16 items ) mosHTML class mosHTML::BackButton mosHTML::CloseButton mosHTML::emailCloaking mosHTML::idBox mosHTML::integerSelectList mosHTML::makeOption mosHTML::monthSelectList mosHTML::PrintIcon mosHTML::radioList mosHTML::selectList mosHTML::sortIcon mosHTML::treeSelectList mosHTML::yesnoRadioList mosHTML::yesnoSelectList Chapter 9. API Reference Appendix ( 5 items ) A. Updates for 4.5.1 B. Using Parameters C. mosHTML Reference D. Code and Commenting Standards E. Porting MiniXML to the DOMIT Library help.joomla :: i. Preface i. Preface Joomla Developers' Manual Acknowledgements Andrew Eddie, Lead Joomla Developer Alex Kempkens, Joomla Developer Dieter Schornböck, Proof Reading Copyright © 2000-2005 Open Source Matters, All Rights Reserved Release under the Free Document License, http://www.gnu.org/copyleft/fdl.html The information in this publication is furnished for informational use only, and should not be construed as a commitment by the Joomla Project. The Joomla Project reserves the right to update or modify the contents. The Joomla Project assumes no responsibility or liability for any errors or inaccuracies that may appear in this publication. Last Updated ( Wednesday, 14 September 2005 ) Close Window file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/a1.htm11/3/2005 1:12:23 AM help.joomla :: ii. Preamble ii. Preamble Joomla began life as Mambo and morphed into Joomla in September 2005 at which time the version numbering for Joomla was started at 1.0. Consequently you may see occassional references in this document to Mambo versions which are direct ancestors of Joomla. In general, versions of Mambo prior to 4.5 are of historical interest only and are not documented here. Mambo 4.5.2.3 was directly followed by Joomla 1.0. Right up to the release of the 4.x versions of Mambo, writing components, modules and templates was a fairly convoluted affair. Files in scattered directories made it difficult to actually package an individual element; code was not organised into reusable API calls; it was generally hard work. The number of third-party add-ons around the time of the release of Mambo 4.0.x was testimony to this. There were maybe a half dozen templates and not many more components and modules. The development of Mambo 4.5 sought to change all that. Code was modularised, files were reorganised, and an installer made it much easier. Today we have literally hundreds of templates, and dozens of components, modules, and mambots. Amazingly, most of the developers of these add-ons have picked it up by trial and error and following the example of the main code base. To date, there has not been a great deal of quality developer documentation. The community spirit has had to come to the aid of many a fledgling developer crying "Help! How do I do this". Since the release of Mambo 4.5.1, we realised that quality documentation for both users and developers is of paramount importance. We have worked hard to create documentation in both these areas. This manual, while not yet complete, seeks to give you an insight into the workings of Joomla. If you are new to Joomla, the chapters are set out roughly in order of easiest to hardest. We start with the Joomla template system which is extremely easy to learn. Modules then fit in nicely with your template work. Mambots are little multi-functional "things" that are like a Swiss Army Knife to Joomla. Then we look at building a Component. If you are an old hand then we suggest you start in the "Updates" appendix to bring yourself up to speed with changes to the current version. If there are any areas which you think are deficient then let us know. Suggestions and contributions are most welcome. This is a draft manual. Last Updated ( Wednesday, 14 September 2005 ) Close Window file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/a2.htm11/3/2005 1:12:24 AM help.joomla :: Templating Overview Templating Overview Overview The Joomla Template system is amongst the easiest to learn in the Content Management System family. Templates are located in the /templates directory. The following shows a typical directory structure for a template: /templates /basic_template /css template_css.css /images index.php template_thumbnail.png templateDetails.xml This is the minimum set of files you need to make a template. The filenames must be adhered to as each one is expected by the core script. Note that while there are no images shown in the /images directory, this is typically where you would place any supporting images for your template, like backgrounds, banners, etc. Let's have a look at each of these files. index.php This is the template layout file. template_css.css The css stylesheet for the template. templateDetails.xml This is a metadata file in XML format. template_thumbnail.png A reduced screenshot of the template, usually around 140 pixels wide and 90 pixels high. Last Updated ( Saturday, 24 September 2005 ) Close Window file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/b1.htm11/3/2005 1:12:24 AM help.joomla :: The Layout File The Layout File While the template layout file is a PHP file, it is written mostly in HTML with only a few snippets of PHP. You do not have to be a master of PHP to write a template file. All you need to be able to do is learn where to place the key "hooks" into the Joomla templating engine. Within the HTML framework you place "windows" that look into the database behind your web site. There are typically several small windows called Modules and usually one larger opening (like a frontdoor) for a Component. You are encouraged to write templates in XHTML. While there is debate over whether XHTML *is* the way of the future, it is a well formed XML standard, whereas HTML is a loose standard. Future versions of Joomla will rely more and more on XML so it is wise to adopt this model now. The index.php file for a typical 3-column layout would look like the following in a skeletal form: 1: <?php 2: $iso = explode( '=', _ISO ); 3: echo '<?xml version="1.0" encoding="' . $iso[1] . "\">\n"; 4: /** ensure this file is being included by a parent file */ 5: defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 6: ?> 7: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 8: <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo _LANGUAGE; ?>"> 9: <head> 10: <title><?php echo $mosConfig_sitename; ?></title> 11: <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" /> 12: <?php 13: if ($my->id) { 14: initEditor(); 15: } 16: ?> 17: <?php mosShowHead(); ?> 18: <link href="<?php echo $mosConfig_live_site;?>/templates/basic_template/css/template_css. css" rel="stylesheet" type="text/css" /> 19: </head> 20: <body> 21: <table cellspacing="0" cellpadding="5" border="0"> 22: <tr> 23: <td colspan="3"> 24: <?php echo $mosConfig_sitename; ?> 25: </td> 26: </tr> 27: <tr> 28: <td colspan="3"> 29: <?php mosLoadModules ( 'top', 1 ); ?> 30: </td> 31: </tr> 32: <tr> 33: <td width="20%" valign="top"> 34: <?php mosLoadModules ( 'left' ); ?> file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/b2.htm (1 of 2)11/3/2005 1:12:24 AM help.joomla :: The Layout File 35: </td> 36: <td width="60%" valign="top"> 37: <?php mosMainBody(); ?> 38: </td> 39: <td width="20%" valign="top"> 40: <?php mosLoadModules ( 'right' ); ?> 41: </td> 42: </tr> 43: <tr> 44: <td colspan="3" valign="top"> 45: <?php mosLoadModules ( 'bottom' ); ?> 46: </td> 47: </tr> 48: </table> 49: </body> 50: </html> Let's have a look at the main features. We are assuming you already know a bit about HTML pages so things like head tags, body tags, tables, etc will be skipped over. Line 1-3: Defines the file as a valid XML file. _ISO is a special constant defining the character set encoding to use. It is defined in your language file. Line 5: Prevents direct access to this file. It is essential that you include this line in your template. Lines 7-8: Set up the XHTML standard for the page. Line 10: Prints out the Site Name configuration variable with the opening and closing title tags. Line 11: _ISO is used again to define the character set to use. Line 12-16: $my->id is a script variable that is non-zero if a user is logged in to your site. If a user is logged in then the nominated WYSIWYG editor is pre- loaded. You may, if you wish, always pre-load the editor, but generally an anonymous visitor will not have the need to add content. This saves a little script overhead for normal browsing of your site. Line 17: Inserts several metadata blocks. Lines 18: Loads the CSS stylesheet. $mosConfig_live_site is a configuration variable that holds the absolute URL of your site. Line 24: This prints the Site Name in a table cell (spanning the three columns). Line 29: This loads any modules that are published in the "top" position. The second argument, "1", indicates that the modules are to be aligned horizontally. Line 34: This loads any modules that are published in the "left" position. These modules will be displayed in a single column. Line 37: This loads the component into your template. The component is set by the URL, for example, index.php?option=com_content will display the Content Component in this area. Line 40: This loads any modules that are published in the "right" position. These modules will be displayed in a single column. Line 45: This loads any modules that are published in the "bottom" position. Last Updated ( Wednesday, 14 September 2005 ) Close Window file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/b2.htm (2 of 2)11/3/2005 1:12:24 AM help.joomla :: Style Sheets Style Sheets CSS Stylesheets TODO The XML Setup File TODO The Thumbnail When you have finished your template, publish it with the Template Manager in the Adminstrator. Preview the site and take a screenshot. Import the screen shot into your favourite graphic editing package and crop it down to the contents of the browser's view port. Reduce the image down to around 140 pixels wide by 90 pixels high and save it in PNG format in your template directory (that is, /templates/basic_template). Last Updated ( Saturday, 13 August 2005 ) Close Window file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/b3.htm11/3/2005 1:12:24 AM help.joomla :: Overview Overview This chapter includes some more advanced features such as hiding template columns and designing templates for the Administrator. Hiding Modules Sometimes it is desirable to hide certain module areas if there are no modules assigned to that region. You can hide these areas by using the mosCountModules function. <?php if (mosCountModules( 'right' )) { ?> <td> <?php mosLoadModules( 'right' ); ?> </td> <?php } ?> If the mosCountModules function returns a value greater than 1, the table cell will be displayed. If there are no modules defined for the "right" position for this particular page, then the cell will not be displayed. This is a good technique for increasing the horizontal screen width on certain pages. Using Class Suffixes TODO Last Updated ( Wednesday, 18 May 2005 ) Close Window file:///D|/My%20Documents/Joomla!/doc/fileweb/developer/c1.htm11/3/2005 1:12:24 AM [...]... mosMainBody(); ?> file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ c3.htm (3 of 4)11/3/2005 1:12:25 AM help .joomla :: Function Reference Includes the output of the component as determined by the value of option in the URL Last Updated ( Thursday, 15 September 2005 ) Close Window file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ c3.htm (4 of 4)11/3/2005 1:12:25 AM help .joomla :: Template Standards Template... file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d1.htm (3 of 4)11/3/2005 1:12:26 AM help .joomla :: Writing a Simple Module echo "" "$item->title"; } } echo $database->getErrorMsg(); } } } ?> Last Updated ( Thursday, 13 October 2005 ) Close Window file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d1.htm (4 of 4)11/3/2005 1:12:26 AM help .joomla. .. (mod_helloworld_2.zip) Last Updated ( Wednesday, 14 September 2005 ) file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d3.htm (5 of 6)11/3/2005 1:12:31 AM help .joomla :: Module Hello World 2 Close Window file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d3.htm (6 of 6)11/3/2005 1:12:31 AM help .joomla :: Module Hello World 3 Module Hello World 3 Image Introduction This tutorial aims to further... version and explicitly state the copyright and license file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d2.htm (4 of 5)11/3/2005 1:12:26 AM help .joomla :: Module Hello World 1 terms for the file q Next we look for a constant called _VALID_MOS Because this constant is defined elsewhere in Joomla, it ensures that only Joomla is able to access this file It prevents a user from opening the file explicitly... //Related Content// /** * Related Content Module * @package Joomla * @copyright Copyright (C) 2005 Open Source Matters All rights reserved file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d1.htm (2 of 4)11/3/2005 1:12:26 AM help .joomla :: Writing a Simple Module * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * Joomla! is free software and parts of it may contain or be... The following shows an example of the output Module 1 OutputModule 2 OutputModule 3 Output q -2 = Modules are displayed in X -Joomla format The following shows an example of the output: file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ c3.htm (2 of 4)11/3/2005 1:12:25 AM help .joomla :: Function Reference Module Title Module output... description of the module files file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d2.htm (2 of 5)11/3/2005 1:12:26 AM help .joomla :: Module Hello World 1 This is a collection of the files included with the module filename This is a file that is used by the module Any number of files can be listed, including files in a subdirectory The file that Joomla calls to invoke the module must contain the module... modules in a column you may add a width attribute and change the display attribute appropriately The following modules are available with the Joomla distribution file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ c2.htm (1 of 3)11/3/2005 1:12:25 AM help .joomla :: Administrator Templates mod_fullmenu The Full Menu module displays the traditional DHTML Adminstrator menu Content Sections and Components... file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ d2.htm (5 of 5)11/3/2005 1:12:26 AM help .joomla :: Module Hello World 2 Module Hello World 2 Hello World 2 Introduction This tutorial aims to build on the helloworld module started in part one You will learn how to retrieve information from the database and how to present this data is a table using patTemplate Requirements You need for this tutorial: q Joomla 1.0... Last Updated ( Wednesday, 14 September 2005 ) Close Window file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ c2.htm (3 of 3)11/3/2005 1:12:25 AM help .joomla :: Function Reference Function Reference File and Function Reference The following functions are available to template developers mosLoadComponents Syntax: mosLoadComponents( $name ) Loads a component For example "banners" . the DOMIT Library help .joomla :: i. Preface i. Preface Joomla Developers' Manual Acknowledgements Andrew Eddie, Lead Joomla Developer Alex Kempkens, Joomla Developer Dieter Schornböck,. file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ a1.htm11/3/2005 1:12:23 AM help .joomla :: ii. Preamble ii. Preamble Joomla began life as Mambo and morphed into Joomla in September 2005. This is a draft manual. Last Updated ( Wednesday, 14 September 2005 ) Close Window file:///D|/My%20Documents /Joomla! /doc/fileweb /developer/ a2.htm11/3/2005 1:12:24 AM help .joomla :: Templating

Ngày đăng: 28/03/2014, 11:18

Mục lục

  • b2.htm

    • Local Disk

      • help.joomla :: The Layout File

      • d1.htm

        • Local Disk

          • help.joomla :: Writing a Simple Module

          • d2.htm

            • Local Disk

              • help.joomla :: Module Hello World 1

              • d3.htm

                • Local Disk

                  • help.joomla :: Module Hello World 2

                  • d4.htm

                    • Local Disk

                      • help.joomla :: Module Hello World 3

                      • e1.htm

                        • Local Disk

                          • help.joomla :: Mambots - Overview

                          • e2.htm

                            • Local Disk

                              • help.joomla :: Writing a Mambot

                              • e3.htm

                                • Local Disk

                                  • help.joomla :: An onSearch Mambot

                                  • e4.htm

                                    • Local Disk

                                      • help.joomla :: An onPrepareContent Mambot

                                      • e6.htm

                                        • Local Disk

                                          • help.joomla :: Using Parameters within a Mambot

                                          • e8.htm

                                            • Local Disk

                                              • help.joomla :: Legacy Mambots - The Old Way

                                              • f2.htm

                                                • Local Disk

                                                  • help.joomla :: Hello World 1 - The first steps

                                                  • f3.htm

                                                    • Local Disk

                                                      • help.joomla :: Hello World 2 - Getting personal

                                                      • i1.htm

                                                        • Local Disk

                                                          • help.joomla :: Terms of Reference

                                                          • j2.htm

                                                            • Local Disk

                                                              • help.joomla :: Comment Coding Standards

                                                              • l4.htm

                                                                • Local Disk

                                                                  • help.joomla :: D. Code and Commenting Standards

                                                                  • l5.htm

                                                                    • Local Disk

                                                                      • help.joomla :: E. Porting MiniXML to the DOMIT Library

Tài liệu cùng người dùng

Tài liệu liên quan