Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2012-02-06 14:08:09
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
using txp tags in article body
I’m trying to put the following code in my article body but whenever I preview the article nothing is displayed.
<video poster="<txp:image id="31" width="358" height="269" controls preload>
<source src="<txp:site_url />files/video.mp4"></source>
<source src="<txp:site_url />files/video.ogv"></source>
</video>
Upon further investigation I found even a simple link such as <a href="<txp:site_url />download.txt">Download</a> wouldn’t display.
If I remove <txp:image /> and <txp:site_url /> and replace them with absolute paths to the files everything works fine.
Last edited by Algaris (2012-02-06 14:09:55)
Offline
Re: using txp tags in article body
Algaris
Textile is probably fouling things up. Surround your <video>... </video> with == or use notextile. at the start and see if things improve.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: using txp tags in article body
try this
==<video poster="<txp:image id="31" width="358" height="269" controls preload><source src="<txp:site_url />files/video.mp4"></source><source src="<txp:site_url />files/video.ogv"></source></video>==
nb: bloke is faster
Last edited by Dragondz (2012-02-06 14:19:05)
Offline
#4 2012-02-06 14:24:11
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
Re: using txp tags in article body
Thanks Stef
I tried both == and notextile. Neither of which worked. I then went into the Advanced Markup options and set both the Article and Excerpt Markup to ‘Leave Text Untouched’and still got the same results.
Offline
Re: using txp tags in article body
if the page online can you give us a link to see the result?
Offline
Re: using txp tags in article body
Algaris
Ah, also remember to close your <txp:image> tag and poster attribute with />" after the height attribute :-)
Last edited by Bloke (2012-02-06 14:33:13)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#7 2012-02-06 14:33:04
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
Re: using txp tags in article body
Unfortunately I’m on a virtual server that isn’t accessible outside my work premises.
Offline
#8 2012-02-06 14:35:48
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
Re: using txp tags in article body
Thanks Stef. I’ve replaced the line of code with: <video poster='<txp:image id="31" />' width="358" height="269" controls preload>
Still no joy though.
—Edit—
Doing ==<a href="<txp:site_url />download.txt">Download</a>== works fine. So there must be an error with my code.
Last edited by Algaris (2012-02-06 14:41:24)
Offline
Re: using txp tags in article body
Weird, this works fine for me:
==<video poster='<txp:image id="31" />' width="358" height="269" controls preload>
<source src="<txp:site_url />files/video.mp4"></source>
<source src="<txp:site_url />files/video.ogv"></source>
</video>==
The problem is definitely a combination of using double quotes in double quotes (as returned by the <txp:image> tag) and then throwing Textile on top didn’t help. The single quotes solved the former issue, and == solved the latter. It’s not obvious though!
Last edited by Bloke (2012-02-06 14:44:52)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#10 2012-02-06 14:48:36
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
Re: using txp tags in article body
Maybe it’s something to do with my servers configuration? I’m sure I had something similar working on our live site (on a different server) in the past.
Ah, here we go. http://example.com/film
—Edit—
I found that when I change the poster image to poster="<txp:site_url />images/31.jpg" it displays the image but none of the video controls work.
Last edited by Algaris (2013-07-10 22:55:09)
Offline
Re: using txp tags in article body
Hmmm, maybe. But I’d have thought it was something else.
Does it work if you use single quotes round the poster attribute? I had to check the source code to track the error down: Firefox helpfully highlighted the bogus output in red, which led me to the solution after a bit of trial and error.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#12 2012-02-06 14:59:03
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
Re: using txp tags in article body
No that doesn’t work either. I get the video controls all greyed out and no poster image.
Offline
Re: using txp tags in article body
Ah, when I said “it works” I mean “it renders” without error, not “it plays video” or “it shows the poster”!
I remember when I was trying this technique (multiple source elements inside a single video tag) I had no end of troubles: one would work on FF, not Chrome. Then if I jiggled stuff about a bit, FF would not show the input controls, but Safari and Chrome would work, while Opera would hang up, or one of them would refuse to show the poster, etc.
In the end the only thing that worked across browser was a single video tag with a src attribute. Even then I never got the poster working so I took it out *shrug*
Anyway, one thing at a time: let’s get the output actually rendering error-free tags (as viewed in the source) and then worry about actually getting the videos to play and the controls/poster to render.
Last edited by Bloke (2012-02-06 15:07:06)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#14 2012-02-06 15:12:55
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 608
Re: using txp tags in article body
Ah sorry my misunderstanding. Well this is the code that’s rendered:
<video poster="<img src="http://example.com/images/31.jpg" alt="" width="358" height="269" />" width="358" height="269" controls="" preload="">
<source src="http://example.com/files/video.mp4">
<source src="http://example.com/files/video.ogv">
</video>
—Edit—
Actually that seems to be how Google copies the code to the clipboard. The actual code is displayed as:
<video poster="<img src="http://tonto/example.com/images/31.jpg" alt="" width="358" height="269" />" width=358" height="269" controls preload>
<source src="http://example.com/files/video.mp4">
<source src="http://example.com/files/video.ogv">
</video>
Last edited by Algaris (2013-07-10 22:56:07)
Offline
Re: using txp tags in article body
Right so the <txp:image> tag has returned double quotes which are then inside double quotes in the poster attribute. In theory (with Textile shut off), using single quotes for the poster attribute will fix it.
If not, then maybe something else is getting in the way, as you suggested. If it’s not the server, maybe some plugin (long shot!)
EDIT: oh, and you have a missing double-quote from the start of your width attribute in the ‘video’ tag. Although HTML is pretty forgiving, any mis-quoting might be screwing things up in this case.
Last edited by Bloke (2012-02-06 15:29:01)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline