PDA

View Full Version : New to vB plugin programming and need some help


ErnestA
01-22-2010, 02:49 AM
Hi everyone, I'm not too bad in PHP, but some of the vB specific nuances ellude me.

I'm trying to upgrade the following plugin to vB4 myself:
https://vborg.vbsupport.ru/showthread.php?t=169266&highlight=banner+rotator&page=13

It's a very simple mod and I'm pretty think only one line of code needs fixing to get it running in the HEADER template.

Here is the original vB3.x template line:

<a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions" /></a>

Here is what the mod changes it to:

<center><a href="<if condition="$ban['url']">$ban<else />$vboptions[forumhome].php$session[sessionurl_q]</if>" target="_blank">$banner</a></center>

[B][U]Here is the default equivalent vB4 line:

<a name="top" href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}" class="logo-image"><img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" /></a>

Here are the two attempts I've made to adapt it to vB4:

<center><a name="top" href="<if condition="{vb:raw ban.url}">{vb:raw ban.url}<else />{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}</if>" target="_blank">{vb:raw banner}</a></center>

<center><a name="top" href="<if condition="$ban['url']">$ban[url]<else />{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}</if>" target="_blank">$banner</a></center>


In both attempts, vBulletin complains about the if condition:

The following error occurred when attempting to evaluate this template:

The conditional on line 4 appears to be missing its beginning tag (<if>). This may cause unexpected behavior.

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

If anyone has any ideas on how I could properly mod this, or point me to the vB documentation that describes what all the variables mean and how everything should be structured.

Thanks for any info you can provide.

BBR-APBT
01-22-2010, 03:05 AM
Do not use {vb:raw ban.url} in your conditionals.
Check here for conditionals help: https://vborg.vbsupport.ru/showthread.php?t=231525


You also have to register variables.
Look here for help with registering variables: https://vborg.vbsupport.ru/showthread.php?t=228078

ErnestA
01-22-2010, 08:19 PM
Thanks for the info! Didn't fix it, so I think I may start from scratch and write my own banner rotator...