News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Childboards as Dropdown

Started by Matthew K., March 12, 2009, 01:04:02 PM

Previous topic - Next topic

Rumbaar

Where you download the mod from Manual Install Instructions for SMF then select your version of SMF and it gives you the code changes.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

haito

nice mod... thanks rumbaar... i like it~
www.japanesia.co.id | Portal Berita & Komunitas Untuk Kamu yang Suka Jepang

kingkingston

#22
yes i am using the babylon theme

Rumbaar

Quote from: kingkingston on March 12, 2009, 06:02:02 PM1. Execute Modification ./Themes/default/BoardIndex.template.php Test failed
I see that now, it's best to be upfront with the details so it makes it easier for people to give the correct assistance.  The error message you originally displayed the issue with the default CORE theme.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Garry1953

Great mod (my site smf 2.0 RC1)
Thanks. :)

Rumbaar

You're welcome.

I'm looking to expand on this and have the ability turn on/off child display options.   So can choose to have it display as a list or dropdown menu at the category level.  Got it working for 1.1, just need to look at 2.0.

Might even work on at the MessageIndex level as well.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

heinandar

Hello Rumbaar

I want to dropdown child board . But Not for all Category. Can u do that ?

Rumbaar

@heinandar is that question in response to my last post or you didn't read it?  But that is what I've got working in 1.1 so far.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

SgtMic

Is there a way to give it some sort of "New" post indicator? Other than the one for the parent board.
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Rumbaar

I'm not sure if I can bold the entries, I'll have to test that for a dropdown menu array.   But I'll be able to add additional textual information.

What would you think would be a good indicator, maybe an asterisk? *
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

SgtMic

That would work. Something simple.
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Rumbaar

I'll update the package, but for those that have installed it and don't want to uninstall/install/update

1.1
Find:
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , '</option>';

Replace:
if ($child['new'])
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , ' (' , $txt[302] , ')</option>';
else
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , '</option>';


2.0
Find:
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , ' (!)</option>';
else
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , '</option>';

Replace:
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']) && $child['new'])
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , ' (' , $txt['new'] , ') (!)</option>';
elseif ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , ' (!)</option>';
elseif ($child['new'])
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , ' (' , $txt['new'] , ')</option>';
else
echo '
<option value="?board=', $child['id'], '.0">' , $child['name'] , '</option>';


It should now display the (New) indicator next to any child boards that have new posts.  It will be in the set language of the users as well.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

SgtMic

That worked great.

Now, how to colorize the word "new" or use an image?
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Rumbaar

There you run into limitations to the coding you can apply to a select/option element.  Without, I'm sure, fancy javascript or if even possible in pure html/css environment.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

SgtMic

There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Rumbaar

Never hurts, and I haven't ruled it out.  But in my initial testing and trials couldn't see a viable option.

I'll try for version 1.2, when I hopefully add the ability to turn it on/off based on Category setting.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

PalmBeachPreps

QuoteExecute Modification     ./Themes/default/BoardIndex.template.php     Test failed

Damn, damn, damn!  do i have to attempt this manually now?

Rumbaar

"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Groundhog

#38
Hi Rumbaar

Great little mod. Thanks very much for this.

However, I am using child boards within child boards (MessageIndex.template.php). I have tried to figure out what to change and tried a few things but have been unsuccessful.

Is there any chance that you can provide a bit of code for the 'MessageIndex.template.php' here also for me to manually paste in please? so that the drop down list also appears for these child boards? I'm amusing that is where it has to go?

That would be so helpful if possible.

Many Thanks

Antechinus

Quote from: SgtMic on March 13, 2009, 12:51:14 AM
Anyway to change the background color?
Other than the white (for me), it's a great mod.

Quote from: Rumbaar on March 13, 2009, 12:55:37 AM@SgtMic You can edit the class value to match whatever you're using for your current custom template.  The first <td colspan="3" class="windowbg' values should control that.
Not quite. What he'd actually have to do is assign a class to the select for that td so he could style it to suit. Something like:

<select class="child_drops" name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 &amp;&amp; this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
<option value="">' . $txt['select_destination'] . '</option>';


And in the style.css something like:

select .child_drops
{
    background: #000000;
    color: #FFFFFF;
}


Also just curious, but wouldn't giving the select an id lead to duplicate id validation errors when you had more than one board with child boards? I would have thought they'd be better called as a class, but I may be wrong about this.

Advertisement: