Weblinks - Cannot Sort Links to Display Correctly on the Front- End

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
redders47
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Mon Aug 08, 2011 6:16 am
Location: Melbourne, Australia

Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by redders47 » Wed Jun 16, 2021 11:24 am

I am trying to use Weblinks to display documents that are linked to my site as a sort of library for users to access. The documents are stored in Google Drive although I do not see why that would be relevant here.

A front-end example is here using Protostar as the template.

https://victoriasforestryheritage.org.a ... etins.html

The result is exactly the same if I use my normal custom Gantry 5 template that you will see on the rest of the site.

The screenshot shows the arrangement of links for this category in the back end. This arrangement simply does not transfer to the front-end display and I have tried many times to get this to work.
FCV Bulletins.jpg
Is there a bug here, am I asking Joomla to do something it cannot, or I have I done something wrong?

I am used to sorting articles for example, in blog format, to get the desired order without any issues. Nothing I have done here works.
You do not have the required permissions to view the files attached to this post.
Last edited by imanickam on Thu Jun 17, 2021 5:28 am, edited 1 time in total.
Reason: Moved topic » from General Questions/New to Joomla! 3.x to Extensions for Joomla! 3.x

illovo
Joomla! Intern
Joomla! Intern
Posts: 83
Joined: Sun Jan 13, 2013 9:30 am
Contact:

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by illovo » Wed Jun 16, 2021 6:34 pm

The weblinks component has no setting for ordering the frontend output. You could use a module and embed it in an article.

gsmela
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 167
Joined: Thu Jun 10, 2010 12:38 pm
Contact:

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by gsmela » Thu Jun 17, 2021 12:50 am

illovo wrote:
Wed Jun 16, 2021 6:34 pm
The weblinks component has no setting for ordering the frontend output. You could use a module and embed it in an article.
That doesn't sound right. I'm doing exactly what redders47 wants to do. Perhaps a cache issue? I've got weblinks sorted by date.

redders47
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Mon Aug 08, 2011 6:16 am
Location: Melbourne, Australia

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by redders47 » Thu Jun 17, 2021 4:23 am

Thank you to all for the advice.

I have cleared caches and still have the issue. For now I am working on the basis that Weblinks "has no setting for ordering on the front end."

There is a free module here:
https://www.joomball.com/extensiones/jbweblinks
that provides the capability to sort by ascending or descending alphabetical - I tried it quickly and it might do what I need.

I think the other option is a template override - but although I have examined the weblinks files available via my template I do not understand PHP and can therefore not find if and how I might override the default setting. Any help on this option would be appreciated.

illovo
Joomla! Intern
Joomla! Intern
Posts: 83
Joined: Sun Jan 13, 2013 9:30 am
Contact:

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by illovo » Thu Jun 17, 2021 11:22 am

gsmela wrote:
Thu Jun 17, 2021 12:50 am
That doesn't sound right. I'm doing exactly what redders47 wants to do. Perhaps a cache issue? I've got weblinks sorted by date.
Tell us please where the relevant setting is to find in the backend.

gsmela
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 167
Joined: Thu Jun 10, 2010 12:38 pm
Contact:

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by gsmela » Thu Jun 17, 2021 11:36 am

My apologies! I was posting from memory but on my site I am using the double-headed arrow to sort and manually ordering the links by date which works.

illovo
Joomla! Intern
Joomla! Intern
Posts: 83
Joined: Sun Jan 13, 2013 9:30 am
Contact:

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by illovo » Thu Jun 17, 2021 11:54 am

redders47 wrote:
Thu Jun 17, 2021 4:23 am
I think the other option is a template override - but although I have examined the weblinks files available via my template I do not understand PHP and can therefore not find if and how I might override the default setting. Any help on this option would be appreciated.
For Joomla versions >= 3.9.0.

I just can talk about the core. In an override file /templates/YOURTEMPLATE/html/com_weblinks/category/default_items.php add this code after line

Code: Select all

defined('_JEXEC') or die;
if you want to order ascending

Code: Select all

if (!empty($this->items))
{
 $this->items = Joomla\Utilities\ArrayHelper::sortObjects($this->items, 'ordering', 1);
}

if you want to order descending (see the -1)

Code: Select all

if (!empty($this->items))
{
 $this->items = Joomla\Utilities\ArrayHelper::sortObjects($this->items, 'ordering', -1);
}
Instead of 'ordering' one can use other properties like
'created'
'modified'
'title'
and other more or less useful properties of the objects (= items).

redders47
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Mon Aug 08, 2011 6:16 am
Location: Melbourne, Australia

Re: Weblinks - Cannot Sort Links to Display Correctly on the Front- End

Post by redders47 » Fri Jun 18, 2021 2:32 am

Thank you for your help. I got that to work okay.

The issue that remains is in the pagination.

When "all" are displayed the order is fine.

When a page limit is defined then the order in the "page" is right, but the page order is backwards.

https://victoriasforestryheritage.com/r ... brary.html

I looked for a css fix but I am stumped. Is there a way to make current first page the last etc.

Hope this makes sense.


Post Reply

Return to “Extensions for Joomla! 3.x”