vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [Solved] Added $thread[preview] to forumdisplay, but linebreaks are stripped (https://vborg.vbsupport.ru/showthread.php?t=123654)

Marris 08-11-2006 10:29 AM

[Solved] Added $thread[preview] to forumdisplay, but linebreaks are stripped
 
I added $thread[preview] below each thread title in my threadbit template, so the forumdisplay shows a thread preview for all threads without having to mouseover the link.

My problem is that the linebreaks are stripped, so all the paragraphs are stuck together. This doesn't happen with the mouseover preview (when title=$thread[preview]). When I mouseover a link the preview retains the proper linebreaks.

Any suggestions to keep the $thread[preview] linebreaks intact when displaying outside of the link title (mouseover)?

Thanks.


UPDATE:

Well, I got the line breaks to display correctly by adding...

Code:

$thread['preview'] = nl2br($thread['preview']);
in functions_forumdisplay.php , but this causes a problem for the mouseover preview formatting.

I am still looking for a better way to do this the retains proper formatting for both mouseover previews and inline previews, preferably without any php code changes.

RS_Jelle 08-11-2006 12:29 PM

Just add:
PHP Code:

$thread['preview2'] = nl2br($thread['preview']); 

And use that for your thing and keep the normal preview for the mouseover ;)

Marris 08-11-2006 03:20 PM

Quote:

Originally Posted by RS_Jelle
Just add:
PHP Code:

$thread['preview2'] = nl2br($thread['preview']); 

And use that for your thing and keep the normal preview for the mouseover ;)

Thanks for the suggestion. Is there any other way to get this to work using threadbit template changes only, without editing the function_forumdisplay.php code?

RS_Jelle 08-11-2006 03:41 PM

Have a look if there's a hook location in the area where you need to do the current edit, then you can use the plugin system ;)

Kirk Y 08-11-2006 06:14 PM

Threadbit_process would probably work.

Marris 08-12-2006 08:15 AM

Thanks to both of you! It's now working as a plugin without any file edits.

Here's the threadbit_process plugin code:

PHP Code:

if ($ignore["$thread[postuserid]"])
    {
        
$thread['preview2'] = '';
    }
    else if (isset(
$thread['preview']) AND $vbulletin->options['threadpreview'] > 0)
    {
        
$thread['preview2'] = nl2br($thread['preview']);
    } 

Then $thread[preview2] in the threadbit template will display proper line breaks when used for inline thread previews in forumdisplay.php.


All times are GMT. The time now is 01:16 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.01013 seconds
  • Memory Usage 1,729KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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