Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 06-08-2012, 04:00 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aha that would explain the template not appearing correctly.

Thanks Simon you are a star. i'll try that out and let you know how i get on.

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

ok sorry for being a bit thick - what exactly do i do? I've imported this plugin.

I want to create a custom headinclude with my modified code and i want that headinclude to display exclusively in SHOWTHREAD whilst everything else uses the default headinclude code.
Reply With Quote
  #12  
Old 06-08-2012, 04:40 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the pluging is turned on for it, it should show "My Template Stuff!" in the top left of your forum, it's found in the template hd_form, in the template hd_form you need to add a conditional <if condition="THIS_SCRIPT == 'showthread' ">ALL THE TEMPLATE STUFF</if> now the contents of the hd_form will only appear when using showthread template.
Reply With Quote
  #13  
Old 06-08-2012, 05:01 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok the script is working, and i've edited hd_form to include the code i would like it to run but it doesn't appear to run correctly.

My code does have IF ELSE statement in it and i'm wondering if this is affecting it? It shouldn't do as it runs the code correctly if its pasted directly into the SHOWTHREAD template.
Reply With Quote
  #14  
Old 06-08-2012, 05:03 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

depends how you implemented it!
Reply With Quote
  #15  
Old 06-08-2012, 05:09 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll explain what i'm doing.

I'm trying to show different Google DFP ad tags in the header depending on whether somebody is browsing (not logged in) or logged in. The reason for this is Google DFP don't like it if you activate all of your ad units in the header when those ad units aren't displayed on a given page the header is on.

So users who are not logged in see more ad units on a page than a registered user.

So in headinclude the default 2 ad tags (on the footer and forum nav bar) are initiated. On showthread I need it to do the same but add an IF conditional that if a user isn't logged in then it initiates more ad tags. I cant' do this in headinclude because those ad units only appear in showthread and not on other pages (such as forum listings or on the forum homepage).

So - am i right in thinking copying the entire contents of headinclude and putting it in hd_form with the IF conditionals for the ad tags is the correct thing to do?

This is what it looks like:

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

<meta name="google-site-verification" content="edited out for privacy reasons" />


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'edited out for privacy reasons']);
  _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&amp;forumids=$foruminfo[forumid]" />
	</if>
</if>
</if>
Reply With Quote
  #16  
Old 06-08-2012, 05:20 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you just need to import this product and manipulate it as you want (dont forget to choose overwrite!)
Attached Files
File Type: xml product-add_headinclude_content.xml (4.1 KB, 5 views)
Reply With Quote
  #17  
Old 06-08-2012, 05:28 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks I just tested it out - and its still the same problem with it not parsing the code correctly in hd_form in thread topics.

However something slightly strange I noticed: If i modify headinclude and display a thread its still pulling in data from headinclude. If i modify hd_form its also displaying that data too. So something isnt right.
Reply With Quote
  #18  
Old 06-08-2012, 05:33 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not replacing headinclude it's adding to it!
Reply With Quote
  #19  
Old 06-08-2012, 05:34 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah! Well i need something to completely replace it!

I need to replace headinclude on certain sections on my forum. At the moment i'm concentrating on showthread.

Is that possible?
Reply With Quote
  #20  
Old 06-08-2012, 05:57 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep with that template, remove everything except <!-- / CSS Stylesheet --> in headinclude, in the template hd_form under <if THIS_SCRIPT.....etc add your entire modified headinclude, before the last </if> put <else /> and then the original contents of the headinclude and you should be good

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

Can i ask why you are wanting to replace the headinclude? what are you trying to do?
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 04:04 PM.


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.04673 seconds
  • Memory Usage 2,278KB
  • Queries Executed 12 (?)
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
  • (1)bbcode_code
  • (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
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (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_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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete