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.


Adding SCRIPT code to front page

Login / Search

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

Fan in training

Hi,

I am new to the forum but installed and very pleased with OCPortal. I wonder if someone can help me to understand how I would add the following code to the front page to allow me to display a flash video stream. In a normal web page it is easy enough but I wonder if the player needs to be created as a module/block first and then added? I am not great at programming PHP but as long as I know the correct way to achive this then it will help decide whether our project uses this portal or a plain vanilla html web site. That said, the portal brings us many potential benefits but I need to try and bring our exisiting web pages across without too much drama or recoding.

Best wishes,

Andy





<script type="text/javascript" src="[var.base_url]/javascripts/swfobject.js"></script>

<div id="mediaspace">This text will be replaced</div>

<script type="text/javascript">
var so = new SWFObject('[var.base_url]/flvplayer.swf','mpl','296','224','
9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','false');
so.addParam('flashvars','&file=mp4:livestream1&type=mp4&buff
erlength=5&streamer=rtmp://192.168.10.201/live&controlbar=ove
r&autostart=true&stretching=fill');
so.write('mediaspace');

</script>
Back to the top
 
Posted
Rating:
#46765
Avatar

Community saint

Hi Andy! Welcome aboard!

Try wrapping your code with one of the following tags:

[html][/html]
or
[semihtml][/semihtml]

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#46766
Avatar

Fan in training

Thanks - I tried this but when I preview or save the page it just displays the <DIV> tag and does a nice job of ignoring the stuff contained within the <SCRIPT> </SCRIPT> html tags!!

I thought I would just add it to an existing page so I selected the RULES page and added it in there but it did not work. I expect I am way off course here trying to get my head around how these "html" pages are created by the CMS. If you have a working system and don't mind trying it at your end I would appreciate whether or not the JW Player can be embedded in OCPortal - their code is generated here - http://www.longtailvideo.com/support/jw-player-setup-wizard?example=4 - if it works for you then I know it means a steep learning curve at this end rather than it being impossible.

Best wishes,

Andy
Back to the top
 
Posted
Rating:
#46767
Avatar

Community saint

I will certainly give it a try, however, if you are not hosting your OCP site on their server, have you downloaded the player?
*Please note: this example setup uses a player.swf (and, in some cases, a swfobject.js) that is hosted on our servers. You need to download your own copy of the JW Player (swfobject.js is included in the download) and place it on your own server – then change the link(s) in this example so they point to the file(s) on your server.

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#46768
Avatar

Community saint

Good to go! Here is the code I used:

Code

[html]
<script type='text/javascript' src='js/swfobject.js'></script>

  <div id='mediaspace'>This div will be replaced</div>

  <script type='text/javascript'>
  var s1 = new SWFObject('js/player.swf','ply','470','320','9','#ffffff');
  s1.addParam('allowfullscreen','true');
  s1.addParam('allowscriptaccess','always');
  s1.addParam('wmode','opaque');
  s1.addParam('flashvars','file=http://content.bitsontherun.com/videos/3ta6fhJQ.flv');
  s1.write('mediaspace');
</script>
[/html]

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#46769
Avatar

Seasonal stevenaj said

Thanks - I tried this but when I preview or save the page it just displays the <DIV> tag and does a nice job of ignoring the stuff contained within the <SCRIPT> </SCRIPT> html tags!!

I thought I would just add it to an existing page so I selected the RULES page and added it in there but it did not work. I expect I am way off course here trying to get my head around how these "html" pages are created by the CMS. If you have a working system and don't mind trying it at your end I would appreciate whether or not the JW Player can be embedded in OCPortal - their code is generated here - http://www.longtailvideo.com/support/jw-player-setup-wizard?example=4 - if it works for you then I know it means a steep learning curve at this end rather than it being impossible.

Best wishes,

Andy

You need to either turn off the WYSIWYG editor or paste it into the editor's HTML source (toggle source button).


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:
#46777
Avatar

Fan in training

Thanks very much for confirming it can be done.  I will now have a go at this end.

Best wishes,

Andy
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: