Monday, October 12, 2009

Custom Search Component

Ok, next step.

I need to search my user-base for Authors (based on title, first, middle and surname) and then present a list of them. Then, when selected i need to show their list of content.

Seemingly, there's nothing to do that, so i'll have to do it myself. i'll document as i go. I'm starting with this tutorial.

Update #1
Right, its quite straightforward create your own component; at least so far it has been. The first step, for me, was to get a simple component installed and running; i can then get it to do fancy stuff after that.

The link above was right on the money (as it should be i suppose!), the only difference being that the guide above put everything in a site folder for some reason. I didn't; i looked at the other standard components to see how they did it and there was no sub directory.

So, the order to creating my new search was


  • create a new development directory say, and within that create a directory called com_xyz where xyz is the name of your component.

  • Under that the entry point Php file xyz.php

  • Add a controller.php as well; this contains the controller sub-class, e.g. XYZController

  • Create a view class to pull together the data you'll need in the scrren(s). This file is views/xyz/view.html.php

  • Create a default template called views/xyz/tmpl/default.php for presenting the information

  • Add an XML descriptor holding metadata about the component.



So, thats the first pass; i'll add more once it becomes more functional

No comments: