vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   BBCode only works in single post, not full thread (https://vborg.vbsupport.ru/showthread.php?t=278090)

Sovereign123 02-05-2012 03:17 PM

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?

kh99 02-05-2012 03:51 PM

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).

Sovereign123 02-05-2012 05:22 PM

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!

kh99 02-05-2012 05:38 PM

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.

Sovereign123 02-06-2012 03:36 AM

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!


All times are GMT. The time now is 07:35 AM.

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.01451 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete