1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using xenforo post parser outside xenforo?

Discussion in 'XenForo Development Discussions' started by Member 3639, Dec 4, 2010.

  1. Member 3639

    Member 3639 Active Member

    Okay so i am looking into the post parser at the moment.

    After including the file how do i run my own text through it? For example loading a post outside the forum and parsing it? Which functions do i need to pass it through?
     
  2. Indigo

    Indigo Active Member

    Assuming you already have the XenForo_* classes available (via autoloading setup - see index.php/admin.php for examples in bootstrapping).

    PHP:
    $formatter XenForo_BbCode_Formatter_Base::create();
    $parser = new XenForo_BbCode_Parser($formatter);
    $html $parser->render($text);
     
    Onimua and Shadab like this.
  3. Member 3639

    Member 3639 Active Member

    It's odd in a test.php file i have this:
    PHP:
    <?php
    $startTime 
    microtime(true);

    $xenforoRoot '/home/prxainf1/public_html/gamingonlinux.info/chill';
    require(
    $xenforoRoot'/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($xenforoRoot '/library');

    XenForo_Application::initialize($xenforoRoot '/library'$xenforoRoot);
    XenForo_Application::set('page_start_time'$startTime);

    $formatter XenForo_BbCode_Formatter_Base::create();
    $parser = new XenForo_BbCode_Parser($formatter);

    $text "[b]test[/b]";
    $html $parser->render($text); 

    echo 
    $html;
    ?>
    Which works fine, but when i put the main parts into a header.php file for my main site i get an unexpected error message crop up with no other details.
     
  4. Indigo

    Indigo Active Member

    Can you enable error reporting in that file to get a better description of the issue? Are you trying to integrate it with an existing software?
     

Share This Page