Top Left Text cha

Web & App Development

testtesttest
Comment (0) Hits: 1214
This is basically the equivalent of WordPress's 'do_shortcode' for Joomla.

If your shortcode is, for example, {component shortcode}, the following line will work...

echo JHtml::_('content.prepare', '{component shortcode}');
...or...

$output =JHTML::_('content.prepare', $output); return $output; 


In my most recent case, I needed to grab the user id of the person that authored a resume to use in the shortcode...

$resUid = $this->resume->uid;
$notify = JHtml::_('content.prepare', '{pmslink:id='.$resUid.'}');
return $notify;
Comment (0) Hits: 6909
I have found by researching some good reviews on some very terrible extensions... basically scams, that the Joomla Extension Directory hosted by Joomla.org is nothing but fake reviews. I've reported extensions, reported obvious fake reviews, and no response.

DO NOT TRUST REVIEWS ON THE JOOMLA EXTENSIONS DIRECTORY!

Here's a good example. JS Jobs has something like a rating of 90. And all these reviews saying how great it is. Here's some REAL reviews on JS Jobs. It also does no good to report extensions like JS Jobs that is just there to scam money off people. I believe it is a front and a scam for terrorist organizations in Pakistan. But hey, go ahead and support them, Joomla. Most of the Joomla developers are a lot closer to those evil countries than we are here in the U.S. So hopefully they get what they deserve if they continue to support coders in countries like Pakistan.
Comment (0) Hits: 2274
They don't work. And they won't work. They're pretty much a trash junk feature. The developers that contribute to Joomla are TERRIBLE. There is no way to display the custom fields in the front end, so give up before you spend hours trying to get them to display like I did. Of course the documentation on them is very poor - just like all Joomla documentation. It's written in poor English and incomplete. They don't mention that this stupid sloppily created feature doesn't do any good if you need your users to input custom fields on their articles.
Comment (0) Hits: 1535

The Query

Joomla's database querying has changed since the new Joomla Framework was introduced "query chaining" is now the recommended method for building database queries (although string queries are still supported).

Query chaining refers to a method of connecting a number of methods, one after the other, with each method returning an object that can support the next method, improving readability and simplifying code.

To obtain a new instance of the JDatabaseQuery class we use the JDatabaseDriver getQuery method:

$db = JFactory::getDbo();
 
$query = $db->getQuery(true);

The JDatabaseDriver::getQuery takes an optional argument, $new, which can be true or false (the default being false).

To query our data source we can call a number of JDatabaseQuery methods; these methods encapsulate the data source's query language (in most cases SQL), hiding query-specific syntax from the developer and increasing the portability of the developer's source code.

Some of the more frequently used methods include; select, from, join, where and order. There are also methods such as insert, update and delete for modifying records in the data store. By chaining these and other method calls, you can create almost any query against your data store without compromising portability of your code.

Inserting a Record

Using SQL

The JDatabaseQuery class provides a number of methods for building insert queries, the most common being insert, columns and values.

// Get a db connection.
$db = JFactory::getDbo();
 
// Create a new query object.
$query = $db->getQuery(true);
 
// Insert columns.
$columns = array('user_id', 'profile_key', 'profile_value', 'ordering');
 
// Insert values.
$values = array(1001, $db->quote('custom.message'), $db->quote('Inserting a record using insert()'), 1);
 
// Prepare the insert query.
$query
    ->insert($db->quoteName('#__user_profiles'))
    ->columns($db->quoteName($columns))
    ->values(implode(',', $values));
 
// Set the query using our newly populated query object and execute it.
$db->setQuery($query);
$db->execute();

Using an Object

The JDatabaseDriver class also provides a convenient method for saving an object directly to the database allowing us to add a record to a table without writing a single line of SQL.

// Create and populate an object.
$profile = new stdClass();
$profile->user_id = 1001;
$profile->profile_key='custom.message';
$profile->profile_value='Inserting a record using insertObject()';
$profile->ordering=1;
 
// Insert the object into the user profile table.
$result = JFactory::getDbo()->insertObject('#__user_profiles', $profile);

Notice here that we do not need to escape the table name; the insertObject method does this for us.

The insertObject method will throw a error if there is a problem inserting the record into the database table.

We need to ensure that the record does not exist before attempting to insert it, so adding some kind of record check before executing the insertObject method would be recommended.

Updating a Record

Using SQL

The JDatabaseQuery class also provides methods for building update queries, in particular update and set. We also reuse another method which we used when creating select statements, the where method.

$db = JFactory::getDbo();
 
$query = $db->getQuery(true);
 
// Fields to update.
$fields = array(
    $db->quoteName('profile_value') . ' = ' . $db->quote('Updating custom message for user 1001.'),
    $db->quoteName('ordering') . ' = 2'
);
 
// Conditions for which records should be updated.
$conditions = array(
    $db->quoteName('user_id') . ' = 42', 
    $db->quoteName('profile_key') . ' = ' . $db->quote('custom.message')
);
 
$query->update($db->quoteName('#__user_profiles'))->set($fields)->where($conditions);
 
$db->setQuery($query);
 
$result = $db->execute();

Using an Object

Like insertObject, the JDatabaseDriver class provides a convenience method for updating an object.

Below we will update our custom table with new values using an existing id primary key:

// Create an object for the record we are going to update.
$object = new stdClass();
 
// Must be a valid primary key value.
$object->id = 1;
$object->title = 'My Custom Record';
$object->description = 'A custom record being updated in the database.';
 
// Update their details in the users table using id as the primary key.
$result = JFactory::getDbo()->updateObject('#__custom_table', $object, 'id');

Just like insertObject, updateObject takes care of escaping table names for us.

The updateObject method will throw a error if there is a problem updating the record into the database table.

