Advertisement:

Author Topic: Childboards as Dropdown  (Read 94808 times)

Offline shadav

  • Sr. Member
  • ****
  • Posts: 705
  • Gender: Female
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Childboards as Dropdown
« Reply #260 on: August 17, 2020, 08:18:10 PM »
@shadav

I am not sure how your down list looks but on mine, the "New" icon is replaced with an asterisk (*). So basically if my drop-down list has an asterisk next to a sub-board, then it means there's new posts in that board (As shown on the image attached).

I managed to figure out how to add "New" symbol as text by doing the following modification:

On your current theme, find code in boardindex.template.php

Code: [Select]

echo '<option value="', $key, '">', $value['name'], $value['new'] ? '&#42;' : '', '</option>';


Replace with:


Code: [Select]

echo '<option value="', $key, '">', $value['name'], $value['new'] ? ' [New]' : '', '</option>';



 8) 8) 8)

End result - see attached:

I can't get anything to show up on my site
but if you want the image to show, you could try replacing [New] with
Code: [Select]
<img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" />it should work, I would think....

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Childboards as Dropdown
« Reply #261 on: August 17, 2020, 08:40:53 PM »
Nope, can't put images inside dropdowns.

You *could* possibly do some really funky things with CSS and backgrounds on elements but it's not recommended as select elements are not consistently styleable across browsers.
No good deed goes unpunished
All helpful urges should be circumvented

Offline Wellwisher

  • Full Member
  • ***
  • Posts: 422
  • Gender: Male
Re: Childboards as Dropdown
« Reply #262 on: August 17, 2020, 09:29:08 PM »

Nope, can't put images inside dropdowns.


@Arantor that was my next thought tbh.  8) However, I already love the result thus far with your help:

Final result:



@shadav Tried that, nothing showed. Let me know if you managed to find a way of adding the image. Here's the code that Arantor kindly offered for pushing the "New" icon to the left (as seen in the picture):

Code: [Select]

echo '<option value="', $key, '">', $value['new'] ? ' [New]' : '', $value['name'], '</option>';


CSS is the way forward because you can target each "option" and because the board value is always different. You should be able to use css "content:before"

e.g:

Code: [Select]

option[value=two] {background-color: yellow;}

[/quote]
« Last Edit: August 17, 2020, 09:47:01 PM by Wellwisher »

Offline Wellwisher

  • Full Member
  • ***
  • Posts: 422
  • Gender: Male
Re: Childboards as Dropdown
« Reply #263 on: August 17, 2020, 10:44:42 PM »
Crap:

Adding images via CSS may be tricky too (check out my JSfiddle mock-up).  Where the "option value" is "Alphabetic" we can target the yellow background color with CSS. However, where the value is "numeric", we're NOT able to target it.

Since the SMF board ID's are "numeric values" it will be a problem using CSS to target it.

https://jsfiddle.net/f8qtrLbk/2/

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Childboards as Dropdown
« Reply #264 on: August 18, 2020, 04:14:31 AM »
Add a class to the options that are new, or data attributes. But rendering of images in selects in any form, whether it’s with before or background images is woefully inconsistent, or at least used to be so, haven’t looked f it’s now better (but given some other stuff I see, I suspect not)
No good deed goes unpunished
All helpful urges should be circumvented