Welcome to Geeklog, Anonymous Thursday, April 25 2024 @ 05:45 am EDT

Geeklog Forums

is there anyway to sort stories alpahbetically within their topic?


Timmy

Anonymous
hey everyone,
is there anyway to sort stories alpahbetically within their topic?

thanks

-Tim
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Not sure if this is what you want, but to sort all of your stories by name on the frontpage as well as in the topics, in your index.php file change

Text Formatted Code
$sql .= "ORDER BY featured DESC, date DESC";
 


to

Text Formatted Code
$sql .= "ORDER BY featured DESC, title ASC";
 


If you want it to behave differently for frontpage and topics, it should be a simple
Text Formatted Code
if (!empty($topic)) {
 


check, making the final code:

Text Formatted Code
if (!empty($topic)) {
    $sql .= "ORDER BY featured DESC, title ASC";
}
else {
    $sql .= "ORDER BY featured DESC, date DESC";
}

 
 Quote

timmy

Anonymous
I want the latter...

so I replace

"if (!empty($topic)) {"


with

"if (!empty($topic)) {
$sql .= "ORDER BY featured DESC, title ASC";
}
else {
$sql .= "ORDER BY featured DESC, date DESC";
}"

yeah?

thanks for your help! Smile
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
No! Replace the sql .= ORDER BY line with the final block of code, above. Smile
 Quote

Timmy

Anonymous
ah ha, the reason I asked is because it didn't quite look right, thanks so much!

xx
 Quote

All times are EDT. The time is now 05:45 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content