Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#11 2020-07-09 16:10:39
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: Media shortcode. Requests accepted
colak wrote #324394:
This would unfortunately not work as youtube (not sure about the rest) uses letters, numbers, and underscores, in the ids.
Sorry, I meant just for SoundCloud, since they are the only ones that use the url
and media
attributes. You could carry on using media
for YouTube and others, but on SoundCloud you could add some extra detection there to see if the value passed into the media
was all numeric or not.
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
#12 2020-07-09 16:16:58
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,468
- Website
Re: Media shortcode. Requests accepted
michaelkpate wrote #324393:
I’ve tried to get it working on two different sites: I keep getting:
...
I can’t figure out why.
Hi Michael, thanks for testing! That is strange! I’m not getting this error!
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#13 2020-07-09 16:36:25
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,468
- Website
Re: Media shortcode. Requests accepted
Bloke wrote #324395:
Sorry, I meant just for SoundCloud, since they are the only ones that use the
url
andmedia
attributes. You could carry on usingmedia
for YouTube and others, but on SoundCloud you could add some extra detection there to see if the value passed into themedia
was all numeric or not.
So do you mean something like this?
<txp:if_yield name="from" value="sc">
<txp:if_yield name="media">
<txp:oui_cookie name='<txp:site_name trim="/\s+/" replace="_" />_soundcloud_cookie' duration="+1 year" values="yes" />
<txp:oui_if_cookie name='<txp:site_name trim="/\s+/" replace="_" />_soundcloud_cookie'>
<div class="embed-container" id="<txp:yield name="media" />"><iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/<txp:yield name="media" />&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe></div>
<txp:else />
<div class="gdpr">
<txp:if_yield name="title"><txp:yield name="title" textile /></txp:if_yield>
<txp:if_yield name="media">
<txp:variable name="detectinteger" escape="tidy, integer"><txp:yield name="media" /></txp:variable>
<txp:if_variable name="detectinteger" value="">
<p>Hosted by <a rel="external noopener" href="https://soundcloud.com/">SoundCloud</a>.</p>
<txp:else />
<p>Hosted by SoundCloud on <a rel="external noopener" href="<txp:yield name="media" />"><txp:yield name="media" /></a>.</p>
</txp:if_variable>
</txp:if_yield>
<p><a rel="external noopener" href="https://soundcloud.com/pages/privacy">SoundCloud’s private policy</a>.</p>
<p class="accept"><a rel="nofollow noindex" href="?<txp:site_name trim="/\s+/" replace="_" />_soundcloud_cookie=yes#m_<txp:yield name="media" />">Listen to it here</a></p>
</div>
</txp:oui_if_cookie>
</txp:if_yield>
</txp:if_yield>
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#14 2020-07-09 16:47:53
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Re: Media shortcode. Requests accepted
colak wrote #324396:
Hi Michael, thanks for testing! That is strange! I’m not getting this error!
I wonder if it is a problem between oui_cookie and PHP 7.4?
http://demo.cmsstyles.com/datebasedarchives/2020/07/06/date-based-archives
http://demo.cmsstyles.com/typerite/2020/03/28/pvpets-tank-battle-royale-cinematic-trailer
The second site I already had some embeds going on but I decided to try and implemented your version for simplicity.
Offline
#15 2020-07-09 16:53:32
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,468
- Website
Re: Media shortcode. Requests accepted
Nope, this needs more thinking. If I use the media
attribute for both the embed and the GDPR warning, in SoundCloud, the embed code will be wrong as it needs a number.
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#16 2020-07-09 16:56:07
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,468
- Website
Re: Media shortcode. Requests accepted
michaelkpate wrote #324398:
I wonder if it is a problem between oui_cookie and PHP 7.4?
I do not think so as I am using PHP version: 7.4.7. I am trying to see where I f*cked up.
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#17 2020-07-09 17:14:48
- colak
- Admin
- From: Cyprus
- Registered: 2004-11-20
- Posts: 8,468
- Website
Re: Media shortcode. Requests accepted
I also discovered another bug. I expected <txp:yield name="title" textile />
to be parsed by textile but after trying <txp::media from="v" media="336049258" title="h3. My awesome video" />
it returned h3. My awesome video
.
Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.
Offline
#18 2020-07-09 17:43:21
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: Media shortcode. Requests accepted
colak wrote #324399:
Nope… If I use the
media
attribute for both the embed and the GDPR warning, in SoundCloud, the embed code will be wrong as it needs a number.
Ah, didn’t spot that it needed different things. That’s annoying. Okay, ignore me, sorry for the confusion.
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
#19 2020-07-09 17:44:36
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,995
- Website
Re: Media shortcode. Requests accepted
colak wrote #324401:
I expected
<txp:yield name="title" textile />
to be parsed by textile
Sadly not. There’s no textile
attribute. escape="textile"
will though!
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
#20 2020-07-09 18:33:19
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,341
- Website
Re: Media shortcode. Requests accepted
I tried installing it at https://prev-demo.textpattern.co/articles/welcome-to-your-site
Same error and this is running PHP version: 7.3.20.
> Textpattern Warning: Tag opening/closing mismatch: <txp:if_yield name="media">…</txp:oui_if_cookie>. while parsing form media on page archive
Tag error: <txp::media from="v" media="336049258" title="My awesome video" /> -> Textpattern Warning: Closing tag without corresponding opening tag: </txp:if_yield>. while parsing form media on page archive
Offline