We need to ensure that the record already exists before attempting to update it, so we would probably add some kind of record check before executing the updateObject method.

Deleting a Record

Finally, there is also a delete method to remove records from the database.

$db = JFactory::getDbo();
 
$query = $db->getQuery(true);
 
// delete all custom keys for user 1001.
$conditions = array(
    $db->quoteName('user_id') . ' = 1001', 
    $db->quoteName('profile_key') . ' = ' . $db->quote('custom.%')
);
 
$query->delete($db->quoteName('#__user_profiles'));
$query->where($conditions);
 
$db->setQuery($query);
 
$result = $db->execute();
Comment (0) Hits: 8335
Another sign that Joomla is going downhill... the JED (Joomla Extension Directory) won't allow reviews.  Even though I have a profile, it just keeps saying you must log in.  If they can't keep their own extension directory up to date or don't care, then I can see why extensions lately are very unreliable.  They also don't take anything seriously when you report an extension.  It's like they just don't care about their CMS anymore.
Comment (0) Hits: 2095

We can use multiple joins to query across more than two tables:

$query
    ->select(array('a.*', 'b.username', 'b.name', 'c.*', 'd.*'))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->join('LEFT', $db->quoteName('#__user_profiles', 'c') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('c.user_id') . ')')
    ->join('RIGHT', $db->quoteName('#__categories', 'd') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('d.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');

Notice how chaining makes the source code much more readable for these longer queries.

In some cases, you will also need to use the AS clause when selecting items to avoid column name conflicts. In this case, multiple select statements can be chained in conjunction with using the second parameter of $db->quoteName.

$query
    ->select('a.*')
    ->select($db->quoteName('b.username', 'username'))
    ->select($db->quoteName('b.name', 'name'))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');

A second array can also be used as the second parameter of the select statement to populate the values of the AS clause. Remember to include nulls in the second array to correspond to columns in the first array that you don't want to use the AS clause for:

$query
    ->select(array('a.*'))
    ->select($db->quoteName(array('b.username', 'b.name'), array('username', 'name')))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');
Comment (0) Hits: 2379
I've looked and looked... there's nothing in the JED that works for this.  There is one plugin that supposedly does this (Nomad), but all it really does is through up a bunch of JS errors in the console when you try to add more than 1 rule.  Even tried manipulating the database data for the plugin and couldn't get it working.  Seems simpler to just write a PHP script and stick it in a custom HTML module (I use Custom HTML Advanced) - and assign that to the home page only.  Here's the script...

<?php
$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group) {
if ($group==10) {
$goto =& JFactory::getApplication();
$goto->redirect('/jobseeker-control-panel');}
if ($group==11) {
$goto =& JFactory::getApplication();
$goto->redirect('/employer-control-panel');}
}
?>

So there's no need to install a plugin for something this simple. That is, if there were such a plugin.

Of course you'll have to change the group numbers and redirection URL. Just look in the user group manager to decide what number to replace '10' and '11' with. And I'm sure you can figure out where you need them redirected to.
Comment (4) Hits: 6162
This is useful if you want to add a class to change things on the page depending on the usergroup.  Just insert the PHP below wherever you want to echo the usergroup...

<?php
$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group) {echo 'group'.$group.' ';}?>
Comment (0) Hits: 1685
 

The Query

Joomla's database querying changed with the introduction of Joomla 1.6. The recommended way of building database queries is through "query chaining" (although string queries are still supported).

Query chaining refers to a method of connecting a number of methods, one after the other, with each method returning an object that can support the next method, improving readability and simplifying code.

To obtain a new instance of the JDatabaseQuery class we use the JDatabaseDriver getQuery method:

$db = JFactory::getDbo();
 
$query = $db->getQuery(true);

The JDatabaseDriver::getQuery takes an optional argument, $new, which can be true or false (the default being false).

To query our data source we can call a number of JDatabaseQuery methods; these methods encapsulate the data source's query language (in most cases SQL), hiding query-specific syntax from the developer and increasing the portability of the developer's source code.

Some of the more frequently used methods include; select, from, join, where and order. There are also methods such as insert, update and delete for modifying records in the data store. By chaining these and other method calls, you can create almost any query against your data store without compromising portability of your code.

Selecting Records from a Single Table

Below is an example of creating a database query using the JDatabaseQuery class. Using the select, from, where and order methods, we can create queries which are flexible, easily readable and portable:

// Get a db connection.
$db = JFactory::getDbo();
 
// Create a new query object.
$query = $db->getQuery(true);
 
// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.
$query->select($db->quoteName(array('user_id', 'profile_key', 'profile_value', 'ordering')));
$query->from($db->quoteName('#__user_profiles'));
$query->where($db->quoteName('profile_key') . ' LIKE '. $db->quote('\'custom.%\''));
$query->order('ordering ASC');
 
// Reset the query using our newly populated query object.
$db->setQuery($query);
 
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();

The query can also be chained to simplify further:

$query
    ->select($db->quoteName(array('user_id', 'profile_key', 'profile_value', 'ordering')))
    ->from($db->quoteName('#__user_profiles'))
    ->where($db->quoteName('profile_key') . ' LIKE '. $db->quote('\'custom.%\''))
    ->order('ordering ASC');

Chaining can become useful when queries become longer and more complex.

Grouping can be achieved simply too. The following query would count the number of articles in each category.

$query
    ->select( array('catid', 'COUNT(*)') )
    ->from($db->quoteName('#__content'))
    ->group($db->quoteName('catid'));

A limit can be set to a query using "setLimit". For example in the following query, it would return up to 10 records.

$query
    ->select($db->quoteName(array('user_id', 'profile_key', 'profile_value', 'ordering')))
    ->from($db->quoteName('#__user_profiles'))
    ->setLimit('10');

