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

Main Menu

Move the "[New]" icon to the beginning of the child-board's name

Started by Wellwisher, August 17, 2020, 07:32:16 PM

Previous topic - Next topic


I am trying to move the "[New]" icon (written in text form) to the beginning of the child-boards name.

i.e: "[NEW] Childboard_Name"

Rather than:
"[/b] Childboard_Name [NEW]"

Below is the code that requires editing:

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

The above code outputs a list of child-boards within a board and it looks like this:

I attempted to play with it a bunch of times and failed, any help would be much appreciated?  :)


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


Quote from: Arantor on August 17, 2020, 07:47:56 PM

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

That worked Arantor! Thank you very much for the freebie lad ;D :D 8).

Comparing your code with the one I had, I wasn't going to win this puzzle lol. ;D It's the "php grammar" - those php comma's! Pfft. Also the pattern of PHP sentences alluded me a fair bit. Anywhoo, I learn't a bit more php comparing your code to the one I had.

Just leaving this post as a ref for myself:

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

The PHP pattern is like:
echo "<PHP_statement_1, PHP_statement_2, PHP_statement_3 etc

Cheers matey  :laugh: