Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2012, 04:17 PM
Sovereign123 Sovereign123 is offline
 
Join Date: Mar 2011
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default BBCode only works in single post, not full thread

I've been trying to get Syntax Highlighting to work on my board so I added BB Code utilizing google's prettify.

As we can see it works here: http://snpr.cm/Mhtsv5.png
[Link looks like: http://myforum.com/forums/showthread.php?557-Coding-Convention-amp-Guidelines&p=3054#post3054 ]

And it doesn't work here: http://snpr.cm/OE9Y3F.png
[Link: http://myforum.com/forums/showthread.php?557-Coding-Convention-amp-Guidelines ]


My BB Code is this:
Code:
<link href="http://myforum.com/prettify/src/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://myforum.com/prettify/src/prettify.js"></script>

<script type="text/javascript">
        var theonload = window.onload;
        window.onload = function(){
            theonload();
            prettyPrint();
        }
</script>
<pre class="prettyprint">
{param}
</pre>
Any ideas what the issue could be with that?
Reply With Quote
  #2  
Old 02-05-2012, 04:51 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure if this will make any difference, but maybe try putting this in headinclude:

Code:
<vb:if condition="THIS_SCRIPT == 'showthread'">
<link href="http://myforum.com/prettify/src/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://myforum.com/prettify/src/prettify.js"></script>

<script type="text/javascript">
        var theonload = window.onload;
        window.onload = function(){
            theonload();
            prettyPrint();
        }
</script>
</vb:if>

Then just make the bbcode:

Code:
<pre class="prettyprint">
{param}
</pre>

That has the disadvantage of always loading the prettyprint stuff whether or not it's used, but this way it's only loaded once.

If that doesn't work, if you could post a link to your threads that might help in figuring out (although I suppose you would have done that if you didn't want to keep it private).
Reply With Quote
  #3  
Old 02-05-2012, 06:22 PM
Sovereign123 Sovereign123 is offline
 
Join Date: Mar 2011
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah that solution didn't work out. I don't mind letting you check it, it's in a private section which is why I didn't give out the link itself.

I made an account you can view it from, I'll PM it to you.

Thanks a lot for your time!
Reply With Quote
  #4  
Old 02-05-2012, 06:38 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try using:

Code:
<script type="text/javascript">
        var theonload = window.onload;
        window.onload = function(){
            if (theonload) theonload();
            prettyPrint();
        }
</script>

the part in red is added. The fact that theonload isn't a function is causing an error on the page that doesn't work, but I don't know why it's not causing an error on both pages.
Reply With Quote
  #5  
Old 02-06-2012, 04:36 AM
Sovereign123 Sovereign123 is offline
 
Join Date: Mar 2011
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very very much, that fixed the issue right up. Only one tag works per page, but I can live with that hahaha.

EDIT: Nope, managed to fix that too!

Code:
<script type="text/javascript">
 if (window.onload = " ")
  {
        var theonload = window.onload;
            window.onload = function(){
            if (theonload) theonload();
            prettyPrint();
  }
}
That's what perfected it!
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 08:03 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.07764 seconds
  • Memory Usage 2,197KB
  • Queries Executed 11 (?)
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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete