Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Using XThreads Parser
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Using XThreads Parser
Basic usage of XThreads Biggrin
We will use XThreads to add our custom script like javascript and CSS style per thread basis. And, we will use it to add some HTML code in postbit.

Here is a simple example for it:

Custom Thread Fields Setting:
  1. Multiline Textbox for Script For Header:
    Create a Custom Thread Fields with this settings:
    • Title: Script For Header
    • Key: cshscr
    • Applicable Forums: 'select forum'
    • Input Field Type: Multiline Textbox
    • Editable by / Required Field?: Administrator
    • Display Parsing: No parsing (dangerous!!)

      Variable in template for displaying this field is: {$GLOBALS['threadfields']['cshscr']}.
      Please remember that we need to set the Editable by / Required Field? setting to Administrator. So, only Admin can use this field.
      We can use this field to put some custom script in our header tag <head>......</head> via the {$GLOBALS['threadfields']['cshscr']} variable, like javascript and custom CSS style. Put the {$GLOBALS['threadfields']['cshscr']} variable in our showthread template, inside the header tag <head>......</head>.

      Example (based on MyBB default showthread template):
      Line #10:

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      <head>
      <title>{$thread['subject']}</title>
      {$headerinclude}
      <script type="text/javascript">
      <!--
      	var quickdelete_confirm = "{$lang->quickdelete_confirm}";
      // -->
      </script>
      <script type="text/javascript" src="jscripts/thread.js?ver=1400"></script>
      {$GLOBALS['threadfields']['cshscr']}
      </head>

  2. Multiline Textbox for Script For Body:
    Create a Custom Thread Fields with this settings:
    • Title: Script For Body
    • Key: csbscr
    • Applicable Forums: 'select a forum above'
    • Input Field Type: Multiline Textbox
    • Editable by / Required Field?: Administrator
    • Display Parsing: Use MyBB Parser
    • MyBB Parser Options: Check All Options

      Variable in template for displaying this field is: {$GLOBALS['threadfields']['csbscr']}.
      We can use this field to put some HTML code inside postbit. Again, please remember that we need to set the Editable by / Required Field? setting to Administrator, so, only Admin can use this field - can add HTML code in the postbit. Just put the {$GLOBALS['threadfields']['csbscr']} variable in postbit and postbit_classic template.

      Example:

      HTML Code
      <div class="post_body" id="pid_{$post['pid']}">
      	{$post['message']}
      	{$GLOBALS['threadfields']['csbscr']}
      </div>


Now, we can use HTML in the first post, and we can use some custom javascript and / or CSS style per thread basis.
With this way we can create "unlimited" HTML page directly from our forum. And of course we can edit, approve / unapprove each "page", because it is threads.

Live Demo:

This demo uses stylesheet link in header, and HTML in body.
Yeah, I grab a free template and put it there for the demo Biggrin
http://www.14.mynie.co.cc/showthread.php?tid=54

This demo uses javascript link and custom style in header. HTML in body.
Using Frogjs v1.1 for this demo.
http://www.14.mynie.co.cc/showthread.php?tid=55

(This post was last modified: 12-19-2010 06:42 AM by RateU.)
07-24-2010 09:26 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Using XThreads Parser - RateU - 07-24-2010 09:26 AM
RE: Using XThreads Parser - ZiNgA BuRgA - 07-24-2010, 01:23 PM
RE: Using XThreads Parser - RateU - 07-25-2010, 09:41 AM
RE: Using XThreads Parser - Pirata Nervo - 07-25-2010, 10:20 PM
RE: Using XThreads Parser - leefish - 07-26-2010, 08:52 AM
RE: Using XThreads Parser - leefish - 09-12-2010, 04:32 AM
RE: Using XThreads Parser - RateU - 09-12-2010, 06:07 AM
RE: Using XThreads Parser - leefish - 11-30-2010, 05:03 AM
RE: Using XThreads Parser - RateU - 11-30-2010, 05:15 AM
RE: Using XThreads Parser - leefish - 11-30-2010, 05:18 AM
RE: Using XThreads Parser - RateU - 11-30-2010, 05:26 AM
RE: Using XThreads Parser - leefish - 11-30-2010, 05:37 AM
RE: Using XThreads Parser - RateU - 11-30-2010, 06:02 AM
RE: Using XThreads Parser - leefish - 11-30-2010, 06:09 AM
RE: Using XThreads Parser - RateU - 11-30-2010, 06:39 AM
RE: Using XThreads Parser - leefish - 11-30-2010, 06:46 AM
RE: Using XThreads Parser - RateU - 11-30-2010, 06:54 AM
RE: Using XThreads Parser - leefish - 11-30-2010, 07:56 AM
RE: Using XThreads Parser - ZiNgA BuRgA - 11-30-2010, 09:00 AM

 Standard Tools
Forum Jump: