forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Visuals => Topic started by: jeepguy_1980 on March 23, 2009, 04:49:00 am
-
I wanted to make it so that the menu would automatically display the sorting order being used. However, that was a bit over my head. So here is my mod as it exists now.
This mod will replace the sort order menu with a drop down menu. I designed it for the themes where the sort order menu runs past the table detracting from the otherwise nice theme.
i.e. changes from Attachment1 to Attachment2 and Attachment 3
To make this change, open theme.php
Find the following function:
$template_thumb_view_title_row = <<<EOT
Replace the entire function with the following:
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row)) { //{THEMES}
$template_thumb_view_title_row = <<<EOT
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif" width="1" alt="" /></td>
<td class="sortorder_cell">
<form name="sort">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pd">{POSITION} -</option>
</select>
</form>
</td>
</tr>
</table>
EOT;
} //{THEMES}
Depending on your theme, you may need to adjust your theme's style.css ".sortorder_cell" padding to make it line up better.
-
Hi jeepguy_1980 ,
Thank for the nice mod, but for me the mod seems dont work on my theme ;( the box appear but doesn't change the sort order.
I copy and paste the function from yr post in my theme:
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row)) { //{THEMES}
$template_thumb_view_title_row = <<<EOT
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif" width="1" alt="" /></td>
<td class="sortorder_cell">
<form name="sort">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pd">{POSITION} -</option>
</select>
</form>
</td>
</tr>
</table>
EOT;
} //{THEMES}
My theme.php is attached if u can have a look.
Here is the gallery link:
CPG Version :1.4.24
www.abroadbg.com
username: test
password:123654
-
Find the following function:
$template_thumb_view_title_row = <<<EOT
That's not a function, but merely a variable getting populated.
Replace the entire function with the following:
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row)) { //{THEMES}
$template_thumb_view_title_row = <<<EOT
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif" width="1" alt="" /></td>
<td class="sortorder_cell">
<form name="sort">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pd">{POSITION} -</option>
</select>
</form>
</td>
</tr>
</table>
EOT;
} //{THEMES}
No, don't do that - that's silly. Actually, the instructions need to be as following:
Edit themes/yourtheme/theme.php with a plain text editor. Find $template_thumb_view_title_row = <<<EOT
and edit as suggested below. If that section doesn't exist in your custom theme, copy // HTML template for title row of the thumbnail view (album title + sort options)
$template_thumb_view_title_row = <<<EOT
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif" width="1" alt="" /></td>
<td class="sortorder_cell">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="sortorder_options">{TITLE}</td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=ta" title="{SORT_TA}"> + </a></span></td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=td" title="{SORT_TD}"> - </a></span></td>
</tr>
<tr>
<td class="sortorder_options">{NAME}</td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=na" title="{SORT_NA}"> + </a></span></td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=nd" title="{SORT_ND}"> - </a></span></td>
</tr>
<tr>
<td class="sortorder_options">{DATE}</td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=da" title="{SORT_DA}"> + </a></span></td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=dd" title="{SORT_DD}"> - </a></span></td>
</tr>
<tr>
<td class="sortorder_options">{POSITION}</td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=pa" title="{SORT_PA}"> + </a></span></td>
<td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=pd" title="{SORT_PD}"> - </a></span></td>
</tr>
</table>
</td>
</tr>
</table>
EOT;
from themes/sample/theme.php into a new line before?>
of the file themes/yourtheme/theme.php
Then replace your definition of $template_thumb_view_title_row with the following code:$template_thumb_view_title_row = <<<EOT
<form name="sort" action="{$_SERVER['REQUEST_URI']}" method="get">
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td width="100%" class="statlink">
<h2>{ALBUM_NAME}</h2>
</td>
<td>
<img src="images/spacer.gif" width="1" alt="" />
</td>
<td class="sortorder_cell">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&page={PAGE}&sort=pd">{POSITION} -</option>
</select>
</td>
</tr>
</table>
</form>
EOT;
@jeepguy_1980: never copy stuff from include/themes.inc.php! Always copy stuff from themes/sample/theme.php instead!
-
Joachim Müller
Don't understand what im doing wrong, nothing don't change after yr instructions. I did all u wrote in yr last post ???
I attached again my theme.php
-
I have no idea what you're talking about: your site looks exactly as advertized for me (see attached screenshot). Make sure that you're not looking at a cached copy. Force-refresh your browser with [Ctrl]+[F5].
-
I have no idea what you're talking about: your site looks exactly as advertized for me (see attached screenshot). Make sure that you're not looking at a cached copy. Force-refresh your browser with [Ctrl]+[F5].
I mean users and me can't change anymore the sort order from the
/thumbnails.php?album=xxx list.
your site looks exactly as advertized for me
What u mean GauGau, i don't understand u ???