JoomaDevUser

JoomaDevUser

Component Develompment With Example - Part I: The Frontend
User Rating: / 23
PoorBest 
Friday, 09 May 2008 15:31

This tutorial is about a Joomla component named "Greetings" that displays a list of greetings read from the database.

This new version of Joomla (1.5) uses an approach to component development based on the Model-View-Component design pattern.

So what is this of the Model View Controller pattern? Well, if you look for it in this book “Design patterns – Elements of Reusable Object Oriented Software” (Erich Gamma, et all), which is probably the most popular book about design patterns, you’ll find this:

“MVC consists of three kinds of objects. The Model is the application object, the View is its screen presentation, and the Controller defines the way that the user interface reacts to the user input. Before MVC user interface designs tended to lump these objects together…”

So the basic idea is that you have a Model of your data, that is unaware of the views that might exists to represent it, you have one or more views of that model that represent it, and you have a controller, which is responsible for receiving input from the views and updating the model.

For creating our Joomla component we’ll have to write a model, a view and a controller for it, but first, because we want to test what we’re doing while we’re doing it will take a shortcut.


Section 1: The components' table in joomla's database

The first thing we’ll do is to insert a new record in the Joomla’s table that stores the installed components. By doing this you can test your component while you’re developing it, instead of coding it all, creating the xml(this will be explained later) for the installation and installing it through the back end.

To do this you’ll have to have phpmyadmin or you can use the MySQL command line client. In phpmyadmin this is what you have to do:

