The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#21
|
|||
|
|||
I need to add extra Google ad tags before the </head> section on only thread pages and on all other pages the Google ad tags appearing before the </head> section are completely different. This is why the headinclude section already has google ad tags within it and I need to ensure these are not copied into thread display pages and instead thread display pages display a completely different version of headinclude.
Google DFP (an ad manager) doesn't allow you to initiate ad tags in the head of your pages unless those ad units are actually displayed on the page. On our forum we have different ads units on threads than we do on other pages. |
#22
|
||||
|
||||
<if condition="THIS_SCRIPT == showthread"> you custom code here</if>
|
#23
|
|||
|
|||
Hmm ok i've done that. It still isn't showing it correctly
You must be getting annoyed with me now! This is what i have in headinclude: Code:
<!-- CSS Stylesheet --> $style[css] <if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')"> <style type="text/css" id="vbulletin_opera8fix_css"> ul, ol { padding-$stylevar[left]:20px; } </style> </if> <if condition="$show['editor_css']"> $editor_css </if> <!-- / CSS Stylesheet --> Code:
<if condition="THIS_SCRIPT == 'SHOWTHREAD' "> <meta name="google-site-verification" content="removed" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'removed']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <if condition="!$bbuserinfo['userid']"> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/13461183/Forum_beneathfirstpost', [728, 90], 'div-gpt-ad-1338664095261-0').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_bottom', [728, 90], 'div-gpt-ad-1338664095261-1').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_firstpost_300x250', [300, 250], 'div-gpt-ad-1338664095261-2').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_leaderboard', [728, 90], 'div-gpt-ad-1338664095261-3').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_secondpost_300x250', [300, 250], 'div-gpt-ad-1338664095261-4').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> <else /> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/13461183/Forum_bottom', [728, 90], 'div-gpt-ad-1338664095261-1').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_leaderboard', [728, 90], 'div-gpt-ad-1338664095261-3').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> </if> <meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" /> <meta name="generator" content="vBulletin $vboptions[templateversion]" /> <if condition="$show['threadinfo']"> <meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$threadinfo[prefix_plain_html] $threadinfo[title], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[title] $foruminfo[title_clean]" /> <else /><if condition="$show['foruminfo']"> <meta name="keywords" content="$foruminfo[title_clean], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$foruminfo[description_clean]" /> <else /> <meta name="keywords" content="$vboptions[keywords]" /> <meta name="description" content="$vboptions[description]" /> </if></if> <!-- CSS Stylesheet --> $style[css] <if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')"> <style type="text/css" id="vbulletin_opera8fix_css"> ul, ol { padding-$stylevar[left]:20px; } </style> </if> <if condition="$show['editor_css']"> $editor_css </if> <!-- / CSS Stylesheet --> <script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> <!-- var SESSIONURL = "$session[sessionurl_js]"; var SECURITYTOKEN = "$bbuserinfo[securitytoken]"; var IMGDIR_MISC = "$stylevar[imgdir_misc]"; var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10); // --> </script> <script type="text/javascript" src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script> <if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if> <if condition="$vboptions['externalrss']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] RSS Feed" href="external.php?type=RSS2" /> <if condition="$show['foruminfo'] OR $show['threadinfo']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] - $foruminfo[title_clean] - RSS Feed" href="external.php?type=RSS2&forumids=$foruminfo[forumid]" /> </if> </if> <else /> <meta name="google-site-verification" content="removed" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'removed']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/13461183/Forum_bottom', [728, 90], 'div-gpt-ad-1338664095261-1').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_leaderboard', [728, 90], 'div-gpt-ad-1338664095261-3').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> <meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" /> <meta name="generator" content="vBulletin $vboptions[templateversion]" /> <if condition="$show['threadinfo']"> <meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$threadinfo[prefix_plain_html] $threadinfo[title], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[title] $foruminfo[title_clean]" /> <else /><if condition="$show['foruminfo']"> <meta name="keywords" content="$foruminfo[title_clean], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$foruminfo[description_clean]" /> <else /> <meta name="keywords" content="$vboptions[keywords]" /> <meta name="description" content="$vboptions[description]" /> </if></if> <!-- CSS Stylesheet --> $style[css] <if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')"> <style type="text/css" id="vbulletin_opera8fix_css"> ul, ol { padding-$stylevar[left]:20px; } </style> </if> <if condition="$show['editor_css']"> $editor_css </if> <!-- / CSS Stylesheet --> <script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> <!-- var SESSIONURL = "$session[sessionurl_js]"; var SECURITYTOKEN = "$bbuserinfo[securitytoken]"; var IMGDIR_MISC = "$stylevar[imgdir_misc]"; var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10); // --> </script> <script type="text/javascript" src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script> <if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if> <if condition="$vboptions['externalrss']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] RSS Feed" href="external.php?type=RSS2" /> <if condition="$show['foruminfo'] OR $show['threadinfo']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] - $foruminfo[title_clean] - RSS Feed" href="external.php?type=RSS2&forumids=$foruminfo[forumid]" /> </if> </if> </if> Quote:
As i said before when i pasted my code directly into the SHOWTHREAD part of the template the ads all displayed correctly and it appeared to parse my code correctly but there were werid anomalies with the forum display for some members. |
#24
|
|||
|
|||
I modified my code above a bit as i can see it was a bit wrong. However It is still not displaying properly.
It appears to be to be skipping the conditional <if condition="THIS_SCRIPT == showthread"> and jumping straight to the bit after the <ELSE /> tag. I've tested this by putting in some test text straight after this tag to see if it displays and it doesn't. It is just showing the bit after <ELSE /> So this is what i have in headinclude: Code:
<!-- / CSS Stylesheet --> Code:
<if condition="THIS_SCRIPT == 'SHOWTHREAD' "> <meta name="google-site-verification" content="removed" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'removed']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <if condition="!$bbuserinfo['userid']"> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/13461183/Forum_beneathfirstpost', [728, 90], 'div-gpt-ad-1338664095261-0').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_bottom', [728, 90], 'div-gpt-ad-1338664095261-1').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_firstpost_300x250', [300, 250], 'div-gpt-ad-1338664095261-2').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_leaderboard', [728, 90], 'div-gpt-ad-1338664095261-3').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_secondpost_300x250', [300, 250], 'div-gpt-ad-1338664095261-4').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> <else /> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/13461183/Forum_bottom', [728, 90], 'div-gpt-ad-1338664095261-1').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_leaderboard', [728, 90], 'div-gpt-ad-1338664095261-3').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script></if> <meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" /> <meta name="generator" content="vBulletin $vboptions[templateversion]" /> <if condition="$show['threadinfo']"> <meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$threadinfo[prefix_plain_html] $threadinfo[title], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[title] $foruminfo[title_clean]" /> <else /><if condition="$show['foruminfo']"> <meta name="keywords" content="$foruminfo[title_clean], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$foruminfo[description_clean]" /> <else /> <meta name="keywords" content="$vboptions[keywords]" /> <meta name="description" content="$vboptions[description]" /> </if></if> <!-- CSS Stylesheet --> $style[css] <if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')"> <style type="text/css" id="vbulletin_opera8fix_css"> ul, ol { padding-$stylevar[left]:20px; } </style> </if> <if condition="$show['editor_css']"> $editor_css </if> <!-- / CSS Stylesheet --> <script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> <!-- var SESSIONURL = "$session[sessionurl_js]"; var SECURITYTOKEN = "$bbuserinfo[securitytoken]"; var IMGDIR_MISC = "$stylevar[imgdir_misc]"; var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10); // --> </script> <script type="text/javascript" src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script> <if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if> <if condition="$vboptions['externalrss']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] RSS Feed" href="external.php?type=RSS2" /> <if condition="$show['foruminfo'] OR $show['threadinfo']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] - $foruminfo[title_clean] - RSS Feed" href="external.php?type=RSS2&forumids=$foruminfo[forumid]" /> </if> </if> <else /> <meta name="google-site-verification" content="removed" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'removed']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/13461183/Forum_bottom', [728, 90], 'div-gpt-ad-1338664095261-1').addService(googletag.pubads()); googletag.defineSlot('/13461183/Forum_leaderboard', [728, 90], 'div-gpt-ad-1338664095261-3').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> <meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" /> <meta name="generator" content="vBulletin $vboptions[templateversion]" /> <if condition="$show['threadinfo']"> <meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$threadinfo[prefix_plain_html] $threadinfo[title], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[title] $foruminfo[title_clean]" /> <else /><if condition="$show['foruminfo']"> <meta name="keywords" content="$foruminfo[title_clean], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$foruminfo[description_clean]" /> <else /> <meta name="keywords" content="$vboptions[keywords]" /> <meta name="description" content="$vboptions[description]" /> </if></if> <!-- CSS Stylesheet --> $style[css] <if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')"> <style type="text/css" id="vbulletin_opera8fix_css"> ul, ol { padding-$stylevar[left]:20px; } </style> </if> <if condition="$show['editor_css']"> $editor_css </if> <!-- / CSS Stylesheet --> <script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> <!-- var SESSIONURL = "$session[sessionurl_js]"; var SECURITYTOKEN = "$bbuserinfo[securitytoken]"; var IMGDIR_MISC = "$stylevar[imgdir_misc]"; var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10); // --> </script> <script type="text/javascript" src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script> <if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if> <if condition="$vboptions['externalrss']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] RSS Feed" href="external.php?type=RSS2" /> <if condition="$show['foruminfo'] OR $show['threadinfo']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] - $foruminfo[title_clean] - RSS Feed" href="external.php?type=RSS2&forumids=$foruminfo[forumid]" /> </if> </if></if> |
#25
|
||||
|
||||
All i had left on my test site headinclude was <!-- / CSS Stylesheet --> and i delivered all the other code via the hd_form no problem?
--------------- Added [DATE]1339184932[/DATE] at [TIME]1339184932[/TIME] --------------- It may well be because this <if condition="THIS_SCRIPT == 'SHOWTHREAD' "> should look like this <if condition="THIS_SCRIPT == 'showthread' "> which is how i gave it to you in the first place! |
#26
|
|||
|
|||
Wahey, it works!
--------------- Added [DATE]1339185216[/DATE] at [TIME]1339185216[/TIME] --------------- By the way - i also just have <!-- / CSS Stylesheet --> in my headinclude now too - do i need to delete that reference in hd_form or leave everything as is? Thank you so much! |
#27
|
||||
|
||||
Now that you have it working change the reference in the plugin from that to something like <!-- my_hd --> and then in your headinclude do the same then there's no confusion
|
#28
|
|||
|
|||
Brilliant - i've done that now.
Final question: Could i not put all the code i've put in hd_form simply into headinclude with the <if condition="THIS_SCRIPT == 'showthread' "> at the top? Would that not achieve the same thing? This has been a good learning experience for me. |
#29
|
||||
|
||||
When you quote ANYTHING either between " or ' it is case sensitive, when you have a moment just create yourself a little html file like this
HTML Code:
<html> <head> <title>My Test Page</title> </head> <body> <h2>My test page!</h2> </body> </html> --------------- Added [DATE]1339185758[/DATE] at [TIME]1339185758[/TIME] --------------- Quote:
|
#30
|
|||
|
|||
Thank you.
If i wanted to be a bit more complex within headinclude i guess i could include a list of different conditional statements which call different versions of hd_form (such as hd_form1, hd_form2, etc) depending on the area a user is browsing? Eg: Code:
<if condition="THIS_SCRIPT == 'showthread' "> <!-- my_hd --> </if> <if condition="THIS_SCRIPT == 'printthread' "> <!-- my_hd2 --></if> <if condition="THIS_SCRIPT == 'forumhome' "> <!-- my_hd3 --></if> <!-- default_hd --> Sorry, another question. While this does all appear to be working fine today I've noticed that the forum isn't marking threads as being 'read' as it usually does. If i view a thread and then go back to the sub-forum it still shows that thread as having new posts in it even though i've already read it. No matter how many times i refresh or re-view the same thread it will still show as a thread with new posts in. Its as if the counters aren't being updated or its serving me a cached copy or something. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|