Embedding SWF files into posts ?

Jake Bunce

XenForo moderator
Staff member
Hmm, the BB Code Media Site feature doesn't really work for generic embeds. I'm gonna say this requires an addon.

Maybe some one else knows an easier way, but I don't see one.
 

Blandt

Well-known member
Hmm, the BB Code Media Site feature doesn't really work for generic embeds. I'm gonna say this requires an addon.

Maybe some one else knows an easier way, but I don't see one.
Yep :) I toyed with the back end for a bit ... but .. This is what this thread is about :) shoot us your ideas
 

Jake Bunce

XenForo moderator
Staff member
If you are uploading the swf files as post attachments then you can use a template modification:

Admin CP -> Appearance -> Templates -> attached_files

You can use a condition to check the file extension, like this:

Code:
					<xen:if is="{$attachment.extension} == 'swf'">
						EMBED CODE
					<xen:else />
						REGULAR ATTACHMENTS
					</xen:if>
You will need some swf embed code. Here is one resource I found which provides both javascript and plugin solutions:

http://hubpages.com/hub/Embed-SWF-FLV-MP4-Flash-Video

Here is complete template code that uses the plugin solution:

Code:
<xen:require css="attached_files.css" />

<div class="attachedFiles secondaryContent">
	<h4 class="attachedFilesHeader">{xen:phrase attached_files}:</h4>
	<ul class="attachmentList">
		<xen:foreach loop="$post.attachments" value="$attachment">
			<li class="attachment{xen:if {$attachment.thumbnailUrl}, ' image'}" title="{$attachment.filename}">
				<div class="boxModelFixer primaryContent">
					<xen:if is="{$attachment.extension} == 'swf'">
						<object id="whatever" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0">
							<param name="src" value="{xen:link attachments, $attachment}"/>
							<param name="bgcolor" value="#FFFFFF"/>
							<param name="quality" value="best"/>
							<embed name="whatever" src="{xen:link attachments, $attachment}" width="400" height="300" bgcolor="#FFFFFF" quality="best" pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>
						</object>
					<xen:else />
						<div class="thumbnail">
							<a href="{xen:link attachments, $attachment}" target="_blank">
								<img src="{xen:if $attachment.thumbnailUrl, $attachment.thumbnailUrl, '@imagePath/xenforo/widgets/page.png'}" alt="{$attachment.filename}" />
							</a>
						</div>
					
						<div class="attachmentInfo pairsJustified">
							<h6 class="filename"><a href="{xen:link attachments, $attachment}" target="_blank">{$attachment.filename}</a></h6>
							<dl><dt>{xen:phrase file_size}:</dt> <dd>{xen:number $attachment.file_size, size}</dd></dl>
							<dl><dt>{xen:phrase views}:</dt> <dd>{xen:number $attachment.view_count}</dd></dl>
						</div>
					</xen:if>
				</div>
			</li>
		</xen:foreach>
	</ul>
</div>

<xen:comment><xen:require css="xenforo.css" /></xen:comment>
 

DRE

Well-known member
If you are uploading the swf files as post attachments then you can use a template modification:

Admin CP -> Appearance -> Templates -> attached_files

You can use a condition to check the file extension, like this:

Code:
<xen:if is="{$attachment.extension} == 'swf'">
EMBED CODE
<xen:else />
REGULAR ATTACHMENTS
</xen:if>
You will need some swf embed code. Here is one resource I found which provides both javascript and plugin solutions:

http://hubpages.com/hub/Embed-SWF-FLV-MP4-Flash-Video

Here is complete template code that uses the plugin solution:

Code:
<xen:require css="attached_files.css" />
 
<div class="attachedFiles secondaryContent">
<h4 class="attachedFilesHeader">{xen:phrase attached_files}:</h4>
<ul class="attachmentList">
<xen:foreach loop="$post.attachments" value="$attachment">
<li class="attachment{xen:if {$attachment.thumbnailUrl}, ' image'}" title="{$attachment.filename}">
<div class="boxModelFixer primaryContent">
<xen:if is="{$attachment.extension} == 'swf'">
<object id="whatever" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0">
<param name="src" value="{xen:link attachments, $attachment}"/>
<param name="bgcolor" value="#FFFFFF"/>
<param name="quality" value="best"/>
<embed name="whatever" src="{xen:link attachments, $attachment}" width="400" height="300" bgcolor="#FFFFFF" quality="best" pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>
</object>
<xen:else />
<div class="thumbnail">
<a href="{xen:link attachments, $attachment}" target="_blank">
<img src="{xen:if $attachment.thumbnailUrl, $attachment.thumbnailUrl, '@imagePath/xenforo/widgets/page.png'}" alt="{$attachment.filename}" />
</a>
</div>
 
<div class="attachmentInfo pairsJustified">
<h6 class="filename"><a href="{xen:link attachments, $attachment}" target="_blank">{$attachment.filename}</a></h6>
<dl><dt>{xen:phrase file_size}:</dt> <dd>{xen:number $attachment.file_size, size}</dd></dl>
<dl><dt>{xen:phrase views}:</dt> <dd>{xen:number $attachment.view_count}</dd></dl>
</div>
</xen:if>
</div>
</li>
</xen:foreach>
</ul>
</div>
 
<xen:comment><xen:require css="xenforo.css" /></xen:comment>
Hey that's great but that is for swf files only. Where on that page did you get this code?

I mainly just need it for mp4 and mov files.
 
Top