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

Creating bbcode with custom html

Discussion in 'XenForo Development Discussions' started by ColdIce, Feb 25, 2014.

  1. ColdIce

    ColdIce New Member


    I'm new to Xenforo-development, but hope to get settled in fast enough.
    I've already written the code for an old system, which I need to migrate to XenForo-code.

    The code makes use of a custom class which parses an URL by using file_get_contents with json_decode then returns the parsed data as a stdClass.

    My question here, how would I go about using a stdClass in a template?
    Here is the original HTML-file which I parse in my old-code: http://pastebin.com/qHwj6g4W
    Also to be noted, the JS at the bottom of pastebin-code is individual to every bbcode parsed. I'm using a custom piechart code.

    I need to convert this into XenForo template...

    If there is more to answered, I'll happily provide the necessary info.
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

  3. ColdIce

    ColdIce New Member

    That post is written back in 2010.
    I read that post, looks promising. Isn't it outdated?

    So I will need to write a custom render function?
    And about caching, as this is written out as HTML - how can Xenforo cache this?
    In my old system I made use of phpfastcache which wrote the custom parsed bbcode to a html file and then later on, when a user viewed a thread, it would look up if a cache existed by a generated id (based on the inputed url to the bbcode)
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    No. I have been using that code within my BBCode Manager since 2010. It hasn't changed. There is a BBCode cache built in, you can find this option under "Performance".
  5. ColdIce

    ColdIce New Member

    @Jeremy I've migrated to Xenforo 1.3 RC1 now.

    I was thinking about using a BB Code Media Site.
    How would I go about creating the HTML? If you take look at my pastebin-file in first post, there is a lot to be parsed from a JSON-request. Could you help me out with this?

    To render this in my old system, I take use of a simple template class which do the following:
    Turn on: ob_start
    Get the file
    input variables
    return the view

    then in my old bbcode-system I just require the template class, and render it to the user.

    Could I take use of: getViewRenderer? So I could parse an html file?


Share This Page