A Slice of Life

commentary on issues in politics, culture, environment and technology

08 Nov 09 How To Change Weblink Sort Order in Joomla

Image via Wikipedia

I’ve been adding new links to the weblinks section of my Joomla installation (Sliced Wikizine)for some time now and have managed to build quite a nice collection of very cool Web 2.0 type links in a range of categories (including: Animation Blogging Code Graphics Web Design Social Media Multimedia Writing and Online Tools )

One thing that always bothered me was that the new links I added always displayed last on the list of links. Of course, links can be manually reordered using the admin backend but I couldn’t help thinking there had to be an easier way.

Of course there is…

To change the sort order of weblinks, you need to edit one file in your Joomla installation. Go to: yoursite/joomla_folder/components/com_weblinks/models/category.php

Edit the file ‘category.php’ (It’s a good idea to download a backup copy of the file first, just in case…). Use notepad or another text editor to edit the file. Code editor in cpanel works just fine.

Between lines 224 and 231 you’ll find this statement:

$query = ‘SELECT *’ .
‘ FROM #__weblinks’ .
‘ WHERE catid = ‘. (int) $this->_id.
‘ AND published = 1’ .
‘ AND archived = 0’.
‘ ORDER BY ‘. $filter_order .’ ‘. $filter_order_dir .’, ordering’;
return $query;

Make this change on line 229:

$query = ‘SELECT *’ .
‘ FROM #__weblinks’ .
‘ WHERE catid = ‘. (int) $this->_id.
‘ AND published = 1’ .
‘ AND archived = 0′.
//’ ORDER BY ‘. $filter_order .’ ‘. $filter_order_dir .’, ordering’;
‘ ORDER BY date DESC’;
return $query;

What we have done is commented out the line //’ ORDER BY ‘. $filter_order .’ ‘. $filter_order_dir .’, ordering’; to make it inactive. All links will now be sorted by date in descending order (most recent first).

Other sort options can be created by using these fields: url, title, description, date, hits.

For example, you could sort all weblinks alphabetically by title by changing the statement which now appears on line 230 to:

‘ ORDER BY title ASC’;

Reblog this post [with Zemanta]

Tags: , , , , , , , , , , , ,

11 May 09 Joomla: to CMS or not to CMS

sliced_logoRecently I started using the Joomla CMS. If you’re not familiar with the abbreviation ‘CMS’ it stands for ‘content management system’. You can sample my Joomla site here:  http://www.sliced.liamalexander.com/  There are a number of these available and many, like Joomla are free. Joomla appears to be among the most popular and successful. Joomla allows you to create a website using a user friendly admin interface. It requires little technical knowledge once it’s installed (installation isn’t difficult either) as tasks can all be carried out via menu commands. Creating multi level drop down menus, multiple linked pages, displaying newsfeeds, polls, links, multiple user management and permissions, advertising and of course articles are done with a simple click. Due to Joomla’s great popularity, the Joomla community forums are very lively and an excellent resource for help.

I have for many years grappled with the problems of creating websites from scratch with html, css and a range of scripts to extend functionality. I have been aware of systems like Joomla for a long time but have resisted using one until now. I firmly believe that building a website from scratch is the best (and only) way to learn web design. If you are just modifying someone else’s template you’re not really designing; just tweaking. Designing from scratch also allows you complete control over the design and functionality of your pages.


Tags: , , , ,