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
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Using XThreads Parser
Shocked  You've totally gone beyond the idea of simple threads with that example there.
Amazing work!

My Blog
07-24-2010 01:23 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #3
RE: Using XThreads Parser
Biggrin
Thanks, Yumi Smile
I think we can use it for many purposes.

07-25-2010 09:41 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #4
RE: Using XThreads Parser
Amazing example of what you can do with XThreads! Thanks for sharing
07-25-2010 10:20 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: Using XThreads Parser
This is amazing. I will have to think of a use for this.


[Image: leelink.gif]
MYBB1.6 & XThreads
07-26-2010 08:52 AM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #6
RE: Using XThreads Parser
Hmm, I was plodding along as usual and I have been trying to make a TABS field, so in a thread certain users can apply tabs to separate content in a thread into tabs. Im not sure if I am posting in the right place, but as I want this to be restricted and I think its HTML, maybe this is the right place. Any tips?


[Image: leelink.gif]
MYBB1.6 & XThreads
09-12-2010 04:32 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #7
RE: Using XThreads Parser
Maybe something like this will work as basic (using the jquery tabs):
Tabs Title -> Text Box
Tabs Contents -> Multiline Textbox
Repeat it.
Play with the display format.
Put the variable in template_prefix_showthread or template_prefix_postbit_first / classic.

09-12-2010 06:07 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: Using XThreads Parser
Hmmm, weird thing, I was using this to show some custom stuff on the forum - and I realised that it has "stopped working" ....

I have some posts that used to have embedded videos - now there are no videos. I checked my settings - all seems ok.  I have no idea when this happened, but it does make my posts look a bit odd, pointing to a video which is not there....

EXAMPLE POST :  http://www.leefish.nl/mybb/thread-804.html


[Image: leelink.gif]
MYBB1.6 & XThreads
11-30-2010 05:03 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #9
RE: Using XThreads Parser
I don't know what stuff/change/edit you did for the forum. What it should be if it is "working"?

11-30-2010 05:15 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #10
RE: Using XThreads Parser
(11-30-2010 05:15 AM)RateU Wrote:  I don't know what stuff/change/edit you did for the forum. What it should be if it is "working"?

(11-30-2010 05:03 AM)leefish Wrote:  I have some posts that used to have embedded videos - now there are no videos. I checked my settings - all seems ok.  I have no idea when this happened, but it does make my posts look a bit odd, pointing to a video which is not there....
EXAMPLE POST :  http://www.leefish.nl/mybb/thread-804.html

I'm not sure what else to say. I embedded videos - using this method - it worked - now the videos are no longer visible when I view the post. The data is still there if I edit post. The ONLY thing I did was add the variable to the first post - there are no other custom templates etc in that particular forum.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 11-30-2010 05:21 AM by leefish.)
11-30-2010 05:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: