vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Help converting a short template mod to VB4 (https://vborg.vbsupport.ru/showthread.php?t=241396)

Booost This 04-28-2010 03:14 AM

Help converting a short template mod to VB4
 
I had this installed on my 3.x forum and worked flawlessly, however with the vb4 upgrade I just did I am completely out of date with the new code structure of vb4. Can someone lend a hand as to what I need to do to get this to work now? It was a great add-on for our board.

It was lifted and customized a little more from this original mod.

http://www.vangic.eu/forum/printthread.php?t=44

This is how I last had it running on VB 3.5+ up until I installed to vb4.

This is in the postbit template.

HTML Code:

<if condition="THIS_SCRIPT == 'showthread'">

<if condition="$jointime > 1825"><img src="$stylevar[imgdir_misc]/goldstar.png"/>
<if condition="$jointime > 3285"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<if condition="$jointime > 2920"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<if condition="$jointime > 2555"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<if condition="$jointime > 2190"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<else />
<if condition="$jointime > 1460"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<if condition="$jointime > 1095"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<if condition="$jointime > 730"><img src="$stylevar[imgdir_misc]/star.png" /></if>
<if condition="$jointime > 365"><img src="$stylevar[imgdir_misc]/star.png" /></if>
</if>
</if>

Any help would be greatly appreciated!

bpr 04-28-2010 04:57 AM

well, i am not that deep into vb4 coding as well, but i think its just a tiny one....

you have to change
<if

into

<vb:if

and </if>

into
</vb:if>

Mr Happy 04-28-2010 09:56 AM

HTML Code:

<vb:if condition="THIS_SCRIPT == 'showthread'">

<vb:if condition="$jointime > 1825"><img src="{vb:stylevar imgdir_editor}/goldstar.png"/></vb:if>
<vb:if condition="$jointime > 3285"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:if condition="$jointime > 2920"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:if condition="$jointime > 2555"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:if condition="$jointime > 2190"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:else />
<vb:if condition="$jointime > 1460"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:if condition="$jointime > 1095"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:if condition="$jointime > 730"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>
<vb:if condition="$jointime > 365"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if>

</vb:if>

Try this. It should work. If not let us know :)

Booost This 04-28-2010 03:37 PM

No dice. Did they change the $jointime variable in the vb4 codebase?

Just a thought.

Also, I even changed the links to absolute to try and alleviate the problem. Still no go.

HTML Code:

div class="username_container">
                                        <vb:if condition="$post['userid']">
<vb:if condition="THIS_SCRIPT == 'showthread'">

<vb:if condition="$jointime > 1825"><img src="http://www.spadsm.com/forum/images/goldstar.png"/></vb:if>
<vb:if condition="$jointime > 3285"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:if condition="$jointime > 2920"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:if condition="$jointime > 2555"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:if condition="$jointime > 2190"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:else />
<vb:if condition="$jointime > 1460"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:if condition="$jointime > 1095"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:if condition="$jointime > 730"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>
<vb:if condition="$jointime > 365"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if>

</vb:if>
                                        {vb:raw memberaction_dropdown}

--------------- Added [DATE]1272478016[/DATE] at [TIME]1272478016[/TIME] ---------------


Also, shouldn't $jointime be represented as {vb:var jointime} or use the {vb:raw} format?

I've tried multiples of configurations and nothing is working, it can't be that hard.

Lynne 04-28-2010 11:46 PM

I would guess you have not registered the variable $jointime for use in the template. When writing a condition, you would use $jointime, not {vb:var jointime}

Booost This 04-29-2010 12:08 AM

Quote:

Originally Posted by Lynne (Post 2028819)
I would guess you have not registered the variable $jointime for use in the template. When writing a condition, you would use $jointime, not {vb:var jointime}

Well regardless of what variable I try to use, it still does not work.

I did create a plugin which was suggested under the original modification and it worked flawlessly throughout the 3.x cycle.

What can I do?

Paul M 04-29-2010 12:37 AM

As Lynne says, you will need to register $jointime to work in the template. The code you posted also seems to have mis-matched IFs.

Im also puzzled about what its supposed to be doing - why do you have an IF based on the scriptname ?

Booost This 04-29-2010 12:41 AM

Quote:

Originally Posted by Paul M (Post 2028846)
As Lynne says, you will need to register $jointime to work in the template. The code you posted also seems to have mis-matched IFs.

Im also puzzled about what its supposed to be doing - why do you have an IF based on the scriptname ?

Ok, well 1) how do I register $jointime?

2) The <IF> based on the script name was something that someone else suggested as a fix for the 3.x version when it wouldn't show up in the PM system.

If I take it out now it actually deletes the userID shown in a post so I opted to leave it in for the vb4 rewrite.

To clarify, the mod is supposed to award stars for years of membership. 1 Year you get a starr, 2 years, you get 2 and so forth. I just further customized it to award a gold star for 5 years of service as our board has some members going on 10 years and showing 10 stars was kind of redundant.

It is displayed either above, or below the username on every post.

Lynne 04-29-2010 02:45 AM

Quote:

Originally Posted by Booost This (Post 2028849)
Ok, well 1) how do I register $jointime?

Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide

Booost This 04-29-2010 03:23 AM

Quote:

Originally Posted by Lynne (Post 2028876)
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide

Thanks but now i'm even more confused.

Where do I register this (put the code)? In a plugin? In the template?

vb4 is so different!


All times are GMT. The time now is 05:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01038 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete