Here is my code:
function news_parse(&$message, $parse_quotes = true) {
// [loot]loot_name[/loot]
$pattern = "#[loot](.*?)[/loot]#si";
$loot_name = "\1";
$loot_number = FindItem($loot_name);
$replacement = "<a href=\"javascript:popUp('view_item.php?id=".$loot_number."')\" />".$loot_name."</a>";
$message = preg_replace($pattern, $replacement, $message);
return $message;
}
$loot_name gets the correct assignment but $loot_number gets no assignment.
If I type the loot name instead of using the variable like this:
$loot_number = FindItem('Item Name Here');
It works just fine.
I can also do:
$loot_name = "Item Name Here";
$loot_number = FindItem(loot_name);
and that works fine.
but even though $loot_name is being assigned the right value, (tested with echo) FindItem() won't use it unless I actually type the value into it like in my last example.
Any suggestions?