Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 344
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 210
Total: 210

Author Topic: Add Category Sort By - How to change?  (Read 3818 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: 16452
    • 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: 16452
    • 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: 16452
    • 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
6674 Views
Last post November 11, 2006, 03:33:52 pm
by lotsawa
1 Replies
4010 Views
Last post December 10, 2006, 03:23:49 pm
by SMFHacks
1 Replies
3320 Views
Last post January 26, 2007, 09:32:13 pm
by SMFHacks
8 Replies
11339 Views
Last post October 01, 2011, 05:12:04 pm
by SMFHacks
1 Replies
4134 Views
Last post August 26, 2013, 11:09:46 pm
by SMFHacks

+- Recent Topics

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

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal