Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4263
Latest: Cekky
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 43455
Total Topics: 7557
Most Online Today: 60
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 38
Total: 38

Author Topic: Add Category Sort By - How to change?  (Read 3897 times)

0 Members and 1 Guest are viewing this topic.

Offline The Wizard

  • Member
  • *
  • Posts: 17
    • View Profile
Add Category Sort By - How to change?
« on: December 04, 2012, 09:11:24 am »
Hello:

When adding a category, and you come to the Sort By select box the default option is "Date". Is there a quick way to change the code to make "Title" the default? You might want to think about adding this as a option in the admin settings. The reason I want to set the default to title is that all my images are by number and I want them to show up this way.

Thanks

Wiz

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16524
    • View Profile
Re: Add Category Sort By - How to change?
« Reply #1 on: December 04, 2012, 10:43:58 am »
You would need to modify the themes/default/gallery.template.php and search for the addcategory function and in there make the date option in the html set to selected="selected"
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 The Wizard

  • Member
  • *
  • Posts: 17
    • View Profile
Re: Add Category Sort By - How to change?
« Reply #2 on: December 04, 2012, 12:26:00 pm »
Hello:

I think I found the right code -

Code: [Select]
foreach ($context['gallery_cat'] as $i => $category)

echo '<option value="' . $category['id_cat']  . '" ' . (($parent == $category['id_cat']) ? ' selected="selected"' : '') .'>' . $category['title'] . '</option>';

So how would I change it correctly?

Wiz



   

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16524
    • View Profile
Re: Add Category Sort By - How to change?
« Reply #3 on: December 05, 2012, 03:36:05 pm »
Not the right code

It would be this code on the addcategory page if you want something selected by default when adding a categoyr

Around line 498 in themes/defaut/gallery2.template.php
Code: [Select]
<tr>
<td width="28%" class="windowbg2" align="right"><span class="gen"><b>' .   $txt['gallery_txt_sortby']  . '</b>&nbsp;</span></td>
<td width="72%" class="windowbg2"><select name="sortby">
<option value="date">',$txt['gallery_txt_sort_date'],'</option>
<option value="title">',$txt['gallery_txt_sort_title'],'</option>
<option value="mostview">',$txt['gallery_txt_sort_mostviewed'],'</option>
<option value="mostcom">',$txt['gallery_txt_sort_mostcomments'],'</option>
<option value="mostrated">',$txt['gallery_txt_sort_mostrated'],'</option>
</select>
</td>
</tr>
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 The Wizard

  • Member
  • *
  • Posts: 17
    • View Profile
Re: Add Category Sort By - How to change?
« Reply #4 on: December 06, 2012, 08:43:58 am »
Hello:

This is what I was looking for and thought the "selected=select" was a little odd.

I have gotten this to work (see below), but I hit a odd problem - If I add another exact line
Code: [Select]
<option value="title">',$txt['gallery_txt_sort_title'],'</option> everything works - but if I take out the second
Code: [Select]
<option value="title">',$txt['gallery_txt_sort_title'],'</option> I get a nasty error something about line one. Also if I just try and switch the two lines I get the same error. Is this some kind of security? or does something else need to be change? - just wondering as I like a neat code.

Wiz


Code: [Select]
<tr>

<td width="28%" class="windowbg2" align="right"><span class="gen"><b>' .   $txt['gallery_txt_sortby']  . '</b>&nbsp;</span></td>

<td width="72%" class="windowbg2"><select name="sortby">

    <option value="title">',$txt['gallery_txt_sort_title'],'</option>

<option value="date">',$txt['gallery_txt_sort_date'],'</option>

<option value="title">',$txt['gallery_txt_sort_title'],'</option>

<option value="mostview">',$txt['gallery_txt_sort_mostviewed'],'</option>

<option value="mostcom">',$txt['gallery_txt_sort_mostcomments'],'</option>

<option value="mostrated">',$txt['gallery_txt_sort_mostrated'],'</option>

</select>

</td>

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16524
    • View Profile
Re: Add Category Sort By - How to change?
« Reply #5 on: December 06, 2012, 02:33:56 pm »
Well in that code you don't want to have two options with the same value that might cause issues so you would need to take out one of the lines.
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/

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
6767 Views
Last post November 11, 2006, 03:33:52 pm
by lotsawa
1 Replies
4117 Views
Last post December 10, 2006, 03:23:49 pm
by SMFHacks
1 Replies
3429 Views
Last post January 26, 2007, 09:32:13 pm
by SMFHacks
8 Replies
11674 Views
Last post October 01, 2011, 05:12:04 pm
by SMFHacks
1 Replies
4207 Views
Last post August 26, 2013, 11:09:46 pm
by SMFHacks

+- Recent Topics

[Mod]Tenor Posting Animated Gifs by SMFHacks
August 30, 2024, 04:04:26 pm

List of other errors after installing and trying to use by SMFHacks
August 27, 2024, 02:15:52 pm

Subject Error by SMFHacks
August 27, 2024, 02:15:46 pm

Store Not Logging Transactions or Sending Emails for Paid Items, Free Items Work by SMFHacks
August 27, 2024, 05:26:52 am

Don't Know How to Unhide Previously Hidden Items in Latest SMF Store 5.0 by Michael Vail
August 26, 2024, 11:38:33 pm

Undefined array key "session_var" and Undefined array key "session_id" Errors by SMFHacks
August 26, 2024, 11:10:54 pm

SMF Links Error by yamiacaveman
August 22, 2024, 06:21:53 pm

HTTP Error 500 by SMFHacks
August 20, 2024, 12:28:53 pm

Site upgrade to 2.1 by live627
August 18, 2024, 02:47:33 am

Uninstall issue and new licence no email by landyvlad
August 16, 2024, 08:05:48 am

Powered by EzPortal