PDA

View Full Version : Variables plugin


Asterix_ita
04-13-2010, 07:14 AM
I made an addon for VB4 and everything works fine, now I wanted to convert VB3 and popular option that variables are not interpreted in the same way

Eg.

$ok = "OK if true" . $vbulletin->options[bip_ct_padding_botton]." admin";

With this formula in the plugins and reporting $ok in postbit the result is
?OK if true admin

Then the variable at the center is not powered, but the value is there because if I enter $vboptions[bip_ct_padding_botton] on postbit the value is displayed.

I ask you what I miss? Other eg. Not Working

$post[message] .= ?test?

thanks

PS The addon I would like to convert it Birthday image (https://vborg.vbsupport.ru/showthread.php?t=240152)

Lynne
04-13-2010, 02:45 PM
Perhaps $vbulletin isn't valid there (you didn't mention what hook location)? Find the hook in the code (do a search in the files for it) and then look at the code used around it and see if it's valid or if you need to call it a different way.

Asterix_ita
04-13-2010, 04:38 PM
maybe I explained evil, the plugin runs from VB3, but not all variables are fed into the plugin,

eg.

hook postbit_display_complete

$post[message] .= $myvartemp;

in vb4 is ok in vb3 does nothing

now the problem I cheated by making a manual change to the template postbit but I'd like to understand why the merge between variables does not work

thanks

Marco van Herwaarden
04-14-2010, 08:46 AM
My guess is that this is a scope question. Try adding a global for the variables you are using in top of the plugin.

Asterix_ita
04-14-2010, 11:37 AM
thanks for the answers, today I tried another way written several times in this forum, but this had little effect.

I wish that the template was added postbit a variable automatically just before
<!-- / message -->

I state that if I enter manually works. in order to get this

$ct_birthday
<!-- / message -->

to do this I read that many use this syntax

$find = "<!-- / message -->";
$replace = $ct_birthday;

$vbulletin->templatecache['postbit'] = str_replace($find, $replace . $find, $vbulletin->templatecache['postbit']);

the variable $ ct_birthday draws my template which is already in cache

the plugin is invoked by postbit_start.

To see if my template is not loaded I tried to insert the variable manually in the template and it works fine Another test I made is to assign the value to $ replace "mouse" but not reported

Now I do not understand where the error can be seen in many utilizzan syntax similar and I would like to avoid manual editing still Excuse for English but use a translator

Edit:

Created a new plugin for the exchange of cache, global hook allocated start, now works