If you want to add fields in registration form on joomla 1.0 its easy because there you can easily add new variables in user class, but joomla 1.5 architecture is much different from 1.0 . So you can follow given steps to add new fields in joomla 1.5:

Step 1: Add new fields in user table in database.

example:

ALTER TABLE jos_users ADD occupation VARCHAR (100) NO NULL AFTER name;
and
ALTER TABLE jos_users ADD position VARCHAR (100) NO NULL AFTER occupation;

Step 2: Modify the user class to include the new files in libraries/joomla/table/user.php

Example: Add new variables in user class as given below

var $occupation = null;

var $position = null;

Step 3:Now you can modify the code (default.php) which displays the registration page on Root Folder/components/com_user/view/register/tmpl/default.php

Example:

<tr>
<td width=”30%” height=”40″>
<label id=”myoccupation” for=”occupation”><?php echo JText::_( ‘Occupation’ ); ?>: </label> </td>
<td>
<input type=”text” name=”occupation” id=”occupation” size=”40″ value=”<?php echo $this->user->get( ‘occupation‘ );?>” class=”inputbox required” maxlength=”50″ /> * </td>
</tr>

Now your new fields are available on your registration form.

enjoy…..

“JHTML form not supported. File not found”

This problem occures when a file form.php is missing. Its necessary to recover this file from Root Folder/libraries/joomla/html/html/form.php

You can place this file or install new joomla version to resolve this problem.

Session handling in joomla 1.5
Posted on December 15, 2008

Here’s a way to handle sessions in joomla 1.5:

$session =& JFactory::getSession();
$session->set(’variable_name’, ‘variable_value’);
$session->get(’variable_name’);

Double the performance of Paginations.
Posted on December 15, 2008

FOUND_ROWS()

A SELECT statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many rows the statement would have returned without the LIMIT, but without running the statement again. To obtain this row count, include a SQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke FOUND_ROWS() afterward:

mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name
-> WHERE id > 100 LIMIT 10;
mysql> SELECT FOUND_ROWS();

The second SELECT returns a number indicating how many rows the first SELECT would have returned had it been written without the LIMIT clause.

In the absence of the SQL_CALC_FOUND_ROWS option in the most recent SELECT statement, FOUND_ROWS() returns the number of rows in the result set returned by that statement.

The row count available through FOUND_ROWS() is transient and not intended to be available past the statement following the SELECT SQL_CALC_FOUND_ROWS statement. If you need to refer to the value later, save it:

mysql> SELECT SQL_CALC_FOUND_ROWS * FROM … ;
mysql> SET @rows = FOUND_ROWS();

If you are using SELECT SQL_CALC_FOUND_ROWS, MySQL must calculate how many rows are in the full result set. However, this is faster than running the query again without LIMIT, because the result set need not be sent to the client.

SQL_CALC_FOUND_ROWS and FOUND_ROWS() can be useful in situations when you want to restrict the number of rows that a query returns, but also determine the number of rows in the full result set without running the query again. An example is a Web script that presents a paged display containing links to the pages that show other sections of a search result. Using FOUND_ROWS() allows you to determine how many other pages are needed for the rest of the result.

The use of SQL_CALC_FOUND_ROWS and FOUND_ROWS() is more complex for UNION statements than for simple SELECT statements, because LIMIT may occur at multiple places in a UNION. It may be applied to individual SELECT statements in the UNION, or global to the UNION result as a whole.

The intent of SQL_CALC_FOUND_ROWS for UNION is that it should return the row count that would be returned without a global LIMIT. The conditions for use of SQL_CALC_FOUND_ROWS with UNION are:

The SQL_CALC_FOUND_ROWS keyword must appear in the first SELECT of the UNION.

The value of FOUND_ROWS() is exact only if UNION ALL is used. If UNION without ALL is used, duplicate removal occurs and the value of FOUND_ROWS() is only approximate.

If no LIMIT is present in the UNION, SQL_CALC_FOUND_ROWS is ignored and returns the number of rows in the temporary table that is created to process the UNION.

Important
FOUND_ROWS() is not replicated reliably, and should not be used with databases that are to be replicated.

Joomla Reference link for pagination:
http://docs.joomla.org/Using_JPagination_in_your_component

Steps to install a module in Joomla 1.5:
Posted on December 15, 2008

Hi friends,

Are you new to joomla 1.5 and find yourself in trouble installing a module?  No problem here you can get the solution.

Steps to install a module in Joomla 1.5:

•    First go to admin section and on mouse-over at “Extension” tab a drop down of child menu will appear then click on ‘install/uninstall’ menu. It will take you to a page with upload & install button along with browse button.
•    Click on browse button and select the module zip file which you want to install.
•    Click on upload & install button. This will automatically install your module.

In a nutshell, the installation involves following steps:
<em>Joomla Admin Section -> Extension -> Install/Uninstall -> Browse -> select zip file -> Upload & Install -> module has been successfully uploaded.</em>

Troubleshoot:
Are you still in trouble!!! Not able to install because of following problem: “JFolder::create: Path not in open_basedir paths Warning! - Failed to move file” OR “Unable to find install package”.

