Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#41 2020-07-20 13:33:02
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,993
- Website
Re: Media shortcode. Requests accepted
michaelkpate wrote #324706:
Looking at the page source, it is showing the yield statement instead of the contents.
Perhaps <txp:yield="media" />
should be <txp:yield name="media" />
?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#42 2020-07-20 13:43:24
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Re: Media shortcode. Requests accepted
This isn’t an error but just an example of how to use it.
I don’t like embedding code in articles so I had been using custom fields.
<txp:if_custom_field name="from">
<txp::media from='<txp:custom_field name="from" />' media='<txp:custom_field name="media" />' title='<txp:custom_field name="title" />' url='<txp:custom_field name="url" />' escape="trim, tidy" />
</txp:if_custom_field>
With the changes, I had to do some refactoring but this works.
<txp:if_custom_field name="from">
<txp:variable name="notlocal" value="yes" />
<txp:if_custom_field name="from" value="local_v">
<txp::media from='<txp:custom_field name="from" />' media='<txp:custom_field name="media" />' title='<txp:custom_field name="title" />' <txp:custom_field name="url" /> escape="trim, tidy" />
<txp:variable name="notlocal" value="" />
</txp:if_custom_field>
<txp:if_custom_field name="from" value="local_a">
<txp::media from='<txp:custom_field name="from" />' media='<txp:custom_field name="media" />' title='<txp:custom_field name="title" />' <txp:custom_field name="url" /> escape="trim, tidy" />
<txp:variable name="notlocal" value="" />
</txp:if_custom_field>
<txp:if_variable name="notlocal" value="yes">
<txp::media from='<txp:custom_field name="from" />' media='<txp:custom_field name="media" />' title='<txp:custom_field name="title" />' url='<txp:custom_field name="url" />' escape="trim, tidy" />
</txp:if_variable>
</txp:if_custom_field>
Offline
#43 2020-07-20 13:45:43
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Re: Media shortcode. Requests accepted
Bloke wrote #324708:
Perhaps
<txp:yield="media" />
should be<txp:yield name="media" />
?
That was indeed the problem. It is working now.
Offline
#44 2020-07-20 13:57:04
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,466
- Website
Re: Media shortcode. Requests accepted
michaelkpate wrote #324706:
I added example for the new ones. I’ve found one issue
Looking at the page source, it is showing the yield statement instead of the contents.
<div class="embed-container" id="m_12097962" itemscope itemtype="http://schema.org/VideoObject"> <iframe src="https://www.metacafe.com/embed/<txp:yield="media" />/" frameborder="0" allowfullscreen></iframe> </div>...
Great Job. I had never heard of several of these sites.
That is strange. Did you fix it yourself? If not, it worked just fine from here (img below). Thanks for the files
they were missing from both the local audio and video!
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#45 2020-07-20 14:00:03
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,466
- Website
Re: Media shortcode. Requests accepted
michaelkpate wrote #324710:
That was indeed the problem. It is working now.
Indeed or I think that I could just have It may have worked for me on your site because of your correction!<txp:yield media />
.
Last edited by colak (2020-07-20 14:20:31)
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#46 2020-07-20 14:14:11
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,466
- Website
Re: Media shortcode. Requests accepted
<txp:if_custom_field name="from">
<txp::media from='<txp:custom_field name="from" />' media='<txp:custom_field name="media" />' title='<txp:custom_field name="title" />' url='<txp:custom_field name="url" />' escape="trim, tidy" />
</txp:if_custom_field>
This is fine, except the url
may yield some unexpected results because of example 5, example 6, and example 8.
> Edited to add that my nomenclature for the url
attribute may be misleading, as although it does return urls, the way it is used is different for each example.
Last edited by colak (2020-07-20 14:18:53)
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#47 2020-07-20 14:32:05
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Re: Media shortcode. Requests accepted
colak wrote #324712:
It may have worked for me on your site because of your correction!
It did. Sorry for the confusion.
Offline
#48 2020-07-20 14:34:15
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Offline
#49 2020-07-20 15:58:59
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,466
- Website
Re: Media shortcode. Requests accepted
michaelkpate wrote #324718:
I didn’t work through all the examples. I’ll have to rethink my approach – probably do a custom call for each site.
demo.cmsstyles.com/datebasedarchives/2020/07/15/welcome-to-the-internet is an example of how the wrong address is parsed before the cookie is accepted unless you use the url attribute as indicated in example 5.
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#50 2020-07-23 13:31:40
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Re: Media shortcode. Requests accepted
I found out that WordPress has an official list of sites they support for embedding because they had to remove Hulu from the list.
Not sure if you want to add any or all of these; they seem pretty obscure.
Offline