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: , , , ,

10 Jan 09 WordPress upgrade: comments feed not working

rss_iconI recently updated my WordPress installation to 2.7 using fantastico in cpanel.  If you have cpanel installed with your webhost, just go to fantastico and it should give you a message telling you your version of WordPress is out of date.  There is an automatic update link which will install the new version in a matter of moments.  Before you do; it is a good idea to make a back up of your WordPress database (phpMyadmin makes this easy; just use the ‘export’ option and choose zip to save a backup).  It’s also suggested you save a copy of your scripts folder (this is in wp-includes/js), just download it incase a problem occurs.  If you have customised any of the files in WordPress it’s also a good idea to make copies of them too.  (in fact, the upgrade did not overwrite the scripts I had customised). 

I didn’t have any problems; the automatic upgrade went smoothly and I am now enjoying all the benefits of the new and improved WordPress admin page.  It allows a great deal more flexibility on what is displayed and how, making it a great deal easier to get to the functions you need quickly and easily.

The only problem I discovered was the comments feed had stopped working.  The following error was displayed in IE7:

This feed contains code errors.
Go back to the previous page.

More information

A semi colon character was expected.
Line: 18 Character: 45

It seems a number of people are having the same problem, with some suggesting that downgrading to the previous version of WordPress is the solution.  This seems a pretty lame solution; apart from the improved admin panel the new version also provides enhanced security features.  After browsing the WordPress.org support forums I found the answer on this page  All that was required was to download this replacement file  and upload to the wp-includes folder.  Problem solved!  Thanks very much to Otto42 for providing the replacement file.

Tags: , , , , , , , , ,

02 Jan 09 Boost traffic exponentially with zfeeder

rss iconI commented to friend recently that calling visitors to websites ‘traffic’ sounds a bit impersonal; kind of like ‘cattle’.  Still, everyone who runs a website or blog knows what traffic means and of course, can never get enough.  For some time now, I’ve been using the free zfeeder script to display newsfeeds on my website.  Hits on my newsfeeds section for December 2008 alone numbered 27,425.  Not only does displaying feeds via rss provide you with frequently updated and interesting content, search engines love them.  You can also use this script to send rss content to any php page on your site. 

For example, I send the feed from my blog, image gallery, forum etc. to the home page of my site at http://www.liamalexander.com .  I have seen other scripts which display feeds but these usually use javascript; images in feeds are not displayed and as javascript works locally do not attract search engines.  zfeeder is the only FREE script that provides these functions that I’ve come across.  It is very powerful, easy to install, requires no database and comes with an easy to use online admin panel.

:arrow: All the templates I use with zfeeder are available free here

:arrow: Just unzip and upload to the categories folder in your zfeeder newsfeeds directory on your server.  I have included a range of customisations to these templates, including audio podcast, vodcast (video feeds), an rss and opml directory and support for talkr (rss text to voice).  Feel free to use them as you will; links back to my site are appreciated. (http://www.liamalexander.com)

:arrow: Using zfeeder, one simple php page can display 100s of generated pages; you just call the script with your links: e.g. http://www.liamalexander.com/news/?zfcategory=opinion  All you need to do to make a zfeeder enabled page is save it with the file extension .php.  A simple line of code is all that is needed to include feeds.  Additional options can be included such as which template to use, category, channels etc.

:arrow: Download zfeeder and read the documentation and installation instructions here

:arrow: See zfeeder in action on my site here

:arrow: Don’t have php available on your site or blog?  Get my easy newsfeed embed code here

:arrow: Just want to submit your feed to my directory and get some backward links?  Click here

I highly recommend this program; give this brilliant SEO tool a try today.

Tags: , , , , , ,

08 Dec 08 The Joy of X(ML)

For some time now I’ve been using zfeeder to display rss/xml feeds on my webpages.  zfeeder is a great free program that runs on a web server.  It does not require a database and comes with an easy to use admin panel.  You just copy/paste feed urls and it adds them to a given category, which you can create links to.  Using this program, one php page can display hundreds of pages, based on a call to the zfeeder php script.  (For example:  http://www.liamalexander.com/news/?zfcategory=opinion ).  You can modify the templates and I’ve included a range of different elements such as flash based media players.  (This example uses the grazr audio widget). You only need to create the template once and the pages will display as many feed items as you specify in your config.  In this way you can provide huge amounts of automatically generated content which updates frequently and attracts search engine attention.  There is documentation and installation instructions on the zfeeder site.  I’ve also made an example which can be embedded into any web page/blog here.  Click on the embed newsfeeds tab to get the code and add to your site.

One problem I’ve had is that feeds I’ve included from my own blogs often display on my php pages with strange charatcters.  I’ve tried all sorts of things to fix this, and have even taken to changeing all the apostrophes in posts to quotation marks to avoid the garbled characters.  Recently, I found the solution and was surprised at how simple it is.

I recently installed a self hosted WordPress blog and have had fun exploring its features.  I noticed that you can change the charset of rss feeds in settings.  By default, the charset is set to UTF-8 (8-bit UCS/Unicode Transformation Format).  My php pages (created with MS Frontpage) are encoded as charset=windows-1252 by default.  All that was needed was to change this to charset=UTF-8 and all the feeds display perfectly.

I feel like a real idiot for not making this realisation sooner.  As is usually the case with computer problems (or problems in general for that matter), the simplest solution is the best.  That’s called ‘Ockham’s Razor‘ if I’m not mistaken.  Hey!  I can now use apostrophes and ampersands with impunity so: ‘ ‘ && ‘ ‘

Tags: , , , , , , , ,