?
or ;optional
just after the token, and that will make it optional.Usage:AbaddonOrmuz wrote: ↑Sat Aug 15, 2020 8:15 pm Sharing the actual code would have be more useful.
Anyways, you can use?
or;optional
just after the token, and that will make it optional.
Code: Select all
[player]{URL1},{NUMBER1},{NUMBER2},{URL2?},{URL3?}[/player]
Code: Select all
<div class="container">
<video width="{NUMBER1}" height="{NUMBER2}" controls crossorigin playsinline poster="{URL2}">
<source src="{URL1}" type="video/mp4">
<track kind="captions" label="English" srclang="en" src="{URL3}"
default>
</video>
</div>
Code: Select all
[player url={URL1} poster={URL2?} width={NUMBER1} height={NUMBER2}]
That's way too complicated for me. I don't understand why naming them makes any difference. I can't understand that page about the syntax. I just wanna figure out how to get this BBCode to work. I've never had to worry about "naming" "attributes" before when it comes to creating working BBCodes.JoshyPHP wrote: ↑Sun Aug 16, 2020 6:46 am You should most definitely give names to those attributes or anytime you'll change anything the old version will stop working.The whole syntax is at https://s9etextformatter.readthedocs.io ... de_syntax/Code: Select all
[player url={URL1} poster={URL2?} width={NUMBER1} height={NUMBER2}]
I'm hoping that's not necessary because I don't think there's any extension that'd do it. I'm trying to figure out how to write the XSL code but I get a message saying my BBCode's template is invalid.
Code: Select all
[test2 poster={URL2?}]{URL1}[/test2]
Code: Select all
<xsl:choose>
<xsl:when test="@poster">
<center><video controls poster="{URL2}"><source src="{URL1}" type="video/mp4"></video></center>
</xsl:when>
<xsl:otherwise>
<center><video controls><source src="{URL1}" type="video/mp4"></video></center>
</xsl:otherwise>
</xsl:choose>
<source>
tag, and was returning "Invalid XSL: EndTag: '</' not found". Making those into self-closing <source />
tags will eliminate that failure.controls
attribute on the <video>
element. The failure seems to be "aborting" parsing such that the remainder of the document is being declared as "Invalid XSL: Extra content at the end of the document". Removing the controls
attribute avoids this, but is not desirable or the right solution.controls="controls"
or controls="true"
or even simply controls=""
to see if this creates a "controls
attribute exists" condition that causes the HTML5 video player to show controls, but in a way that also passes the XML parsing.controls
attribute avoids the issue, and dumping the XML being passed to DOMDocument::loadXML when the failure occurs doesn't show anything "extra":Code: Select all
string(413) "<?xml version="1.0" encoding="utf-8" ?><xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:choose>
<xsl:when test="@poster">
<center><video controls poster="{URL2}"><source src="{URL1}" type="video/mp4" /></video></center>
</xsl:when>
<xsl:otherwise>
<center><video controls><source src="{URL1}" type="video/mp4" /></video></center>
</xsl:otherwise>
</xsl:choose></xsl:template>"
<video controls="">
, so rather than bug Joshy I'd say just do that. The built-in templates that utilize <video>
don't appear to be expected to pass XML-based template validation, and are instead intended to pass HTML-based template validation. Your conditional template, of course, must pass the XML validation.That's fantastic, thanks! To be honest, I don't actually understand most of that post because I'm totally new to XML and haven't read anything about it. Just got sample XML code from somewhere and started fiddling around with it, trial and error. It turns out what I need is both
controls=""
and a closing source tag. Without either I get an invalid template error but with both, it works fine. If I put in a URL for the poster image, the image displays, and if I don't, I get the first frame of the video.Code: Select all
[MP4 poster={URL2?}]{URL1}[/MP4]
Code: Select all
<xsl:choose>
<xsl:when test="@poster">
<center><video controls="" poster="{URL2}"><source src="{URL1}" type="video/mp4"></source></video></center>
</xsl:when>
<xsl:otherwise>
<center><video controls=""><source src="{URL1}" type="video/mp4"></source></video></center>
</xsl:otherwise>
</xsl:choose>
Code: Select all
[MP4 poster={URL2?} subtitle={URL3?}]{URL1}[/MP4]
Code: Select all
<xsl:choose>
<xsl:when test="@poster">
<xsl:choose>
<xsl:when test="@subtitle">
<center><video controls="" poster="{URL2}"><source src="{URL1}" type="video/mp4"></source><track label="English" kind="subtitles" srclang="en" src="{URL3}"></track></video></center>
</xsl:when>
<xsl:otherwise>
<center><video controls="" poster="{URL2}"><source src="{URL1}" type="video/mp4"></source></video></center>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<center><video controls=""><source src="{URL1}" type="video/mp4"></source></video></center>
</xsl:otherwise>
<xsl:when test="@subtitle">
<xsl:choose>
<xsl:when test="@poster">
<center><video controls="" poster="{URL2}"><source src="{URL1}" type="video/mp4"></source><track label="English" kind="subtitles" srclang="en" src="{URL3}"></track></video></center>
</xsl:when>
<xsl:otherwise>
<center><video controls=""><source src="{URL1}" type="video/mp4"></source><track label="English" kind="subtitles" srclang="en" src="{URL3}"></track></video></center>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<center><video controls=""><source src="{URL1}" type="video/mp4"></source></video></center>
</xsl:otherwise>
</xsl:choose>
Hm, no, I wasn't actually asking how the player works or how to style the selection menu so I don't know why you thought I was. I was just describing exactly everything that was happening with my tests. I wasn't talking about blue and grey because I'd like to change those colours; I was only mentioning them because I don't know what's important and what isn't so I just described every single thing.