Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Sir Osis of Liver on June 13, 2022, 11:04:47 PM

Title: Inherit $board['name']
Post by: Sir Osis of Liver on June 13, 2022, 11:04:47 PM
Trying to replace 'Child Boards' in child board title bar with $board['name'] from parent.  Not getting it.  >:(
Title: Re: Inherit $board['name']
Post by: Arantor on June 14, 2022, 03:04:52 AM
Where *exactly* are you trying to change this? What file, what line?
Title: Re: Inherit $board['name']
Post by: Sir Osis of Liver on June 14, 2022, 05:50:04 PM
This is for ebook-mecca.com, I think you may have been there.  On board index there are empty parent boards that contain child boards, each a different book category, and the children contain topics, one for each book.  Board index looks like this:

ebook_ss10.jpg

Click on Fiction and message index looks like this:

ebook_ss11.jpg 

The title "Child Boards" is meaningless, I'm trying to change it to "Fiction", and same for other children.

Title: Re: Inherit $board['name']
Post by: Arantor on June 14, 2022, 05:55:52 PM
You should be able to use $context['page_title'] in this case; it's filled in MessageIndex.php with the board's name.

Failing that, add $board_info to the list of globals in MessageIndex.template.php and use $board_info['name'].

$board['name'] is never guaranteed to be available everywhere, it's only normally available in the loop going over a list of boards at a given time, which is not what you're doing there.
Title: Re: Inherit $board['name']
Post by: Sir Osis of Liver on June 14, 2022, 06:18:30 PM
Right the first time, $context['page_title'] works fine.  Thanks.