Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4267
Latest: ramiroelliot
New This Month: 2
New This Week: 0
New Today: 0
Stats
Total Posts: 43544
Total Topics: 7565
Most Online Today: 70
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 51
Total: 51

Author Topic: Not ordering images correctly if numbers present in image title.  (Read 5754 times)

0 Members and 1 Guest are viewing this topic.

Offline Menard9

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • Posts: 12
    • View Profile
Check this out.

http://zombiedeathhouse.com/horrorforum/index.php?action=gallery;cat=19

I always set it up to order them by 'title, ascending' and this is what I get.  It gives me exactly the same problem in reverse if you try to order by 'title, descending'.  It has always done this, even with my main, really large gallery; I just didn't get around to asking about it until now.

And yes, I have upgraded and it went flawlessly.  :)

Any ideas?
« Last Edit: October 30, 2008, 10:25:56 pm by Menard9 »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16563
    • View Profile
Re: Not ordering images correctly if numbers present in image title.
« Reply #1 on: November 04, 2008, 08:26:08 pm »

This is a little tricky you can try this and sees if it works.

For SMF 1.1.x

Open Gallery.template.php
Find
Code: [Select]
WHERE  p.ID_CAT = $cat AND p.approved = 1 ORDER BY $sortby $orderby
Change to
Code: [Select]
WHERE  p.ID_CAT = $cat AND p.approved = 1 ORDER BY $sortby $orderby   , LENGTH(p.title) DESC
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Menard9

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • Posts: 12
    • View Profile
Re: Not ordering images correctly if numbers present in image title.
« Reply #2 on: February 06, 2009, 02:39:46 am »
Okay, sorry for the late reply.  I tried this, but to no avail.  I went into FTP, DL'd the php doc., opened and edited it using 'Find Next' in Note Pad, saved and FTP'd it back and noticed no change at all.  Attached, you'll find the altered gallery.template.php doc you had me change as indicated above.

I did this just tonight, a few days after the latest upgrade, which went smoothly.  Any other guesses as to how to get things to ascend/descend correctly with numbers in the image title?

Offline willerby

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • Posts: 29
    • View Profile
Re: Not ordering images correctly if numbers present in image title.
« Reply #3 on: February 06, 2009, 03:32:41 am »
I had this problem too as had set default to order by Title Ascending where the title was a vehicle year and chassis number. The issue is because the Title is text and not a numerical value so any code fix would need to convert the text to a number with some sort of 'Value' command (sorry don't know what that would be in php). But it wouldn't work in your case as you have text in there too.

Anyway to fix in your gallery, just rename the fields with suffix numbers 1-9 as suffixes 01-09 (the text sort just looks at the next text character and the characters 11 come before 2 but not before 02)

Thats how I fixed it

Offline Menard9

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • Posts: 12
    • View Profile
Re: Not ordering images correctly if numbers present in image title.
« Reply #4 on: February 06, 2009, 01:01:52 pm »
Clever man!  It worked wonderfully.  Needless to say, after I read your suggestion I felt like a complete dunce.  I numbered with 001, 002, 003...etc.  That ought to keep me good through the first 999.   :)

 

Related Topics

  Subject / Started by Replies Last post
5 Replies
6798 Views
Last post September 24, 2007, 05:10:38 am
by Scy
2 Replies
6394 Views
Last post October 15, 2007, 10:00:33 pm
by ApplianceJunk
0 Replies
4585 Views
Last post December 02, 2007, 07:46:28 pm
by Lil Puppy
5 Replies
4457 Views
Last post June 09, 2012, 03:28:59 pm
by Michel68
3 Replies
4362 Views
Last post September 05, 2014, 01:20:49 pm
by SMFHacks

+- Recent Topics

Move picture from main gallery to user gallery by Lirorobert
Today at 03:08:26 pm

Gallery Pro reinstalation by Lirorobert
Today at 03:04:50 pm

quoting part of message by Lirorobert
October 04, 2024, 03:21:40 pm

Does SMF Gallery support by SMFHacks
October 02, 2024, 06:14:26 am

Restoring a deleted photo by Monocero
September 28, 2024, 04:12:20 am

Item count on Gallery Tab shows double by SMFHacks
September 26, 2024, 12:59:20 pm

Forum post missing when image over 4000x pixels is uploaded to gallery by Michel68
September 24, 2024, 01:37:17 pm

Setting a photo as invisible by Monocero
September 17, 2024, 02:11:56 pm

Two gallery names by SMFHacks
September 15, 2024, 02:17:49 pm

Bar during the regeneration of miniatures by Monocero
September 15, 2024, 12:35:08 pm

Powered by EzPortal