Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Adsense code in fake forum on forum home Details »»
Adsense code in fake forum on forum home
Version: 1.00, by naisho naisho is offline
Developer Last Online: Feb 2019 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 4.0.3 Rating:
Released: 05-05-2010 Last Update: Never Installs: 30
Re-useable Code Code Changes Translations  
No support by the author.

I used this kind of template mod on previous vBulletin 3.8, but it didn't work any longer with version 4.xx so I made a new one.

What it does

On forum home, it displays one or more adsense codes like forum. It behaves like one or more fake forums (see attached images).
You can display it/them anyhere using the "display order" in forum manager.

How to
1 - Go to admincp and create one or two new forums:
Give them any name you want
In the description, put your adsense code (it should be a 468x60px adsense block for a correct display), then these settings are important:
  • Act as forum: yes
  • Active: yes
  • Open: no
  • Show this Forum and Child Forums on the Quick Navigation menu: no
If you stop here, you have two forums that are clickable in forum home, leading to empty forum. To prevent visitors from ckicking on these forum titles, we need to display only the descriptions (adsense code), not the titles.

2 - Two templates must be edited:
  • forumhome_forumbit_level2_post
  • forumhome_forumbit_level1_post
forumhome_forumbit_level2_post template is the full forum home forum list
forumhome_forumbit_level1_post template is the forum category list

In both template:
Find:
Code:
 <h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}">{vb:raw forum.title}</a></h2>
And replace with:

Code:
<vb:comment>Do not show title in these forums</vb:comment>
<vb:if condition="$forumid != in_array($forumid, array(X,Y))">
<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}">{vb:raw forum.title}</a></h2>
</vb:if>
<vb:comment>End of th title condition </vb:comment>
X, Y are the newly created forum IDs

The result is shown in the first attached image below.

More...

To catch visitors' attention, you may wish to display a different forum icon next to these adsense codes (see second attached image). To achieve this, you must edit the same templates.

Find:
Code:
<img src="{vb:stylevar imgdir_statusicon}/{vb:raw forum.imageprefix}forum_{vb:raw forum.statusicon}-48.png" class="forumicon" id="forum_statusicon_{vb:raw forum.forumid}" alt="" />
And replace with:

Code:
<vb:comment>New forum icon for adsense code</vb:comment>
<vb:if condition="$forumid != in_array($forumid, array(X,Y))">
                    <img src="{vb:stylevar imgdir_statusicon}/{vb:raw forum.imageprefix}forum_{vb:raw forum.statusicon}-48.png" class="forumicon" id="forum_statusicon_{vb:raw forum.forumid}" alt="" />
<vb:else />
<vb:if condition="in_array($forumid, array(X,Y))">  
<img src="http://www.YOURSITE.COM/forum/images/search_results/search_results_socialgroup_discussion.png" class="forumicon">
</vb:if></vb:if>
<vb:comment>End of new forum icon edit</vb:comment>
X and Y are your new forum
The URL must be your forum URL.
You can use the icon you want. This one is only an example (see second attached image)

Screenshots

