HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Embed YouTube videos

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#64858 (In Topic #13957)
Avatar

The following Custom Comcode tag (no parameters) works nicely:

Code

{$SET,VIDEO,{$PREG_REPLACE,(http://.*\?v=)?(\w+)(.*)?,$\{2\},{content}}}
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/{$GET*,VIDEO}?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/{$GET*,VIDEO}?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

It's a bit more sophisticated than the example in Allen's video tutorial as it allows you to put URLs to the videos without having to work out the ID (although ID's work too). This is going to be installed by default for 5.1 installations.

Code

[youtube]http://www.youtube.com/watch?v=ZDFFHaz9GsY[/youtube]


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#64861
Avatar

Community saint

Thanks Chris!
This is nice, but is it that I'm missing something here?
Or worst, I'm I now in the process of asking a dumb question?:lol:

Why is this necessary? (is my dumb question)

I have never had any problems posting a YouTube video on Forum Posts or on Comcode pages by simply pasting the "Embed Code" graciously supplied by YouTube directly as an HTML source.

Or, is this code for something else, that I'm blind or ignorant to?:$
Back to the top
 
Posted
Rating:
#64862
Avatar

Users can't post HTML.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#64864
Avatar

Community saint

Chris Graham said

Users can't post HTML.
Yes, indeed. I can clearly visualize this now. Thanks!:$

This is a much cleaner and easier method in any cases!:thumbs:
Back to the top
 
Posted
Rating:
#64865
Avatar

Community saint

I understand the wish to make it easy for the user. As you might already have noticed, that is exactly what I did on my site - building a custom comcode tag called

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#64868
Avatar

Well-settled

Hi,
Chris thanks for everything you are doing for us.

I added this Custom Comcode tag (no parameters).

It will not display anything the forums page takes forever to load.

When I am in the editor and I switch to enable or disabled the WYSIWYG I choose convert and what I get after the convert is done.

Code

[youtube][url="http://www.youtube.com/watch?v=7xrU5BxaPWo" target="_blank"]http://www.youtube.com/watch?v=7xrU5BxaPWo[/url][/youtube]
again thanks for everything and please don't take this to heart.

I would loved this to be added to the next version.
Look at it this way this is progress.
I like the fact that you are looking for ways to make it better for the users to do anything with ocPortal.



link to the forum test post
Back to the top
 
Posted
Rating:
#64870
Avatar

Community saint

Violative said

It will not display anything the forums page takes forever to load.

Try selecting 'Block tag' and deselecting 'Textual tag'. I seem to remember that this made a difference when I was building my own custom tag.

Who knows, it might make all the difference, and if it does you can thank me later.

Or send abuse in my direction if it doesn't!

 :lol:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#64871
Avatar

Well-settled

naw same thing after the edits.
browsers takes forever to load without no output.

Thanks for the pointers though.
Back to the top
 
Posted
Rating:
#64877
Avatar

My questions are:
what exactly does the first bit of code you show do, that isn't done already by my custom comcode tag, other than allow the whole URL to be used?

Nothing. All it does is strip out superfluous bits.

What would one need to edit to achieve a 'customised' YouTube display?

That first line and usage of {$GET,VIDEO} instead of {content} could be plugged into what you have.

If you incorporate it in the next release(s) will it carry the custom comcode tag of

We're going to install it as a Custom Comcode tag for new installations only. So people can edit/delete it. But existing users won't get it, hence why I posted here. It's like an example, but also because it's been a very popular request.

Life is never easy ….. !!

Sure it can be, you could ignore this whole topic ;). If what you have works, I'd say just leave things as they are.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#64878
Avatar

Violative said

naw same thing after the edits.
browsers takes forever to load without no output.

Thanks for the pointers though.

I think Fletch is right, just you need to pass your Comcode that uses the tag through an edit (so it recompiles). I didn't think of that, but it does make sense - ocPortal would think the link in the tag was meant as a hyperlink rather than a parameter if 'textual' is set.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: