Page 1 of 1

Displaying Story-Specific FLV Video in News Article

Posted: Mon Jan 16, 2012 7:32 am
by thejoshieb
I'm trying to integrate video into the news module for a news site.

Here is what I want this to do:

When someone posts an article through the news module on the site, have the option to upload a .flv video to go with the written content. (Custom Field)

When a visitor clicks on that story, they can see the written content and be able to play the related video.

The custom field works, as long as it is not a huge video file.

I'm having trouble calling the custom field definition, specifically, getting the code to call the proper url of the video.

here is what I have in my news detail template:

Code: Select all

{if isset($entry->fieldsbyname.video)}
<div id="newsdetailheaderimage">
{object src='uploads/news/$entry->id/$entry->fieldsbyname.video->value' height='530' width='398' class='flashplayer'}
</div>
{/if}
Here is what the source code reads:

Code: Select all

<object class="flashplayer" type="application/x-shockwave-flash" data="uploads/news/$entry->id/$entry->fieldsbyname.video->value" width="398" height="530">
<param name="movie" value="uploads/news/$entry->id/$entry->fieldsbyname.video->value" />
I can tell right away there is something wrong in how I'm calling the video in my news template, but I just don't know what I am doing wrong.

I am trying to use the object plugin... should I be looking elsewhere for a solution?

I even though about a UDT that would use javascript. could that work and if so, how would I go about it?

Here is what I'm working with:

CMSMS version - 1.10.3
News Version - 2.12.3

Running tests locally via wampserver 2.2


Maybe I've overlooked it here in the forum, but I'm totally stumped. Anyone have any thoughts?

Re: Displaying Story-Specific FLV Video in News Article

Posted: Mon Jan 16, 2012 5:32 pm
by Wishbone
First of all, you don't need to specify uploads/news/$entry->id ... You can use $entry->file_location. Also, smarty processes strings in single quotes as literals, which means that variables aren't being evaluated. Double quotes can be used, but only simple variables (no ->) will be processed correctly. I often leave off the quotes when there is no space, but, for some reason, variables with -> still won't be evaluated. In this situation, I would use:

Code: Select all

{assign var=fileloc value=$entry->file_location}
{assign var=filename value=$entry->fieldsbyname.video->value}
{object src=$fileloc/$filename height='530' width='398' class='flashplayer'}