Then once again go to the admin panel and on mouse-over at “Help” tab a drop down with child menu will appear. Click on “system info”. Then click on the “Directory Permissions”.

The page will display number of folders which are used while installation and the information if these folders are writable/un-writable.

Now go through the directory in your file system and make all folders writable.

Making folders writable involves following steps:

<em>Joomla Admin Section -> Help -> System Info -> Directory Permissions -> find un-writable folders -> Go to the directory in your file system and make them writable</em>

Still in trouble!!! Do write your comments here and I will try to solve the problem.

Happy reading AlgoBlog!!!

Easiest way to make a component in any joomla version

As you know there are many articles regarding development in joomla, developer prefers their own way of developing things, sometimes we develop things which are not useful for joomla community, but it is for the application.
Here is a very simple way to just begin things in joomla, as a developer it always strike in our minds to develop a component or module, without even knowing the work flow of the application.

Let’s begin:

Suppose we are making a component named “booking”.
Just create a file named joomla-installation-directory/components/com_booking/booking.php
And
And create another file named
joomla-installation-directory/administrator/components/com_booking/admin.booking.php

You must be thinking what to do now? Let me tell u that it is done, surprised? Should be, so less to do….now what?

First check following URLs:
1. <a href=”http://domain.com/index.php?option=com_booking”>http://domain.com/index.php?option=com_booking</a> and
2. <a href=”http://domain.com/administrator/index2.php?option=com_booking”>http://domain.com/administrator/index2.php?option=com_booking</a> .

A blank page!  No output? What should I do here? Many queries in your mind, but for further development, it all depends upon you, how a programmer does the development, whether he wants a secure thing or develop a menu scheme, whatever you want, like booking component to be listed in Components menu of joomla admin, it is all up to you, how you are going to make thing easier, better etc. as a developer, your PHP file is running dude. Creativity is up to you.

One more step ahead: Registering your component in the database.

Just check the image below, suppose you have a jos_ prefix by default. Fill the jos_components table as shown in the image. This my phpmyadmin (a database management web based client) image. Just save and check the administration>>Menu>>Components>>Booking, and do check the URL. This URL is the second one, as mentioned above.

<img src=”http://www.algoworks.com/images/booking_component.gif” alt=”Image” />

WYSWYG Editor in Joomla 1.5
Posted on December 15, 2008

<?php

$document =&amp; JFactory::getDocument();
$document-&gt;addScript(&#39;plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js&#39;);
$body = isset($data-&gt;body) ? $data-&gt;body: &#39;&#39;;
?&gt;
&lt;textarea name=&quot;body&quot; id=&quot;body&quot; cols=&quot;50&quot; rows=&quot;4&quot; &gt;&lt;?php echo $body; ?&gt;&lt;/textarea&gt;

<p>&lt;script type=&quot;text/javascript&quot;&gt;
tinyMCE.init({
mode : &quot;textareas&quot;,
theme : &quot;simple&quot;
});
&lt;/script&gt;

jimport(’joomla.html.html’);
// Load the form validation behavior
JHTML::_(’behavior.formvalidation’);

// Add the tooltip behavior
JHTML::_(’behavior.tooltip’);

For tooltip use class=’hasTip’ and title=”Main::description” format
for form validation follow <a href=”http://docs.joomla.org/Form_validation”>http://docs.joomla.org/Form_validation</a>

Use this for die(); in joomla 1.5
Posted on December 15, 2008

global $mainframe;
$mainframe->close();

You login to the Admin interface, click Components > Virtuemart
Click the menu Products > Product Type > Add/Edit Product Type
Enter a new product type called Book, and a description, click Save (top right)

This will take you to a list of product types, including the one you’ve just created, now click the [Show] link to the right of Parameters for Books (it’s on the same row)

This should give you an empty list of parameters for the product type Book.

On the top right, above the Virtuemart menu, you should have “New” and “Delete” buttons. Click “New” to create a new parameter for this product type. Enter the details and click “Save”, again top right.

We’re setting up a book store and have added parameters like ISBN, Author, Genre, Fiction / Non-Fiction, etc. Quick point, all of these are of the “Short Text” type. I may be wrong, but I think Text is the mySQL field type TEXT which is huge as opposed to the type STRING which is up to 255 characters.

In order to create a new product with this category, you can click Products > Add Product, then enter the basic product details, click “Save”, and then on the results page which displays you’re newly created product, click on the product name link and then click “Add Product Type” in the top right hand corner. You can then attach the Product Type Book to this product by selecting it from the drop down and clicking “Save” in the top right hand corner.

Once the Product Type has been attached to the Product, you need to go back into editing the product, and a new tab will have appeared called Book, to the right of “Product Information”, “Product Status”, etc. Here you can enter the details according to how you set up the product type Book.

This whole process does seem a bit clunky, there may be an easier way I’m not aware of.

How this applies to searching for products I don’t yet know, again, maybe somebody else can shed some light on it.

Good luck,

Enjoy Algo Blogging