MyBB Hacks

Full Version: xThreads Display Item Format Not Parsing {VALUE|htmlspecialchars} for filmgenre Field
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello Zingaburga community

I’m having trouble with the XThreads Display Item Format for my filmgenre field. My goal is to display each genre value (e.g., "Drama, Romance, Supernatural, Paranoid") as separate HTML tags with individual CSS styling, like this:  

PHP Code:
<span class="genre-tag">Drama</span>
<span class="genre-tag">Romance</span>
<span class="genre-tag">Supernatural</span>
<span class="genre-tag">Paranoid</span>


here’s my setup:

  • key : input :{$tfinput['filmgenre']}. output : {$GLOBALS['threadfields']['filmgenre']}
  • filmgenre is a text input field in xThreads, with a value like "Drama, Romance, Supernatural, Paranoid".
  • In xThreads settings:  
    Display Item Format: <span class="genre-tag">{VALUE|htmlspecialchars}</span>  
    Display Format: <span class="genre-list">{VALUE}</span>  
    Blank Value: <span class="genre-list"><span class="genre-tag">No genre available</span></span>
  • css

    Code:
    .genre-list { display: inline; }
    .genre-tag { display: inline-block; color: #ff69b4; font-size: 12px; margin-right: 5px; }


However, the output in the thread is not parsed correctly. Instead of the expected HTML, I get:  

PHP Code:
{VALUE|htmlspecialchars}, {VALUE|htmlspecialchars}, {VALUE|htmlspecialchars}, {VALUE|htmlspecialchars}


It seems the {VALUE|htmlspecialchars} syntax isn’t being processed by XThreads. I’m using MyBB 1.8.x (please let me know if you need the exact version or XThreads version).  

How can I achieve the desired output where each genre is wrapped in its own <span class="genre-tag"> with proper styling? Is there a better way to split and style each genre value in xThreads?  

thank you for your help!  

demo: Indolokal

solved! Jap

Display Item Format
Like the "Display Format" field, but this one will be applied to every single value for this field as opposed to being applied to the concatenated list of values.

PHP Code:
<div class="info-value"><span class="genre-tag">{VALUE}</span></div>


still need to rearrange the css style because the layout is not what I want.
[attachment=2594]

I want it to look like this
[attachment=2595]

I'm posting this here in case anyone needs it.

The relationship between Display Format and Display Item Format is that the Display Item Format will be displayed repeatedly, depending on the number of items, and then displayed by the Display Format.

For example:
If we have 4 items, and we enter A in the Display Item Format, it will essentially be displayed as AAAA. Note that whatever we enter in the Item Display Format will be displayed repeatedly for the number of items we specify.
Then, if we enter the Display Format with:

Code:
Display {VALUE} Format

then the result we get is:

Code:
Display AAAA Format

The {VALUE} in the Display Format is whatever the Display Item Format returns after the loop.


In the case above, the Display Format will display:

HTML Code
<div class="info-value"><span class="genre-tag">Drama</span></div>
<div class="info-value"><span class="genre-tag">Romance</span></div>
<div class="info-value"><span class="genre-tag">Supernatural</span></div>
<div class="info-value"><span class="genre-tag">Paranoid</span></div>


This div creates a new line after each genre, because by default, div is a block element. To get the desired result in the second screenshot, either change the info-value class or change the Display Item Format with:

HTML Code
<span class="genre-tag">{VALUE}</span>

and change the Display Format with:

HTML Code
<div class="info-value">{VALUE}</div>

which will output the final result:

HTML Code
<div class="info-value">
	<span class="genre-tag">Drama</span>
	<span class="genre-tag">Romance</span>
	<span class="genre-tag">Supernatural</span>
	<span class="genre-tag">Paranoid</span>
</div>

Reference URL's