Selecting Records from Multiple Tables

Using the JDatabaseQuery's join methods, we can select records from multiple related tables. The generic "join" method takes two arguments; the join "type" (inner, outer, left, right) and the join condition. In the following example you will notice that we can use all of the keywords we would normally use if we were writing a native SQL query, including the AS keyword for aliasing tables and the ON keyword for creating relationships between tables. Also note that the table alias is used in all methods which reference table columns (I.e. select, where, order).

// Get a db connection.
$db = JFactory::getDbo();
 
// Create a new query object.
$query = $db->getQuery(true);
 
// Select all articles for users who have a username which starts with 'a'.
// Order it by the created date.
// Note by putting 'a' as a second parameter will generate `#__content` AS `a`
$query
    ->select(array('a.*', 'b.username', 'b.name'))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');
 
// Reset the query using our newly populated query object.
$db->setQuery($query);
 
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();

The join method above enables us to query both the content and user tables, retrieving articles with their author details. There are also convenience methods for joins:

We can use multiple joins to query across more than two tables:

$query
    ->select(array('a.*', 'b.username', 'b.name', 'c.*', 'd.*'))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->join('LEFT', $db->quoteName('#__user_profiles', 'c') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('c.user_id') . ')')
    ->join('RIGHT', $db->quoteName('#__categories', 'd') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('d.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');

Notice how chaining makes the source code much more readable for these longer queries.

In some cases, you will also need to use the AS clause when selecting items to avoid column name conflicts. In this case, multiple select statements can be chained in conjunction with using the second parameter of $db->quoteName.

$query
    ->select('a.*')
    ->select($db->quoteName('b.username', 'username'))
    ->select($db->quoteName('b.name', 'name'))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');

A second array can also be used as the second parameter of the select statement to populate the values of the AS clause. Remember to include nulls in the second array to correspond to columns in the first array that you don't want to use the AS clause for:

$query
    ->select(array('a.*'))
    ->select($db->quoteName(array('b.username', 'b.name'), array('username', 'name')))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');

 

Query Results

The database class contains many methods for working with a query's result set.

Single Value Result

loadResult()

Use loadResult() when you expect just a single value back from your database query.

id name email username
1 John Smith This email address is being protected from spambots. You need JavaScript enabled to view it. johnsmith
2 Magda Hellman This email address is being protected from spambots. You need JavaScript enabled to view it. magdah
3 Yvonne de Gaulle This email address is being protected from spambots. You need JavaScript enabled to view it. ydegaulle

This is often the result of a 'count' query to get a number of records:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('COUNT(*)');
$query->from($db->quoteName('#__my_table'));
$query->where($db->quoteName('name')." = ".$db->quote($value));
 
// Reset the query using our newly populated query object.
$db->setQuery($query);
$count = $db->loadResult();

or where you are just looking for a single field from a single row of the table (or possibly a single field from the first row returned).

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('field_name');
$query->from($db->quoteName('#__my_table'));
$query->where($db->quoteName('some_name')." = ".$db->quote($some_value));
 
$db->setQuery($query);
$result = $db->loadResult();

Single Row Results

Each of these results functions will return a single record from the database even though there may be several records that meet the criteria that you have set. To get more records you need to call the function again.

id name email username
1 John Smith This email address is being protected from spambots. You need JavaScript enabled to view it. johnsmith
2 Magda Hellman This email address is being protected from spambots. You need JavaScript enabled to view it. magdah
3 Yvonne de Gaulle This email address is being protected from spambots. You need JavaScript enabled to view it. ydegaulle

loadRow()

loadRow() returns an indexed array from a single record in the table:

. . .
$db->setQuery($query);
$row = $db->loadRow();
print_r($row);

will give:

Array ( [0] => 1, [1] => John Smith, [2] => This email address is being protected from spambots. You need JavaScript enabled to view it., [3] => johnsmith ) 
You can access the individual values by using:
$row['index'] // e.g. $row['2']

Notes:

  1. The array indices are numeric starting from zero.
  2. Whilst you can repeat the call to get further rows, one of the functions that returns multiple rows might be more useful.

loadAssoc()

loadAssoc() returns an associated array from a single record in the table:

. . .
$db->setQuery($query);
$row = $db->loadAssoc();
print_r($row);

will give:

Array ( [id] => 1, [name] => John Smith, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => johnsmith )
You can access the individual values by using:
$row['name'] // e.g. $row['email']

Notes:

  1. Whilst you can repeat the call to get further rows, one of the functions that returns multiple rows might be more useful.

loadObject()

loadObject returns a PHP object from a single record in the table:

. . .
$db->setQuery($query);
$result = $db->loadObject();
print_r($result);

will give:

stdClass Object ( [id] => 1, [name] => John Smith, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => johnsmith )
You can access the individual values by using:
$result->index // e.g. $result->email

Notes:

  1. Whilst you can repeat the call to get further rows, one of the functions that returns multiple rows might be more useful.

Single Column Results

Each of these results functions will return a single column from the database.

id name email username
1 John Smith This email address is being protected from spambots. You need JavaScript enabled to view it. johnsmith
2 Magda Hellman This email address is being protected from spambots. You need JavaScript enabled to view it. magdah
3 Yvonne de Gaulle This email address is being protected from spambots. You need JavaScript enabled to view it. ydegaulle

loadColumn()

loadColumn() returns an indexed array from a single column in the table:

$query->select('name'));
      ->from . . .";
. . .
$db->setQuery($query);
$column= $db->loadColumn();
print_r($column);

will give:

Array ( [0] => John Smith, [1] => Magda Hellman, [2] => Yvonne de Gaulle )
You can access the individual values by using:
$column['index'] // e.g. $column['2']

Notes:

  1. The array indices are numeric starting from zero.
  2. loadColumn() is equivalent to loadColumn(0).

loadColumn($index)

loadColumn($index) returns an indexed array from a single column in the table:

$query->select(array('name', 'email', 'username'));
      ->from . . .";
. . .
$db->setQuery($query);
$column= $db->loadColumn(1);
print_r($column);

will give:

Array ( [0] => This email address is being protected from spambots. You need JavaScript enabled to view it., [1] => This email address is being protected from spambots. You need JavaScript enabled to view it., [2] => This email address is being protected from spambots. You need JavaScript enabled to view it. )
You can access the individual values by using:
$column['index'] // e.g. $column['2']

loadColumn($index) allows you to iterate through a series of columns in the results

. . .
$db->setQuery($query);
for ( $i = 0; $i <= 2; $i++ ) {
  $column= $db->loadColumn($i);
  print_r($column);
}

will give:

Array ( [0] => John Smith, [1] => Magda Hellman, [2] => Yvonne de Gaulle ),
Array ( [0] => This email address is being protected from spambots. You need JavaScript enabled to view it., [1] => This email address is being protected from spambots. You need JavaScript enabled to view it., [2] => This email address is being protected from spambots. You need JavaScript enabled to view it. ),
Array ( [0] => johnsmith, [1] => magdah, [2] => ydegaulle )

Notes:

  1. The array indices are numeric starting from zero.

Multi-Row Results

Each of these results functions will return multiple records from the database.

id name email username
1 John Smith This email address is being protected from spambots. You need JavaScript enabled to view it. johnsmith
2 Magda Hellman This email address is being protected from spambots. You need JavaScript enabled to view it. magdah
3 Yvonne de Gaulle This email address is being protected from spambots. You need JavaScript enabled to view it. ydegaulle

loadRowList()

loadRowList() returns an indexed array of indexed arrays from the table records returned by the query:

. . .
$db->setQuery($query);
$row = $db->loadRowList();
print_r($row);

will give (with line breaks added for clarity):

Array ( 
[0] => Array ( [0] => 1, [1] => John Smith, [2] => This email address is being protected from spambots. You need JavaScript enabled to view it., [3] => johnsmith ), 
[1] => Array ( [0] => 2, [1] => Magda Hellman, [2] => This email address is being protected from spambots. You need JavaScript enabled to view it., [3] => magdah ), 
[2] => Array ( [0] => 3, [1] => Yvonne de Gaulle, [2] => This email address is being protected from spambots. You need JavaScript enabled to view it., [3] => ydegaulle ) 
)
You can access the individual rows by using:
$row['index'] // e.g. $row['2']
and you can access the individual values by using:
$row['index']['index'] // e.g. $row['2']['3']

Notes:

  1. The array indices are numeric starting from zero.

loadAssocList()

loadAssocList() returns an indexed array of associated arrays from the table records returned by the query:

. . .
$db->setQuery($query);
$row = $db->loadAssocList();
print_r($row);

will give (with line breaks added for clarity):

Array ( 
[0] => Array ( [id] => 1, [name] => John Smith, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => johnsmith ), 
[1] => Array ( [id] => 2, [name] => Magda Hellman, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => magdah ), 
[2] => Array ( [id] => 3, [name] => Yvonne de Gaulle, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => ydegaulle ) 
) 
You can access the individual rows by using:
$row['index'] // e.g. $row['2']
and you can access the individual values by using:
$row['index']['column_name'] // e.g. $row['2']['email']

loadAssocList($key)

loadAssocList('key') returns an associated array - indexed on 'key' - of associated arrays from the table records returned by the query:

. . .
$db->setQuery($query);
$row = $db->loadAssocList('username');
print_r($row);

will give (with line breaks added for clarity):

Array ( 
[johnsmith] => Array ( [id] => 1, [name] => John Smith, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => johnsmith ), 
[magdah] => Array ( [id] => 2, [name] => Magda Hellman, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => magdah ), 
[ydegaulle] => Array ( [id] => 3, [name] => Yvonne de Gaulle, [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => ydegaulle ) 
)
You can access the individual rows by using:
$row['key_value'] // e.g. $row['johnsmith']
and you can access the individual values by using:
$row['key_value']['column_name'] // e.g. $row['johnsmith']['email']

Note: Key must be a valid column name from the table; it does not have to be an Index or a Primary Key. But if it does not have a unique value you may not be able to retrieve results reliably.

loadAssocList($key, $column)

loadAssocList('key', 'column') returns an associative array, indexed on 'key', of values from the column named 'column' returned by the query:

. . .
$db->setQuery($query);
$row = $db->loadAssocList('id', 'username');
print_r($row);

will give (with line breaks added for clarity):

Array ( 
[1] => John Smith, 
[2] => Magda Hellman, 
[3] => Yvonne de Gaulle,
)

Note: Key must be a valid column name from the table; it does not have to be an Index or a Primary Key. But if it does not have a unique value you may not be able to retrieve results reliably.

loadObjectList()

loadObjectList() returns an indexed array of PHP objects from the table records returned by the query:

. . .
$db->setQuery($query);
$row = $db->loadObjectList();
print_r($row);

will give (with line breaks added for clarity):

Array ( 
[0] => stdClass Object ( [id] => 1, [name] => John Smith, 
    [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => johnsmith ), 
[1] => stdClass Object ( [id] => 2, [name] => Magda Hellman, 
    [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => magdah ), 
[2] => stdClass Object ( [id] => 3, [name] => Yvonne de Gaulle, 
    [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => ydegaulle ) 
)
You can access the individual rows by using:
$row['index'] // e.g. $row['2']
and you can access the individual values by using:
$row['index']->name // e.g. $row['2']->email

loadObjectList($key)

loadObjectList('key') returns an associated array - indexed on 'key' - of objects from the table records returned by the query:

. . .
$db->setQuery($query);
$row = $db->loadObjectList('username');
print_r($row);

will give (with line breaks added for clarity):

Array ( 
[johnsmith] => stdClass Object ( [id] => 1, [name] => John Smith, 
    [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => johnsmith ), 
[magdah] => stdClass Object ( [id] => 2, [name] => Magda Hellman, 
    [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => magdah ), 
[ydegaulle] => stdClass Object ( [id] => 3, [name] => Yvonne de Gaulle, 
    [email] => This email address is being protected from spambots. You need JavaScript enabled to view it., [username] => ydegaulle ) 
)
You can access the individual rows by using:
$row['key_value'] // e.g. $row['johnsmith']
and you can access the individual values by using:
$row['key_value']->column_name // e.g. $row['johnsmith']->email

Note: Key must be a valid column name from the table; it does not have to be an Index or a Primary Key. But if it does not have a unique value you may not be able to retrieve results reliably.

Miscellaneous Result Set Methods

getNumRows()

getNumRows() will return the number of result rows found by the last SELECT or SHOW query and waiting to be read. To get a result from getNumRows() you have to run it after the query and before you have retrieved any results. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use getAffectedRows().

. . .
$db->setQuery($query);
$db->execute();
$num_rows = $db->getNumRows();
print_r($num_rows);
$result = $db->loadRowList();
will return
3

Note: getNumRows() is only valid for statements like SELECT or SHOW that return an actual result set. If you run getNumRows() after loadRowList() - or any other retrieval method - you will get a PHP Warning:

Warning: mysql_num_rows(): 80 is not a valid MySQL result resource 
in libraries\joomla\database\database\mysql.php on line 344
Comment (0) Hits: 4040
So annoying.  Nothing bothers me more sometimes than someone's arrogance in thinking that everyone else likes what they like.  Tooltips... I hate them.  Especially the Joomla ones that say the same thing as the element you're rolling over.  I hate them even more when they interfere with style customizations.  Someone needs slapped for assuming the entire world wants useless tooltips.  Anyway, it's not easy to find them since they don't show up unless you're hovering over something.  But, they're easy to get rid of...

.tooltip {
display:none !important;
}

That's it.
Comment (1) Hits: 3155
I've tried posting this on the Joomla forum multiple times, but keep getting a 403 error because of some over-zealous filter...

I'm having an issue with the tags field. It's not displaying the input field... only the <select> field. So I'm stuck with nothing but a big empty select box (no <option>s inside the select field). Here's things I've checked to troubleshoot...

It IS set to Ajax in the 'data entry' tab of the tags options (and I did not alter any of the tag options from the default settings).
I've changed templates from my custom template to Protostar.
Disabled all 3rd party plugins.
Unpublished all modules.

Joomla version: 3.4.1

I just finished building a similar site with no issues there... save version (3.4.1).

At the bottom of this post is a comparison between the element which holds the tags input field. Where is the <div> on the new site with issues???

Thanks!

Source of site with issues:
<div class="controls"><select id="jform_tags" name="jform[tags][]" class="inputbox" size="45" multiple="">
</select>
</div>

Source of previous site with no issues:

<div class="controls"><select id="jform_tags" name="jform[tags][]" class="inputbox chzn-done" size="45" multiple="" style="display: none;">
<option value="2">chapter 13</option>
<option value="3">bankruptcy process</option>
<option value="4">chapter 7</option>
<option value="5">pre-bankruptcy</option>
<option value="6">bankruptcy</option>
<option value="7">meeting creditors</option>
<option value="8">attorney</option>
<option value="9">filing bankruptcy</option>
<option value="10">paying attorney</option>
</select><div class="chzn-container chzn-container-multi chzn-with-drop chzn-container-active" style="width: 137px;" title="" id="jform_tags_chzn"><ul class="chzn-choices"><li class="search-field"><input type="text" value="Select some options" class="default" autocomplete="off" style="width: 127px;"></li></ul><div class="chzn-drop"><ul class="chzn-results"><li class="active-result highlighted" style="" data-option-array-index="0">chapter 13</li><li class="active-result" style="" data-option-array-index="1">bankruptcy process</li><li class="active-result" style="" data-option-array-index="2">chapter 7</li><li class="active-result" style="" data-option-array-index="3">pre-bankruptcy</li><li class="active-result" style="" data-option-array-index="4">bankruptcy</li><li class="active-result" style="" data-option-array-index="5">meeting creditors</li><li class="active-result" style="" data-option-array-index="6">attorney</li><li class="active-result" style="" data-option-array-index="7">filing bankruptcy</li><li class="active-result" style="" data-option-array-index="8">paying attorney</li></ul></div></div>
</div>

 

I have the solution to your problem with the tags not displaying in the front end create form. It seems that you have Mootools disabled on the form that is not working. Not sure exactly why it needs it, as I haven't checked the Joomla code, but I had the same problem and once Mootools was enabled and the page refreshed the additional code was present upon the site and the form works correctly.

Fix provided by Macrotone Consulting

Comment (1) Hits: 4032
If you're creating a custom article template in /templates/your-template/html/article/custom-template.php, here's the 2 sets of code that will produce the URL of the image(s)...

Intro Image:
<?php echo htmlspecialchars($images->image_intro); ?>

 
Full Article Image:

<?php echo htmlspecialchars($images->image_fulltext); ?>

 

 
Comment (0) Hits: 4305
If you want a unique body class so that you can use different styles on different pages for styles that are typically common throughout the pages of Joomla. The uses for this are limitless.  I consider it a must have and include it on my template for every site I build.  Some templates may have this functionality included so you might want to check your template first.  I build my templates from scratch so I always need to do this.

Put this in the <head> section of your /template/index.php file:

    <?php
    $app = JFactory::getApplication();
    $menu = $app->getMenu()->getActive();
    $pageclass = '';

    if (is_object($menu))
        $pageclass = $menu->params->get('pageclass_sfx');
    if ($pageclass != "homePage") {$otherclass = " interiorPage";}
    else {$otherclass = "";}
    ?>

 Then replace the <body> tag of index.php with:

<body class="<?php echo $pageclass ? htmlspecialchars($pageclass) : 'default'; ?><?php echo $otherclass; ?>">

How to use:

Navigate to the menu item of the page you would like a unique style on.  

Under the 'page display' tab, enter the class you want to use in the field, 'Page Class'.  This comes with another advantageous element.  If you use the class, 'homePage' on your home page, it will also include the class, 'interiorPage' on all pages other than the home page.

Comment (0) Hits: 7121

Layout Overrides in Joomla

From Joomla! Documentation

 

Introduction to Alternative Layout Feature in Versions 2.5+

Joomla! 1.5 introduced the concept of overriding core layouts using the template override system. Joomla! version 2.5 introduces a set of features that give the site administrator more control over the display of articles, contacts, news feeds, and web links. There are four types of alternative layouts:

  1. Module
  2. Component
  3. Category
  4. Menu Item

Alternative layouts work in a similar fashion to the template override feature but allow you more options and control. Each type is discussed below.

Module Alternative Layouts

Creating an alternative layout for a module is similar to creating a template override for a module. In both cases, you create a folder called "templates/<your template>/html/<module name>. For example, the folder for a "mod_login" template override or alternative layout for the beez5 template would be "templates/beez5/html/mod_login/".

There are two important differences between a template override and an alternative layout. The first is the file name. For the template override, you would call the file "default.php" to match the core file name. For an alternative layout, you use a different name. The only rule is that the file name should not have any underscores in it. This allows you to have complex layouts that include multiple files. The initial file to be called is named without underscores and any other files that are called from this initial file will have underscores in the name. For example, you could have the initial file called "mynewlogin.php" which calls "mynewlogin_1.php".

The second important difference is that, unlike template override files which are called automatically whenever the module is displayed using the template with the override, an alternative layout file is only called if you select it as a parameter in the Module Manager. In version 2.5 and later, there is a new parameter under Advanced Options called Alternative Layout, as shown below.

Screenshot override tutorial 20110107-01.png
 

This parameter will list any files (without underscores) that you have placed in the template folder for this module. You can also translate the file name using the template's system language file. For example, if you add the line

TPL_BEEZ5_MOD_LOGIN_LAYOUT_NOLOGIN="Alt Login Layout"

to the file "en-GB.tpl_beez5.sys.ini", it will translate the file name "nologin.php" to "Alt Login Layout".

It is important to understand that if specified in the Module Manager screen, an alternative layout file for a module will be used for that module regardless of what template is used to display the page where the module is shown. It is therefore the administrator's responsibility to make sure that the layout file will work as desired in any templates where this module may be shown.

Plugin Alternative Layouts (overriding a plugin)

Yes,it's possible to override plugin outputs. It's very useful, especially for content plugins. However you can only do it if the plugin is ready to allow Overrides.

Tip-icon.png
A Tip!
 

Joomla provides a mechanism to override a plugin but this feature is not supported by all the plugins

Right now the only plugin in Joomla 3.x core that allow overrides is the Pagenavigation Content plugin that is responsible to show previous/next article links in article view of content component. There may be other plugins from 3rd party developers allowing it and more core plugins overridable in the future.

You will know when a plugin is overridable because has a /tmpl/ folder in it, see: https://github.com/joomla/joomla-cms/tree/staging/plugins/content/pagenavigation (note for developers: the plugin uses JPluginHelper::getLayoutPath() )

Plugin Override example

To override the output of Pagenavigation content plugin in "beez3" template, create a folder named "templates/beez3/html/plg_content_pagenavigation/" and copy the original layout file (plugins/content/pagenavigation/tmpl/default.php) to this new folder.

Now you can change this layout file to override plugin output.

Is important to note that to build the override layout you need to create it in this path:

templates/TEMPLATE-NAME/html/plg_PLUGIN-GROUP_PLUGIN-NAME/

example: templates/beez3/html/plg_content_pagenavigation/

Where PLUGIN-GROUP is the group to which the plugin belongs (is the name of the first folder where the plugin is located, see:https://github.com/joomla/joomla-cms/tree/staging/plugins, read more about Event groups at http://docs.joomla.org/Plugin/Events )

Component Alternative Layouts

Component alternative layouts work similarly to module layouts discussed above. Again, a file is placed in the same folder where you place a template override file. For example, to create an alternative layout for an article for the template "beez5", you would put a file in the folder "templates/beez5/html/com_content/article/". As with module layouts, the file should not be named the same as the core file and should not include underscores in the name. Additionally, there should not be an XML file of the same name in this folder. (We'll discuss XML files below under Menu Item Alternative Layouts.)

You can set a global value for component layouts in the Options window of the component. For example, in the Article Manager Options window, there is a parameter for Alternative Layout as shown below:

Screenshot override tutorial 20110107-02.png
 

This will create a global value that individual components (articles, contacts, newsfeeds, and weblinks) can inherit from.

As with module layouts, the component layouts are shown as parameter options in the individual component edit screen. For example, for an article, the parameter shows in the Article Options group as shown below.

Screenshot override tutorial 20110107-03.png
 

As with other parameters, the Use Global setting will use the setting from the Options parameter. The From Component's Default setting will use the component's default layout. Alternative layouts that you have created for different templates are shown under each template heading.

File names may be translated. The line below

TPL_BEEZ5_COM_CONTENT_ARTICLE_LAYOUT_MYLAYOUT="Title Only No XML"

will translate a file called "mylayout.php" as "Title Only No XML".

You can have more than one file for a layout. The initial file must be named without underscores and any additional files must have underscores.

Component alternative layouts may be used with articles, contacts, or news feeds. Web links don't have a single-component layout so no alternative layout is available for web links.

Component alternative layouts are only used when two conditions are met: (1) they are specified in the component parameters; and (2) there is no menu item for this specific component. For example, if you have one or more menu items of type "Single Article" set up for a given article, then the alternative layout for that article will not be used. Instead, the layout specified in the menu item will be used. This is consistent with the general way that component parameters work, where the most specific (in this case a single-article menu item) overrides the less specific (in this case, the article parameters).

Category Alternative Layouts

Category alternative layouts work identically to component layouts. The rules for specifying layout files are the same. The only difference is that the folder is the category folder, not the component folder. For example, a contact category alternative layout for beez5 would go in the folder "templates/beez5/html/com_contact/category".

You can set category layouts globally, in the Options screen of each component. Below is an example from the Contact Manager Options screen:

Screenshot override tutorial 20110107-04.png
 

Category alternative layouts show up when you add or edit a category in the Category Manager under the Basic Options, as shown below.

Screenshot override tutorial 20110107-05.png
 

Category alternative layouts may be used for articles, contacts, news feeds, and web links.

As with component layouts, category layouts only will show if (1) they are specified for the category in the global or category parameters and (2) there is no menu item specifically for this category (for example, List Contacts in a Category, List Newsfeeds in a Category, List Weblinks in a Category, Category List, Category Blog).

If there is a menu item set up for this specific category, that layout will be used instead of the alternative category layout.

Drill Down to Blog or List

For articles, we have two core layouts available: Blog and List. Both of these options show under the "From Component" heading in the layout parameters for article category. So, like other layout options, you can now select Blog or List for categories either globally (in the Article Manager Options, shown below), or when editing a single article category.

Screenshot override tutorial 20110107-06.png
 

This means that, like other layout options, you can control whether article category links drill down to blog or list layouts. It is important to understand that, like other layout parameters, this option will only take effect when there is no single-category menu item for the category.

Alternative Menu Items

Alternative Menu Items have one important difference with the others. To create a menu item alternative layout, you must include an XML file whose name matches the initial layout file. For example, to create an alternative menu item called "myarticle" for an article in the beez5 template, you would create two files in the "templates/beez5/html/com_content/article" folder called "myarticle.php" and "myarticle.xml". If you wanted to include more layout files, you would add these files with underscores in the file names.

The XML file uses the same format as the core Menu Item XML files. This allows you not only to create a customized layout for this menu item, it also allows you to create customized parameters. For example, you could hide some parameters or add new parameters.

Alternative Menu Items show up when you select a menu item type in the Menu Manager, as shown below.

Screenshot override tutorial 20110107-07.png
 

Alternative Menu Items are used and work the same way as standard menu items. Since they are already based on customised layouts, template overrides do not apply to alternative menu items.

As indicated above, menu item layouts take priority over component or category alternative layouts.

Translation of alternative menu items is done with the following tags in the XML files. The format is "TPL_"<template name>_<component>_<view>_<menu item name>_<tag type>. For example, these lines below will translate the title, option, and description for an alternative menu item called "catmenuitem".

TPL_BEEZ5_COM_CONTENT_CATEGORY_VIEW_CATMENUITEM_TITLE="Beez5 Custom Category Layout"

TPL_BEEZ5_COM_CONTENT_CATEGORY_VIEW_CATMENUITEM_OPTION="Beez5 Custom"

TPL_BEEZ5_COM_CONTENT_CATEGORY_VIEW_CATMENUITEM_DESC="Description for beez5 custom category layout."

These strings have to be added to language/en-GB/en-GB.tpl_beez5.sys.ini

The catmenuitem.xml would start with:

<?xml version="1.0" encoding="utf-8"?>
<metadata>
   <layout title="TPL_BEEZ5_COM_CONTENT_CATEGORY_VIEW_CATMENUITEM_TITLE" option="TPL_BEEZ5_COM_CONTENT_CATEGORY_VIEW_CATMENUITEM_OPTION">
      <help
         key = "JHELP_MENUS_MENU_ITEM_ARTICLE_SINGLE_ARTICLE"
      />
      <message>
         <![CDATA[TPL_BEEZ5_COM_CONTENT_CATEGORY_VIEW_CATMENUITEM_DESC]]>
      </message>
   </layout>

Controlling the Template for Alternative Menu Items

As discussed above, the presence of an XML file makes an alternative layout a menu item. The format of the XML file is the same as the format for core menu item XML files. With this XML file, you can add the parameters you wish to include for this menu item. They can be the same as one of the core menu items, or you can omit core parameters or add new ones. Note that if you add new parameters, these can be used in the layout file but will not be used in the core model or view files.

It is also possible to override parameter settings for core parameters. One example of this is to control which templates an alternative menu item layout can be displayed with. In some cases, you may want to allow a custom menu item to be displayed with any template for the site. In other cases, you may wish to limit that menu item's layout to one specific template. In this situation, you would just add the following parameter to the menu item's XML file:

<fields>
  <field
    name=''"template_style_id"''
    type=''"templatestyle"''
    label=''"COM_MENUS_ITEM_FIELD_TEMPLATE_LABEL"''
    description=''"COM_MENUS_ITEM_FIELD_TEMPLATE_DESC"''
    filter=''"int"''
    template=''"beez5"''
    class=''"inputbox"''>
  </field>
 </fields>

This will override the core "template_style_id" parameter. Setting the template equal to "beez5" in this case will limit the user to only selecting template styles for the "beez5" template.

Comment (2) Hits: 3888
  • Duplicate default.php in the category list template located at modules/mod_articles_category.  In Joomla 3.4.5, it is located one folder deeper at /modules/mod_articles_category/tmpl/.
  • Rename it whatever you would like.  I renamed mine inpagelinks.php.
  • Replace the contents with the code below and upload the new file to the same folder.
  • Go to your module in th module manager and change the template to the new one that you just created.

 

<?php
/**
 * @package Joomla.Site
 * @subpackage mod_articles_category
 * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license GNU General Public License version 2 or later; see LICENSE.txt
 */
 
// no direct access
defined('_JEXEC') or die;
?>
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
    <?php if ($grouped) : ?>
        <?php foreach ($list as $group_name => $group) : ?>
            <li>
                <h<?php echo $item_heading; ?>><?php echo $group_name; ?></h<?php echo $item_heading; ?>>
                <ul>
                    <?php foreach ($group as $item) : ?>
                        <li>
                            <h<?php echo $item_heading+1; ?>>
                                <?php if ($params->get('link_titles') == 1) : ?>
                                    <a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>">
                                        <?php echo $item->title; ?>
                                        <?php if ($item->displayHits) :?>
                                            <span class="mod-articles-category-hits">
           (<?php echo $item->displayHits; ?>)  </span>
                                        <?php endif; ?></a>
                                <?php else :?>
                                    <?php echo $item->title; ?>
                                    <?php if ($item->displayHits) :?>
                                        <span class="mod-articles-category-hits">
           (<?php echo $item->displayHits; ?>)  </span>
                                    <?php endif; ?></a>
                                <?php endif; ?>
                            </h<?php echo $item_heading+1; ?>>
 
 
                            <?php if ($params->get('show_author')) :?>
                                <span class="mod-articles-category-writtenby">
<?php echo $item->displayAuthorName; ?>
</span>
                            <?php endif;?>
 
                            <?php if ($item->displayCategoryTitle) :?>
                                <span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</span>
                            <?php endif; ?>
                            <?php if ($item->displayDate) : ?>
                                <span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
                            <?php endif; ?>
                            <?php if ($params->get('show_introtext')) :?>
                                <p class="mod-articles-category-introtext">
                                    <?php echo $item->displayIntrotext; ?>
                                </p>
                            <?php endif; ?>
 
                            <?php if ($params->get('show_readmore')) :?>
                                <p class="mod-articles-category-readmore">
                                    <a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>">
                                        <?php if ($item->params->get('access-view')== FALSE) :
                                            echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
                                        elseif ($readmore = $item->alternative_readmore) :
                                            echo $readmore;
                                            echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
                                            if ($params->get('show_readmore_title', 0) != 0) :
                                                echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
                                            endif;
                                        elseif ($params->get('show_readmore_title', 0) == 0) :
                                            echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
                                        else :
 
                                            echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
                                            echo JHtml::_('string.truncate', ($item->title), $params->get('readmore_limit'));
                                        endif; ?>
                                    </a>
                                </p>
                            <?php endif; ?>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </li>
        <?php endforeach; ?>
</ul>
 
<?php else : ?>
<p>
<form name="jump" class="center">
<select name="menu">
        <?php foreach ($list as $item) : ?>
 
                <h<?php echo $item_heading; ?>>
                    <?php if ($params->get('link_titles') == 1) : ?>
                    <option value="#<?php echo $item->title; ?>">
                            <?php echo $item->title; ?>
                            </option>
                    <?php else :?>
                        <?php echo $item->title; ?>
                        <?php if ($item->displayHits) :?>
                            <span class="mod-articles-category-hits">
            (<?php echo $item->displayHits; ?>)  </span>
                        <?php endif; ?></a>
                    <?php endif; ?>
                </h<?php echo $item_heading; ?>>
 
                <?php if ($params->get('show_author')) :?>
                    <span class="mod-articles-category-writtenby">
<?php echo $item->displayAuthorName; ?>
</span>
                <?php endif;?>
                <?php if ($item->displayCategoryTitle) :?>
                    <span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</span>
                <?php endif; ?>
                <?php if ($item->displayDate) : ?>
                    <span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
                <?php endif; ?>
                <?php if ($params->get('show_introtext')) :?>
                    <p class="mod-articles-category-introtext">
                        <?php echo $item->displayIntrotext; ?>
                    </p>
                <?php endif; ?>
 
                <?php if ($params->get('show_readmore')) :?>
                    <p class="mod-articles-category-readmore">
                        <a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>">
                            <?php if ($item->params->get('access-view')== FALSE) :
                                echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
                            elseif ($readmore = $item->alternative_readmore) :
                                echo $readmore;
                                echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
                            elseif ($params->get('show_readmore_title', 0) == 0) :
                                echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
                            else :
                                echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
                                echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
                            endif; ?>
                        </a>
                    </p>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </select>
        <input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
    </form>
</p>
    <?php endif; ?>
</ul>
 
Comment (0) Hits: 6573
<?php if ($_GET["option"]=="com_jomres[for example]") 
{ ?>
[add code here]
<? } ?>

Comment (0) Hits: 3609

Below is a comparison of some of the more popular reservation & booking extensions for Joomla

Comment (0) Hits: 2694
You need to declare the variable you're going to use... $user = JFactory::getUser(); Then, to echo it... echo 'User name: ' . $user->username; Other variables... Name: $user->name ID: $user->id
Comment (0) Hits: 2721
X