PDA

View Full Version : Defining a Variable in a Phrase using php


sparklywater
08-30-2009, 05:54 PM
I have a plugin which has this code:

standard_error(fetch_error("fd_thisacct_is_deleted", $userinfo['username'], $userinfo['userid']));


fd_thisacct_is_deleted is the name of a phrase.

I want to define a variable in this phrase so that when it is called from the standard_error template, it will be able to output the variables. For example I want to define the phrase like this: <phrase 1=" $threadinfo[title]">$vbphrase[fd_thisacct_is_deleted]</phrase>

My question is, where and how can I define this phrase like that so that the variables are output only when the phrase is called?

Lynne
08-30-2009, 06:01 PM
What is the content of the phrase? You should jsut have to put {1} and {2} in the places you want those two variables to display.

sparklywater
08-30-2009, 06:15 PM
I can put {1} in the phrase, but I still haven't placed the <phrase 1="xx"> attribute anywhere, because it's to be placed in the standard_error template as defined by the plugin. I don't know how to modify the following plugin code to include the <phrase 1="xx"> tag:

standard_error(fetch_error("fd_thisacct_is_deleted", $userinfo['username'], $userinfo['userid']));

Lynne
08-30-2009, 07:19 PM
I don't understand... you *have* the two attributes being passed - $userinfo['username'] and $userinfo['userid'] (assuming you used valid variables, that is). So, what else are you trying to do? (Did you look this function up in the API?)

sparklywater
08-30-2009, 09:06 PM
What I'm trying to do is add 2 more variables in addition to the existing 2 variables. In that case can I just add the 2 variables using commas within the function?

--------------- Added 1251670269 at 1251670269 ---------------

ok i found my answer here: http://members.vbulletin.com/api/vBulletin/_includes---functions.php.html#functionfetch_error

Thanks.