(I’m using version: 2.11.3 of phpmyadmin)

  1. Open phpmyadmin and select the database that you’re using for your joomla installation;
  2. Select the table jos_components (it might have a different prefix (jos_), you choose the prefix when you install joomla (jos is the default prefix);
  3. Click on the insert tab;
  4. Fill the Value column with the values:
    1. name: Greetings
    2. link: option=com_greetings
    3. admin_menu_link: option=com_greetings
    4. option: com_greetings

And that’s it, the rest of the fields leave them with the default values.

Note: If you want to use the MySQL command line client to do this, remember that option is a reserved keyword (here’s a list of them), so you have to write it like this `option` when you’re writing your SQL insert statement. Here’s what it should look like:

INSERT INTO jos_components (name, link, admin_menu_link, `option`)
VALUES (‘Greetings’, ‘option=com_greetings’, ‘option=com_greetings’, ‘com_greetings’)

To use this SQL insert statement in the MySQL command line client you have to login, choose the right database (syntax: use DATABASE_NAME; to view the available databases write: show databases; ) and only then you can use it.

So now, if you log in to your joomla site back end you should see, under the components tab, the “Greetings” component. If you click on it, you get an error (404 – Component not found). If this is what you got, everything is going well, and we can now start to build our component.


Section 2: The frontend

Now we’ll do the code for the frontend, but first let me give you a rough picture of what happens when a component is executed in joomla.

The first thing you need to worry about in your component is its entry point. This is the file that is executed when your component is run. For example, for the component we’re just building right now, if we write in the URL: index.php?option=com_greetings, the Greetings component entry point greetings.php will be executed.

If you try this now, you’ll get an error, because we haven’t written the greetings.php file, but we will! Let’s try to do a very simple one that only writes a greeting message to the screen.

DETAIL 2.1: joomla parses the com_greetings option parameter in the URL to get the entry point file name (removes the “com_” part and adds “.php” at the end).

First create a folder in the place you’ve installed joomla/components/com_greetings.

Create the file greetings.php there, with the code:

<?php
echo "Hello, how are you?";
?>

And then try the URL: index.php?option=com_greetings


You should get a “Hello, how are you?” message. If not, check to see if you’ve placed the greetings.php in the right place.

Now, before we actually do our entry point let me give you the big picture about what we’re going to do as the frontend of our component.

  1. The first thing is creating an entry point that loads the controller and makes it execute a task
  2. Create the controller that will be responsible for selecting the model and the view
  3. Create the view
  4. Create the model


Section 2.1: The Entry Point

This will be quite simple, it will just load the controller (that we haven’t done yet) and execute two methods from that controller: execute and then redirect.

This file should be called greetings.php and be placed in: folder where you’ve installed joomla/components/com_greetings/greetings.php

<?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Require the controller
require_once( JPATH_COMPONENT.DS.'greetingsController.php' );

// Create the controller
$controller = new GreetingsController();

// Perform the Request task
$controller->execute( JRequest::getVar( 'task' ) );

// Redirect if set by the controller
$controller->redirect();

?>

Important this about this piece of code:

The first line: defined(‘_JEXEC’) or die…: What this means is that if the constant ‘_JEXEC’ is not defined the application exits and the only thing you’ll see is the “Restricted Access” message.

DETAIL 2.1.1: The constant _JEXEC is defined in the index.php file, so if you try to access the greetings.php file directly, by typing the URL: http://folder where you’ve installed joomla under apache’s htdocs folder/components/com_greetings/greetings.php, you’ll get that “Restricted Access” message because _JEXEC won’t be defined.

Second line of code, the “require_once(JPATH_COMPONENT.DS.'greetingsController.php' );” will load the controller we’ll do next . What you need to know about this is that JPATH_COMPONENT is a joomla constant that contains the path to where your component is, and DS is also a joomla constant that means “Directory Separator” (it’s defined this way to work both in windows and unix environments).

DETAIL 2.1.2: The JPATH_COMPONENT constant contains the frontend’s path to the component if your code is running in the frontend or it has the backend’s path to the component if your code is running in the back end. This is because the JPATH_COMPONENT constant is defined using another constant, the JBASE_PATH constant that contains the path to the frontend if you’re in the frontend or the backend if you’re in the backend. The actual files where theses constants are defined are:

JBASE_PATH: index.php (frontend) and administrator/index.php(backend)
JPATH_COMPONENT: libraries/joomla/application/component/helper.php (the method you should look for is renderComponent).
JPATH_COMPONENT_SITE: same as above
JPATH_COMPONENT_ADMINISTRATOR: same as above

These last two constants contain the path to the frontend part of the component and the backend part of the component and are independent of JBASE_PATH.

Third line of code: “$controller = new GreetingsController();” . The actual GreetringsController class will be defined in the greetingsController.php file we’ll do next.

Forth line: “$controller->execute( JRequest::getVar( 'task' ) );” this tells our soon to be created controller which task it should perform. What is important for you to know here is that if task is not defined in the URL the JRequest::getVar(‘task’) returns null, and the execute method from the controller will execute the controller’s default task (the default task is display, I’ll explain this better when we do the controller).
You might want to see what JRequest has to offer you, have a look here.

DETAIL 2.1.3: At the date I wrote this (2nd May 2008) the JRequest reference was incomplete, so if you stumble across some method of JRequest that’s not in the reference, the actual class definition is in libraries/joomla/environment/request.php

Last line: “$controller->redirect();” . What you need to know about this is that you can setRedirect in the controller to the url where the browser should redirect when this method is called. If you don’t use the setRedirect method in the controller, the redirect method just returns false.

And that’s the entry point.Don’t try this just yet, it won’t work because we still have to define the controller, the view and the model, which we will next.

 

Section 2.2: The Controller

Remember from the code above, I called my controller’s file greetingsController.php and the controller class name GreetingsController. The file name can be whatever you want but the class name is very important. The JController’s methods, (JController is the class we’ll extend to build our component) if used with default parameters will load the models and the views using the controller’s name to build the model and view’s class names, and in the case of the model even the filename. I’ll explain that in detail shortly.

Now, let’s do our controller, this file should be located in:
folder where you’ve installed joomla/components/com_greetings/greetingsController.php

<?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.controller');

/**
 * Greetings Component Controller
 */
class GreetingsController extends JController
{

    /**
     * Method to display the view
     *
     * @access    public
     */
    function display()
    {
        parent::display();
    }
}
?>

2nd line of code: “jimport('joomla.application.component.controller'); “. What you need to know about this is that it will require_once the file named controller.php located in libraries/joomla/application/component. This file contains the definition of the class JController that we are extending here.

DETAIL 2.2.1: Check the reference for JController here.

The rest is just creating the GreetingsController class, that extends JController and redefining the JController’s display method to do exactly what JController’s display method does. Why did I do this? Just to tell you about the JController’s display method.
This default JController’s display method does this:

  • Gets the document type (I don’t really know what this is for; feel free to email me if you know). In our case it will be html
  • Gets the name of the view:
    • If the parameter view is in the request, for example you have an URL like this: index.php?option=com_greetings&view=list, the view name will be ‘list’.
    • If there’s no view parameter in the request the view name will be the controller class name but without ‘Controller’. In our Greetings component, the controller class name is GreetingsController, so the view name is ‘greetings’.
  • Gets the name of the view’s layout from the request
    • If the parameter layout is in the request, for example, you have an URL like this: index.php?option=com_greetings&view=list&layout=listlayout, the view’s layout/template will be called listlayout.
    • If there is no layout parameter in the request the default layout is called default.

 

You might be wondering right now, what is this thing, the view’s layout, I haven’t told you about it. Well, I guess the people that developed the JView class(the class that we’ll extend to create our view)decided that it would be nice to have a separate file for the view class definition and the file that will have HTML that actually displays the view (with some php mixed in) . This way you have a view class file, without HTML, and all the HTML mixed with php code in the layout file.

I wouldn’t call it layout or template though, because it suggests that you can have two layouts for the same view, and in the MVC, shouldn’t that be two different views? That’s just how I see it anyway… Disagree? Feel free to email me, maybe I didn’t get it right!
Now, some other important things that you also need to know about the view’s class name, the view’s file name and the layout’s file name that I haven’t told you:

  • The view’s class name [ControllerClassNameWithoutController]View[ViewName]
  • The view’s  file name is views/[ViewNameLowercased]/view.html.php
  • Layout file name: views/[ViewNameLowercased]/tmpl/[LayoutNameLowercased].php

About the [LayoutNameLowercased].php file name, the lowercase part is really important! Because if you're working in Windows and you decide to name your layout, listLayout, and you forget that the layout file name has to be lowercase (so you name it listLayout.php). What will happen is that it will work ok in your local windows machine, but as soon as you upload the component to your website powered by a Linux server it will stop working, and you'll get an error saying the layout file is not found. Why does this happen? Because file names in Windows environments are not case sensitive, but in Linux environments they are. So, don't forget this so that you don't end up banging your head in the wall needlessly.

In our case, if we have an URL like this:
index.php?option=com_greetings
So, it’s all defaults in this example:

  • View Class file: folder where you’ve installed joomla/components/com_greetings/views/greetings/view.html.php (the view file name is always view.[DocumentType].php) [I don’t really know about DocumentType]
  • View Class Name: GreetingsViewGreetings
  • View Layout file: folder where you’ve installed joomla/components/com_greetings/views/greetings/tmpl/default.php

Another example:
index.php?option=com_greetings&view=list&layout=listlayout

  • View Class file: folder where you’ve installed joomla/components/com_greetings/views/list/view.html.php
  • View Class Name: GreetingsViewList
  • View Layout file: folder where you’ve installed joomla/components/com_greetings/views/list/tmpl/listlayout.php

DETAIL 2.2.2: Are you wondering why the views’ file and the layout file are under a folder called views and tmpl, respectively? Well I did too, and the answer to that is: the default folder where the controller will look for the views is views, and the default folder where the views will look for layouts is tmpl. Because I’m describing the controller right now, I’ll take this chance to tell you about the default parameters that you can change, in the JController’s contructor.

  • name: the controllers name, this will change all that I described earlier, instead of parsing the name of the controller class to take out the “Controller” part, the name you put here is used instead.
  • base_path: usually has the path to the component, can’t really remember any reason why you want to change its default value…
  • default_task: remember I told you that the default task for the controller was display, you can change that here. Note that this is the method that is called if there is no task parameter in the URL.
  • model_path: default value is base_path/models. This is the folder where the controller will look for the models.
  • view_path: default value is base_path/views. Here you have it, that’s why if you use the defaults you have to place your view files under this folder

Here’s an example of how our controller’s constructor would look like if we fiddle a bit with its default values:

function __construct(){
    parent::__construct(array('name'=>'greetings, 'default_task'=>'display', 'model_path'=>JPATH_COMPONENT.DS.'myExcuseForAModelsFolder', 'view_path'=>JPATH_COMPONENT.DS.'myExcuseForAViewsFolde'));
}


Did I lose you? Well, I still haven’t finished explaining the JController default display method that we’re using.
Next, there’s the how the model file is loaded and how the model class should be named.
If you use the default JController’s display method the name of the view and the name of the model have to be the same. Remember, the default view name is the controller’s name without “Controller” if the parameter view is not present in the URL, or, if the parameter view is present in the request URL, then the view name will have the value specified in the url.

From now on, I’ll refer to the model name, whose default value is the view name or the view parameter value in the url, as ModelName.
So, the file that contains the definition of the model should be named [ModelName].php and be located in models/.
The class name should be [ControllerNameWithoutController]Model[ModelName].
The view gets linked to the model, so you can access the model through the view as we’ll see later.

So, the default display method, loads the view and model (with the rules I described above), and in the end calls the view’s display method (we’ll look at it when we create the view).

So a lot goes on in the Controller that at first glance you might not be aware of. As a curiosity, I’ll show you an alternative to using the JController’s default display method:

DETAIL 2.2.3: You don’t have to use JController’s default display method; you can do your own.
In this example, I’ll override the display method to load a model called ‘greetings’, a view called ‘list’ and a layout called ‘listLayout’.

<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.controller');

/**
 * Greetings Component Controller
 */
class GreetingsController extends JController
{

   /**
     * Method to display the view
     *
     * @access    public
     */
    function display()
    {
       $viewName= JRequest::getVar( 'view', 'list' ); //This sets the default view (second argument)
       $viewLayout= JRequest::getVar( 'layout', 'listlayout' ); //This sets the default layout/template for the view

       $view = & $this->getView($viewName);

        // Get/Create the model
       if ($model = & $this->getModel(‘greetings’)) {
                // Push the model into the view (as default)
               $view->setModel($model, true);
       }

       $view->setLayout($viewLayout);
       $view->display();       
    }
}
?>

The files and the class names:
View file:  views/list/view.php (notice that it’s not view.html.php, this is because, the ’html’ comes from an optional parameter in the getView method, you can see the reference for getView here. The example in the bottom of the reference is wrong, the file should be called weblink.php and the class name depends of the controller’s name, and that is not mentioned in that example [5th May 2008].
View Class Name: GreetingsViewList (Remember: [ControllerNameWithoutController]View[ViewName])
View Layout: Located in views/list/tmpl/listlayout.php
Model file:  models/greetings.php
Model Class Name: GreetingsModelGreetings (Remember:[ControllerNameWithoutController]Model[ModelName], this time [ModelName] is what we’ve passed as an argument to getModel. You can see the reference for getModel here.
If you start wondering what is that second argument in the setModel method of the view, have a look at this: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:application:jview-setmodel/. I really don’t see any good use of having one view for several different models…

And these are the secrets behind the naming conventions in Joomla component development. Hope I didn’t forget anything, if you think there is something wrong or unclear feel free to let me know.

I’ll explain how to add more tasks than the default one (display) when we do the backend part of our component.

Other thing that you might remember, in the entry point, the use of redirect method, well, we haven’t used it here, because the default display method doesn’t define any redirect. Although it’s not being used, maybe sometime in the future you want to add other tasks to the controller in the frontend (for example to add greetings in the frontend) so you can leave it there (remember, the JController’s redirect method does nothing (just returns false) if you didn’t set where to redirect with setRedirect).

Section 2.3: The View

Let’s do the view first and then the model. The reason why this is a good idea is that we can test the view without having the model and the view’s layout/template defined (in the default JController’s display method, if no model exists, it isn’t associated with the view; in the view, if you don’t use the layout there’s no problem).

Now, because we’re using the JController’s default display method our view file will be:

folder where you’ve installed joomla/components/com_greetings/views/greetings/view.html.php

And the view’s class name is GreetingsViewGreetings.

The view class extends the JView class and implements the display method. Here’s the version we’ll use to test if everything is ok so far:

<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view');

class GreetingsViewGreetings extends JView
{
                                              
    function display()
    {
                        echo "Greetings, everything is ok!";
    }
}
?>

Now, if you write in the url index.php?option=com_greetings, you should see the message “Greetings, everything is ok!”. If not, probably you’ve put the file in the wrong place, or named the class wrong.

Now that we’ve tested if we named everything right, we can put the proper view code that will get a list of greetings from the model (we’ll do the model later) and display them using the view’s layout/template:

<?php
// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the Greetings Component
 *
 */
class GreetingsViewGreetings extends JView
{
            
    function display()
    {
        $model = &$this->getModel();
        $greetings = $model->getGreetings();
        $this->assignRef( 'greetings', $greetings );

        parent::display();
    }
}
?>

New stuff that is here: the $this->getModel returns the model associated in the controller’s code (in our case, that was associated in JController’s display method) [We’ll do the model after we’ve finished with the view]

See: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:application:jview-getmodel/

Our model’s soon to be created getGreetings method will return an array with strings, that will be our greetings, and the $this->assingRef(‘greetings’, $greetings) will make the array of greetings available in the view’s layout/template.

DETAIL 2.3.1: The assignRef(name, value)  method just does this: $this->name = &$value;  if the name doesn’t start with ‘_’. Because, the JViews’ display method “include” the layout/template, the $this->name will be available to use in the layout/template code. See www.php.net/include/

Finally, the parent::display calls the JViews default display method that will “include” the layout/template file. We’ll do that file next.

The layout/template file is called default.php and should be located in

folder were you’ve installed joomla/components/com_greetings/views/greetings/tmpl/default.php

And should look like this:

<?php // no direct access

defined('_JEXEC') or die('Restricted access'); ?>

<h1>Greetings</h1>
<ul>
<?php
         if (sizeof($this->greetings) > 0){
                   foreach ($this->greetings as $greeting){?>
                            <li><?php echo $greeting; ?></li>             
<?php
                   }?>
</ul>
<?php   
         }else{
                   echo "No greetings found...";
         }
?>

But don’t try this yet, we still have to do the model.

DETAIL 2.3.2: As with the Controller, you can also change the default parameters for the view’s constructor, where, for example, is defined that the layout/templates’ folder is ‘tmpl’. Here’s the list:

name: The view’s name. Note that changing this does not influence the naming conventions used in the JController.  The reason for this is that the controller fetches the file for the view without instantiating the view (how could it, the file hasn’t been “required” yet). What this influences though is the default template path. Probably you shouldn’t mess with this…

charset: set the charset (used by the variable escaping functions) [I just copied this from the comments in the source code, I didn’t really spend any time finding out what this is for, if you think it’s important, and you know what this is for, write me, and I’ll put it here].
escape: user-defined escaping callback [Same as above]

base_path: default value is the path to the component (works in the frontend and backend)

template_path: the default vaule is [base_path]/views/[name]/tmpl. Remember that [name] is the first parameter described above.

helper_path: I didn’t see what helpers are for yet… [Same as charset and escape]

layout: view’s layout/template name, the default is ‘default’.

DETAIL 2.3.3: The JView::display has one optional parameter, called $tmpl, if you specify it, the layout/template name gets appended what you put there. For example if the layout is ‘default’ and you do this: display(‘Test’); the layout file will have to be called ‘default_test.php’ (The file name has to be lowercase). [I don’t see much use for this feature]

Section 2.4: The Model

Our model will be responsible for getting a list of greetings from the database. Remember from the view’s code, that we used a method named getGreetings. That will be the method that will get the greetings from the database.

Before we do the model, let’s create and put some data in the database's table that will hold our greetings.

If you want to use phpmyadmin (I'm using version 2.11.3):

  1. Open phpmyadmin and select the database that you’re using for your joomla installation;
  2. At the bottom of the page you have an option to "Create new table on database";
  3. Create a table named jos_greetings (or with the table prefix (the default table prefix is jos_) that you used in your joomla instalation) with 2 fields
  4. Name the first field id, set the type to INT, set the Extras to auto_increment and select as primary key (it's the first radio button). Leave the rest as default;
  5. Name the second field greeting and set the type to VARCHAR and Length/Values to 100. Leave the rest as default;
  6. Click save;
  7. Click in the insert tab;
  8. In the id field put value: 1;
  9. In the greeting field put value: Gretings that came from the DB!
  10. Insert some more if you want;

If you want to use MySQL command line client, log in, select that right database for your joomla installation (show databases; use databasename) and then:

CREATE TABLE `jos_greetings` (
 `id` int(11) NOT NULL auto_increment,
 `greeting` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
);
 INSERT INTO `jos_greetings` (`greeting`) VALUES ('Gretings that came from the DB!'), ('greeting II'), ('greeting III');

One important thing you must know about here is what this ‘jos_’ prefix is. You define it when you install joomla (‘jos_’ is the default prefix for the table names). The table prefix is useful if you only have one database and want to use more than one joomla site with that database. All the joomla sites can share the database if they use different prefixes.

Now let’s do the model:

The model’s file with the source code should be at:
place where you’ve installed joomla/components/com_greetings/models/greetings.php

and the classname should be:
GreetingsModelGreetings

Remember, the class name is (because we use JControllers default display method) [ControllerName]Model[ViewName] and the file name is at models/[ViewName].php.

Our model will extend JModel and will implement the getGreetings method that we used earlier in the view:

<?php

//No direct acesss
defined('_JEXEC') or die();

jimport('joomla.application.component.model');

class GreetingsModelGreetings extends JModel {
      
      
       function getGreetings(){
             $db = $this->getDBO();
            
             $db->setQuery('SELECT greeting from #__greetings');
             $greetings = $db->loadResultArray();

            
             if ($greetings === null)
                    JError::raiseError(500, 'Error reading db');
                   
             return $greetings;
       }
}
?>

Important stuff: the getDBO method is a JModel’s method that returns the database connector object (that is an implementation of JDatabase) that we will use to access the DB.

There are other JModel’s methods that might be useful, you can read about them here (http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:application:jmodel/&s=jmodel)

Next, the setQuery method sets query to be executed and replaces the table prefix (‘#__’) by the right table prefix set when installing joomla (the default is ‘jos_’).

The $db->loadResultArray() returns an array with a “single field” from all the rows returned by the database query. Returns null if nothing is found.

DETAIL 2.4.1 List of JDatabase methods that might be useful (apart from loadResultArray):

loadObject - Loads an object with fields from the first row returned by the current SQL query. The method returns an object loaded with the data retrieved from the database. If the query fails, the method returns null.

loadObjectList($key) - Returns an array of database objects using the current SQL query. Returns false if the query fails. If the $key parameter is set, the array is indexed using the values of the field specified by key. Otherwise, the array is indexed sequentially.

loadResult - This method loads the first field of the first row returned by the query. The return type depends on the value stored in the database.

loadResultArray($numinarray) - Returns an array containing a single field from all the rows returned by the database query. $numinarrayis an integer containing the numeric offset of the field in the database row. This field is optional and if omitted will return the first field in each row (that is, field 0).

loadRow - Returns the first row of the current query as an array. If the query fails then returns null.

loadRowList( $key )- Returns an array of database rows with numeric column indexing. Returns null if the query fails.  $key is a string containing the field name. If $key is empty then loadRowList will return a sequential list of the database records returned by the current query. If $key is not empty then the array will be indexed by the value of the database key. This parameter is optional and if omitted will default to empty.

Check the whole lot here:  http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:database:jdatabase/

An important note about the three ‘=’s in the “if ($greetings === null)“. If you test if an empty array is null with ‘==’ it will return true in php. So if you want to distinguish between an error and an empty array you have to use the ‘===’ comparison operator.

See:
http://php.net/null
and :
http://php.net/manual/en/language.operators.comparison.php

It is good practice to handle your errors appropriately; you can use JError class to display error messages.  That is why when we detect that the loadResultArray method returns null we call the JError’s raiseError method, that will display the error message:  “Error reading db” with error code 500 (internal server error). Check out JError here:
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,guidelines:jerror/
and here:
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:utilities:jerror/

And that’s it, test the component by typing in the url index.php?option=com_greetings. A list of the greetings present in the database should appear.

If you find errors carefully check if you've put all files in the right places.

Click here to download the code from discussed in part of the tutorial(if you want to try it, unzip the file to folder where you've installed joomla/components [Remember, this won't work if you haven't set the database tables for the component properly]) .

For questions or comments go here.

Last Updated ( Saturday, 21 June 2008 20:12 )
 
Joomla 1.5 Templates by Joomlashack