Tuesday, 09 February 2010 17:13

About modding

You've probably done it before, either with Projectfork or any other component, or maybe even with Joomla itself: Modifying some files to change the layout or some features. To do this, you would normally search for the file and then do all the changes in it that you've wanted. The problem with this method is that could lose these changes whenever you update the component or Joomla to a new version. And this is where mods come into play to solve the problem:

Whenever you need to modify a source file of Projectfork, you create a copy of the file first and work on that instead of changing the original file. Then you create a mod package and install it in Projectfork. The system will recognize that a modified file exists and will load it instead of the original one. The advantage of this method is that whenever you update Projectfork, your mods will still be there. Additionally, you can now maintain and share the mod across multiple Projectfork installations because all you have to do is to install the mod package.

File limitations

For a technical reason, there are certain files which cannot be added to a mod. So make sure your changes do not affect any of these files:

  • components/com_projectfork/projectfork.php
  • administrator/components/com_projectfork/admin.projectfork.php
  • administrator/components/com_projectfork/_core/init.php
  • administrator/components/com_projectfork/_core/lib/debug.php
  • administrator/components/com_projectfork/_core/lib/database.php
  • administrator/components/com_projectfork/_core/lib/configuration.php
  • administrator/components/com_projectfork/_core/lib/mod.php
  • administrator/components/com_projectfork/_core/lib/loader.php

 

Step 1 - Collecting the files

The first step in creating a mod is to create a new folder on your desktop in which you want to place all the files you have modified like this:

Yellow = Original location
Blue = Mod location
Green = XML file attribute (See step 2)

administrator/components/com_projectfork/sections/<section_name>
<your_mod_folder>/sections/<section_name>/
section="<section_name>"

administrator/components/com_projectfork/sections/<section_name>/output
<your_mod_folder>/sections/<section_name>/
section="<section_name>"

administrator/components/com_projectfork/_core
<your_mod_folder>/_core/
section="core"

administrator/components/com_projectfork/_core/lib
<your_mod_folder>/_core/lib
section="core_lib"

administrator/components/com_projectfork/languages
<your_mod_folder>/languages
section="core_language"

administrator/components/com_projectfork/panels
<your_mod_folder>/panels
section="panel"

administrator/components/com_projectfork/processes
<your_mod_folder>/processes
section="process"

Step 2 - Creating the XML file

Once you have all your files in place, you'll have to create an XML file for the installation process and for your database changes (if any). Create an empty xml file in the root directory of your mod folder (<your_mod_folder>/your_mod.xml). Then open it and adapt the example below:

<install type="mod" version="2.0">
 <name>my_mod</name>
 <title>This is my first mod</title>
 <author>Tobias Kuhn</author>
 <email></email>
 <website>http://www.projectfork.net</website>
 <update_website>http://download.projectfork.net</update_website>
 <version>1.0</version>
 <license>GNU/LGPL</license>
 <copyright>Copyright 2009 Tobias Kuhn</copyright>
 <date>2009/10</date>
 <install>
 <sql></sql>
 </install>
 <uninstall>
 <sql></sql>
 </uninstall>
 <files>
 <file section="tasks">sections/tasks/list_tasks.php</file>
 </files>
</install>


The XML fields explained:

Field name Status Description
name Required Enter the name of your mod. Without white spaces! Eg. "my_mod"
title Required Enter the title of your mod. Eg. "My first mod"
author Optional Enter your name
email Optional Enter your email address
website Optional Enter your website
update_website Optional Enter a link to your website where people can quickly check for updates
version Optional Enter the the version of your mod
license Optional Enter the license under which you are publishing your work
copyright Optional Enter copyright information
date Optional Enter the release date of your work
install -> sql Optional Add custom install queries
uninstall -> sql Optional Add custom uninstall queries
files Required Enter each file of your mod separately. Also add the corresponding XML file attribute:

<file section="tasks">sections/tasks/output/list_tasks.php</file>
<file section="core">_core/core.php</file>
etc...

 

Step 3 - Creating the ZIP package    

Once you're done with the xml file, create a new ZIP file and put all the files in your mod folder into the package. Do not place the mod folder itself into the package, only it's content. Now you should try to install and uninstall your mod to see if it works.

Last modified on Tuesday, 09 February 2010 17:32
More in this category: « Translation