Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4260
Latest: Verrick
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 43319
Total Topics: 7526
Most Online Today: 236
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 231
Total: 231

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

0 Members and 1 Guest are viewing this topic.

Offline Menard9

  • 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: 16463
    • 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

  • 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

  • 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

  • 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
6709 Views
Last post September 24, 2007, 05:10:38 am
by Scy
2 Replies
6323 Views
Last post October 15, 2007, 10:00:33 pm
by ApplianceJunk
0 Replies
4462 Views
Last post December 02, 2007, 07:46:28 pm
by Lil Puppy
5 Replies
4345 Views
Last post June 09, 2012, 03:28:59 pm
by Michel68
3 Replies
4276 Views
Last post September 05, 2014, 01:20:49 pm
by SMFHacks

+- Recent Topics

Attachment images Upsidedown or Sideways by SMFHacks
June 18, 2024, 10:53:24 am

JSON decode error: The maximum stack depth has been exceeded by SMFHacks
June 14, 2024, 10:15:16 pm

“Insert from Gallery” by donk
June 10, 2024, 01:26:57 pm

Pretty Urls extras by SMFHacks
May 13, 2024, 10:28:54 am

Mod question by Verrick
May 11, 2024, 02:42:50 pm

i have paid but cant download ad pro. by SMFHacks
May 02, 2024, 11:29:38 pm

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Powered by EzPortal