programming modules for joomla 1.5, 1. modules, an introduction

Download Programming Modules for Joomla 1.5, 1. Modules, an Introduction

If you can't read please download the document

Upload: peter-martin

Post on 29-Nov-2014

102 views

Category:

Documents


0 download

DESCRIPTION

Programming Modules for Joomla 1.5 - Hour 1: Modules, an Introduction (Workshop for Joomladay Norway 2011, Saturday August 13th 2011)

TRANSCRIPT

Programming Joomla 1.5 Modules Hour 1: Modules, an Introductionby Peter Martin Nickname: pe7er Twitter: @pe7er Website: www.db8.nl

13 August 2011

Hour 1 IntroductionH1.1 The differences between Components, Modules & Plugins H1.2 Modules explained Assignments: a. Core hack in Module b. Template override for a Module c. Alternative for core hack without using template overrides2

1.1 Extensions Types 3

Components Modules Plugins Templates Language Files 1.6/1.7 Libraries Addons Extensions for components Tools External applications

1.1 Joomla's framework

4

1.1 Extensions What is it?

Component: Most important. Determines functionality of page, Max 1 component running at a time! Module: Supportive, Output to screen, Multiple possible (Module order determines output) Plugin: Supportive, invisible running in background, Multiple possible (Module order determines output)

5

1.1 Extensions Where stored?

Component: files: (/administrator)/components/com_comp-naam table: jos_components Module: files: (/administrator)/modules/mod_modulenaam table: jos_modules & jos_modules_menu Plugin: files: /plugins/type_plugin/pluginnaam table: jos_plugins

6

1.1 Extensions How to activate? Component:

Via URL + &option=com_componentname Module:

Via menu item: URL + &Itemid=x Plugin:

listen to certain events7

1.1 Cooperation Extensions - 1/3

8

1.1 Cooperation Extensions - 2/3

9

1.1 Cooperation Extensions - 3/3 Search

Module Search ComponentSearch Form Result Page

C Form

M Form

P Search in database table C Processing P Search in database table P Search in database table C Results

Search 10

Plugin

Articles Categories Sections Contacts

H1 AssignmentNeeded: Local webserver (LAMP, XAMPP, MAMP, WAMP, or any other AMP) Local installation of Joomla 1.5.23 + English Example Content Text editor, preferably with code hightlighting Browser, preferably FireFox11

Assignment 1aMy customer uses the Weblinks Component a lot and I want to offer them a faster way to goto that component in the back-end. Change the C-panel (with core hack) to give them a Weblinks shortcut icon.

12

Assignment 1a possible solution/administrator/modules/mod_quickicon/ file: mod_quickicon.phpAfter: $link = 'index.php?option=com_content'; quickiconButton( $link, 'icon-48-article.png', JText::_( 'Article Manager' ) ); Add: $link = 'index.php?option=com_weblinks'; quickiconButton( $link, 'icon-48-image.png', JText::_( 'Weblink Manager' ) ); Add your own icon-48-image.png to admin template in:

/administrator/templates/khepri/images/header/ 13

Assignment 1bMy customer has the latest news module. They like it, but only want to have 3 news items and they complain that there's no date with those news items. They also want a link under it to get to all the latest news. Only list 3 news items Use a template override to add the date to latest news Add a link to all the latest news

14

Assignment 1b possible solution1. list 3 news items in Module parameters 2. Template override: Copy /modules/mod_latestnews/tmpl/default.php To /templates/rhuk_milkyway/html/mod_latestnews/default.php

Unfortunately NO date output But you can accomplish that with a core hack, which might be overwritten with a Joomla update!

15

Assignment 1b possible solutionCore hack (= no fun ;-) in/modules/mod_latestnews/helper.php

after$lists[$i]->text = htmlspecialchars( $row->title ); Add $lists[$i]->date = htmlspecialchars( $row->created ); In template override /templates/rhuk_milkyway/html/mod_latestnews/default.php Change To

16

Assignment 1cI just had a phone call from a panicking customer. They cannot change the weblinks anymore. Everything worked fine. Until last week. It stopped working just after I had done the latest Joomla upgrade. How would you quickly solve this issue? And how can you prevent these issues in the future?17

Assignment 1c possible solutionCreate a copy of the Admin Module mod_quickicon1. Copy /administrator/modules/mod_quickicon/ folder + files to /administrator/modules/mod_quickicon2/ Rename files to mod_quickicon2 + change all internal references in .php & .xml file to mod_quickicon2 2. Create jos_modules reference to module: INSERT INTO `jos_modules` VALUES(0, 'Quick Icons 2', '', 1, 'icon', 0, '0000-00-00 00:00:00', 1, 'mod_quickicon2', 0, 2, 1, '', 1, 1, ''); 3. Unpublish the Administrator Module Quick Icons (keep Quick Icons 2 published !). A Joomla update will only overwrite /administrator/modules/mod_quickicon/ and your changes will not be overwritten.

18

Thanks for your attention!

Peter Martin

nick: pe7er E-mail: info at db8.nl website: www.db8.nl Twitter: @pe7er

19