vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Parse bbcode in any php file (https://vborg.vbsupport.ru/showthread.php?t=61736)

Boofo 02-19-2004 04:32 PM

Parse bbcode in any php file
 
What would I need to put at the top of a PHP file (that calls my rules template) to make it so any bbcode in the template will be parsed, like smilie code?

Xenon 02-19-2004 04:39 PM

PHP Code:

require('./includes/functions_bbcodeparse.php'); 

then you can call parse_bbcode2() to parse any texts

Boofo 02-19-2004 04:41 PM

I did the first part but basically all the php file has in it is the

eval('print_output("' . fetch_template('rules') . '");');

which calls the template. How would I parse that?

Andreas 02-19-2004 04:41 PM

PHP Code:

require_once('./global.php');
require_once(
'./includes/functions_bbcodeparse.php');

$vboptions['allowbbcode'] = true;
$vboptions['allowsmilies'] = true;
// If you also want tp parse HTML:
// $vboptions['allowhtml'] = true;
// If you also want to parse IMG-Code
// $vboptions['allowbbimagecode'] = true;
$myrules_parsed parse_bbcode($myrules'nonforum'true); 


Boofo 02-19-2004 04:47 PM

Here's what I have for the php file that calles the rules template. That didn't work, KirbyDE, for some reason. ;)

PHP Code:

<?php
error_reporting
(E_ALL & ~E_NOTICE);
 
// pre-cache templates used by all actions
$globaltemplates = array('header,navbar,rules');
define('OVERWRITE_STYLEID'1);
 
// ## Grabs global.php ##
require("./global.php");
require(
'./includes/functions_bbcodeparse.php');
 
// ## yeap what it says ##
define('NO_REGISTER_GLOBALS'1);
 
// ## defines this script as chat if you use phpinclude_start for this page at all ##
define('THIS_SCRIPT''rules');
 
$vboptions['allowbbcode'] = true
$vboptions['allowsmilies'] = true
// If you also want tp parse HTML: 
// $vboptions['allowhtml'] = true; 
// If you also want to parse IMG-Code 
// $vboptions['allowbbimagecode'] = true; 
$rules_parsed parse_bbcode($rules'nonforum'true);
 
eval(
'$navbar = "' fetch_template('navbar') . '";');
eval(
'print_output("' fetch_template('rules') . '");');
?>


Xenon 02-19-2004 04:50 PM

you may use this:

PHP Code:

$rules fetch_template('rules');
$rules parse_bbcode2($rules1111);
eval(
'print_output("' addslashes($rules) . '");'); 


Boofo 02-19-2004 04:54 PM

That almost worked. I got a IE runtime error, some invalid character. It wouldn't load the editor for some reason.

Xenon 02-19-2004 05:00 PM

hmm, maybe it parses some bbcode where you don't want them to be parsed?

but i don't think that's avoidable.

normally you shouldn't parse bb code in templates at all ;)

Boofo 02-19-2004 05:02 PM

Can I just parse smilies? That is all I really need to be parsed in this template.

Andreas 02-19-2004 05:07 PM

Erm ... why don't you just put in the appropriate <IMG>-Tags?
Would be easier IMHO.


All times are GMT. The time now is 10:03 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.01146 seconds
  • Memory Usage 1,742KB
  • 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
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete