Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 05-02-2014, 03:40 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

why not just put the ads in the description boxes of the forums?
Reply With Quote
Благодарность от:
Forum-Germany
  #12  
Old 05-02-2014, 08:36 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe something like this, a plugin using hook forumbit_display:
PHP Code:
global $forum_counter;
$show['forumbit_ad'] = false;
if (
$depth == 1)
   
$forum_counter 0;
else if (
$depth == 2)
   
$show['forumbit_ad'] = ($forum_counter++ % 4); 
Then change your template condition to:
Code:
<vb:if condition="$show['forumbit_ad']">TEST</vb:if>
Reply With Quote
Благодарность от:
Forum-Germany
  #13  
Old 05-02-2014, 11:23 AM
Forum-Germany Forum-Germany is offline
 
Join Date: Nov 2008
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for F your efforts!

Unfortunately, it does not yet work properly.

- Forum 1
-- Sub-Forums
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums
-- Sub-Forums TEST

- Forum 2
-- Sub-Forums
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums
-- Sub-Forums TEST
-- Sub-Forums TEST

- Forum 3
-- Sub-Forums
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums TEST
-- Sub-Forums
-- Sub-Forums TEST
Reply With Quote
  #14  
Old 05-02-2014, 06:49 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh right, I think it should have been:
PHP Code:
global $forum_counter;
$show['forumbit_ad'] = false;
if (
$depth == 1)
   
$forum_counter 1;
else if (
$depth == 2)
   
$show['forumbit_ad'] = !($forum_counter++ % 4); 
Reply With Quote
  #15  
Old 05-02-2014, 09:55 PM
Forum-Germany Forum-Germany is offline
 
Join Date: Nov 2008
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works. :up: But not in the first forum.

- Forum 1
-- Sub-Forums TEST
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums TEST
-- Sub-Forums

- Forum 2
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums TEST :up:
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums TEST :up:
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums

- Forum 3
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums
-- Sub-Forums TEST :up:
-- Sub-Forums
-- Sub-Forums
Reply With Quote
  #16  
Old 05-02-2014, 10:01 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...well, I guess I'm at the point where I'd have to try it myself. Maybe I'll get a chance tomorrow.
Reply With Quote
  #17  
Old 05-02-2014, 10:21 PM
Forum-Germany Forum-Germany is offline
 
Join Date: Nov 2008
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I thank you from the heart! :up:
Reply With Quote
  #18  
Old 05-03-2014, 11:39 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, try this:
PHP Code:
global $forum_counter
$show['forumbit_ad'] = false
if (
$depth == 1
   
$forum_counter 0
else if (
$depth == 2
   
$show['forumbit_ad'] = !(++$forum_counter 4); 
it seems to work for me, but I think it depends on your exact forum structure.
Reply With Quote
  #19  
Old 05-03-2014, 01:59 PM
Forum-Germany Forum-Germany is offline
 
Join Date: Nov 2008
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works! You are the man!

Could you still extend the code on the last forum? So that's the last forum is detected?
Reply With Quote
  #20  
Old 05-03-2014, 03:29 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The last child? Maybe something like this:
PHP Code:
global $forum_counter
$show['forumbit_ad'] = false
if (
$depth == 1
   
$forum_counter 0
else if (
$depth == 2
   
$show['forumbit_ad'] = !(++$forum_counter 4);
$children array_values($vbulletin->iforumcache["$parentid"]);
$show['last_child_forum'] = (end($children) == $forumid); 
Then in the template
Code:
<vb:if condition="$show['last_child_forum']">LAST</vb:if>
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:30 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04733 seconds
  • Memory Usage 2,270KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete