Anatoliy
Well-known member
I have "Thread Titles" add-on, I'm thinking about to share it with the community, I need to make a minor change, and I'm stuck.
Right now I have this in repository:
I consider the title as too long if its length is > 70. As a thread title is "Thread title | Board title", and my board title length is 20,
So what should I use instead of $bordTitleLenght? I tried $xf.options.boardTitle and $thread.Forum.Node.title but it gives me an error.
Please advise.
Right now I have this in repository:
PHP:
public function findTooLongTitles()
{
$finder = $this->finder('\XF:Thread');
$expression = $finder->expression('CHAR_LENGTH(%s)', 'title');
$finder
->setDefaultOrder('thread_id')
->where($expression, '>', 50)
->where('discussion_state', 'visible')
->where('discussion_type', '!=', 'redirect');
return $finder;
}
I consider the title as too long if its length is > 70. As a thread title is "Thread title | Board title", and my board title length is 20,
->where($expression, '>', 50)
works for me just fine. But if people will use this add-on and their board titles are different I thought to add $limit = 70 - $bordTitleLenght
and to use ->where($expression, '>', $limit)
. So what should I use instead of $bordTitleLenght? I tried $xf.options.boardTitle and $thread.Forum.Node.title but it gives me an error.
Please advise.