vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   php line breaks ? (https://vborg.vbsupport.ru/showthread.php?t=135737)

paul41598 01-06-2007 10:27 PM

php line breaks ?
 
1 Attachment(s)
Ok I'm having a problem with line breaks...

I basically have this code

PHP Code:

$msgfield = @explode("\n"$vbulletin->options['on_usergroupchange_text']); 

with the below text box. Im trying to be able to type into it but use line breaks and have them parse correctly in a PM. Can anyone say for sure what I'm doing wrong? IT doesnt parse correctly at all. In fact, it doesnt parse, I get nothing unless I move both Hello's next to one another then its fine.

I thought \n is the right character.. hmmm

Guest190829 01-06-2007 11:13 PM

Try the nl2br() function

paul41598 01-06-2007 11:44 PM

dam, no go either

PHP Code:

$msgfield nl2br($vbulletin->options['on_usergroupchange_text']); 


this is my whole chunk of code:

Code:

$msgfield = nl2br($vbulletin->options['on_usergroupchange_text']);
$msg = $msgfield[@array_rand($msgfield)];
$pmbodyfield = @str_replace("{username}", $vbulletin->userinfo['username'], $msg);

    $pmdm =& datamanager_init('PM', $this->registry, ERRTYPE_SILENT);
    $pmdm->set('fromuserid', $vbulletin->options['on_usergroupchange_fromuserid']);
    $pmdm->set('fromusername', $vbulletin->options['on_usergroupchange_fromusername']);
    eval(fetch_email_phrases('usergroupschanged', $this->fetch_field('languageid')));
    $pmdm->set('title', $vbulletin->options['on_usergroupchange_subject']);
    $pmdm->set('message', $pmbodyfield);
    $botperms = array('adminpermissions' => 2);
    $pmdm->set_recipients($this->fetch_field('username'), $botperms); // Ignore PM-Box full
    $pmdm->set('dateline', TIMENOW);
    $pmdm->save();



All times are GMT. The time now is 11:39 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.01561 seconds
  • Memory Usage 1,718KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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