Trying to use the PHP substr_count and getting an error

Just use:
PHP:
$v['smilie_text']

The unnecessary for loop is a slight performance hit.

That works great! Thank you, Jeremy.

PHP:
    $smilie_count = 0;   
     foreach ($smilietext as $k => $v)
     {
       $smilie_count += substr_count($input['message'], $v['smilie_text']);
     }
 
I'm also 99% sure this query is already in the default models.

Looks like I can use this function.

library/Xenforo/Model/Smilie.php

PHP:
  /**
    * Gets all smilies ordered by their title.
    *
    * @return array Format: [smilie id] => info
    */
   public function getAllSmilies()
   {
     return $this->fetchAllKeyed('
       SELECT *
       FROM xf_smilie
       ORDER BY title
     ', 'smilie_id');
   }
 
Looks about right. I don't have an IDE open to verify, but looks it. Your loop will still work.

Yes the loop worked perfect. I used the following to grab the data:

PHP:
  $smilietext = $this->getModelFromCache('XenForo_Model_Smilie')->getAllSmilies();

I sure appreciate the help.
 
Top Bottom