Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4229
Latest: Ghost
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 43080
Total Topics: 7493
Most Online Today: 40
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 38
Total: 38

Author Topic: Not ordering images correctly if numbers present in image title.  (Read 4609 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: 16356
    • 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
5792 Views
Last post September 24, 2007, 05:10:38 am
by Scy
2 Replies
5452 Views
Last post October 15, 2007, 10:00:33 pm
by ApplianceJunk
0 Replies
3720 Views
Last post December 02, 2007, 07:46:28 pm
by Lil Puppy
5 Replies
3456 Views
Last post June 09, 2012, 03:28:59 pm
by Michel68
3 Replies
3372 Views
Last post September 05, 2014, 01:20:49 pm
by SMFHacks

+- Recent Topics

Version 6.1.6 issues by SMFHacks
September 30, 2023, 07:54:52 am

Follow / Follower Mod? by SMFHacks
September 23, 2023, 08:44:44 am

Looking for a good video player by replayuk
September 23, 2023, 12:17:39 am

[Mod]Discord Web Hooks by SMFHacks
September 22, 2023, 03:57:28 pm

SMF 2.1.4 Search by Anmer
September 22, 2023, 01:55:15 pm

Error in thise mode by Ghost
September 15, 2023, 08:42:24 am

Gallery Selection List Order by mickjav
September 07, 2023, 12:46:31 pm

[Mod]Tidy Child Boards 2.0 by Norwinjose
September 02, 2023, 11:42:54 am

PrettyUrls SEO Pro: Unable to submit sitemap to google search conmsole by SMFHacks
August 31, 2023, 10:55:22 am

PrettyURL - SEO4SMF Rewrites? by SMFHacks
August 28, 2023, 06:35:33 pm

Powered by EzPortal