File Type: jpg usual-icon.jpg (237.3 KB, 0 views)
File Type: jpg with-new-icon.jpg (236.6 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
4 благодарности(ей) от:
eTiKeT?, livenetc, nacaruncr, sodasusu

Comments
  #12  
Old 05-07-2010, 03:59 PM
sKippah sKippah is offline
 
Join Date: Oct 2008
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can u get rid of the Counters?
Reply With Quote
  #13  
Old 05-08-2010, 08:20 AM
naisho naisho is offline
 
Join Date: Feb 2008
Location: France
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
How can u get rid of the Counters?
If you want to hide statistics (counters) and last post info, in the same two templates, you need to add the same conditions before the statistics code.
Locate this part:

Code:
        <h4 class="nocss_label">{vb:rawphrase forum_statistics}:</h4>
		<ul class="forumstats td">
			<li>{vb:rawphrase threads}: {vb:raw forum.threadcount}</li>
			<li>{vb:rawphrase posts}: {vb:raw forum.replycount}</li>
		</ul>
		<div class="forumlastpost td">
			<h4 class="lastpostlabel">{vb:rawphrase last_post}:</h4>
			<div>
				{vb:raw forum.lastpostinfo}
			</div>
		</div>

Before this part you add the condition:

Code:
<vb:comment>Do not show statistics and last post info in these forums</vb:comment>
<vb:if condition="$forumid != in_array($forumid, array(X,Y))">

And after you close your if condition:

Code:
</vb:if>
<vb:comment>Do not show statistics/last post info - end</vb:comment>

So, the result should be this:

Code:
       
<vb:comment>Do not show statistics and last post info in these forums</vb:comment>
<vb:if condition="$forumid != in_array($forumid, array(X,Y))"> 
<h4 class="nocss_label">{vb:rawphrase forum_statistics}:</h4>
		<ul class="forumstats td">
			<li>{vb:rawphrase threads}: {vb:raw forum.threadcount}</li>
			<li>{vb:rawphrase posts}: {vb:raw forum.replycount}</li>
		</ul>
		<div class="forumlastpost td">
			<h4 class="lastpostlabel">{vb:rawphrase last_post}:</h4>
			<div>
				{vb:raw forum.lastpostinfo}
			</div>
		</div>
</vb:if>
<vb:comment>Do not show statistics/last post info - end</vb:comment>
Reply With Quote
  #14  
Old 05-08-2010, 07:40 PM
sKippah sKippah is offline
 
Join Date: Oct 2008
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perfectly. Two more, the last , questions. Is it possible to center the ad(s) and is it also possible to add a refresh function?
Thanks a lot
Reply With Quote
  #15  
Old 05-08-2010, 07:55 PM
naisho naisho is offline
 
Join Date: Feb 2008
Location: France
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These edits are quite simple as they keep the div and only hide their contents (title, statistics and last post).
If you want to center the whole thing in the page, then the template must be completely different.
I don't know how to refresh the ad code. Sorry.
Reply With Quote
  #16  
Old 05-12-2010, 08:29 AM
Network Master Network Master is offline
 
Join Date: Apr 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i wont to but google ads where i but here
Reply With Quote
  #17  
Old 05-12-2010, 09:18 AM
valdet's Avatar
valdet valdet is offline
 
Join Date: Feb 2007
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
I used this kind of template mod on previous vBulletin 3.8, but it didn't work any longer with version 4.xx so I made a new one.
Can you please share the code how you achieved that in vB 3.x versions?

I need to add an ad banner in middle of forums on my forum homepage.

Thanks
Reply With Quote
  #18  
Old 05-12-2010, 11:12 AM
sKippah sKippah is offline
 
Join Date: Oct 2008
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

btw i still dont get why x and y
If i add a new forum i just have one id. is this maybe for the Forum-Kategorie AND the forum itself?
Reply With Quote
  #19  
Old 05-12-2010, 07:44 PM
naisho naisho is offline
 
Join Date: Feb 2008
Location: France
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by skippah
btw i still dont get why x and y
If i add a new forum i just have one id. is this maybe for the Forum-Kategorie AND the forum itself?
X and Y are the Ids of the two forums you created, if you create two.
If you create only one, you don't need the Y.
In this case you could use this kind of condition:

Code:
<vb:if condition="$forumid != X">
Instead of:

Code:
<vb:if condition="$forumid != in_array($forumid, array(X,Y))">
Quote:
Originally Posted by valdet
Can you please share the code how you achieved that in vB 3.x versions?
I don't know what code it was but I think I found it in the v.3.8 edit template forum somewhere.
Reply With Quote
  #20  
Old 10-22-2010, 02:17 PM
0verl0rd 0verl0rd is offline
 
Join Date: Oct 2010
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So do you guys still have your GA accounts? lol...

Ill just tag this for now..
Thanks for sharing coder..
Reply With Quote
  #21  
Old 09-16-2011, 01:09 AM
Lazorbeam Lazorbeam is offline
 
Join Date: Aug 2010
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As of today the ads are still up in his forum, so I'm guessing this is legit.

However, forum row DOES change color on mouseover in his forum. Something to keep in mind.
Reply With Quote
Reply


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:33 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.06865 seconds
  • Memory Usage 2,341KB
  • Queries Executed 26 (?)
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
  • (10)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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_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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete