1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Embedding SWF files into posts ?

Discussion in 'XenForo Questions and Support' started by Blandt, Nov 23, 2010.

  1. Blandt

    Blandt Well-Known Member

    Any Ideas, on how to embed swf files ?
     
    arabic likes this.
  2. Jake Bunce

    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.
     
    arabic and Blandt like this.
  3. Blandt

    Blandt Well-Known Member

    Yep :) I toyed with the back end for a bit ... but .. This is what this thread is about :) shoot us your ideas
     
    arabic likes this.
  4. Jake Bunce

    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>
    
     
    vinhtq, arabic and Blandt like this.
  5. Blandt

    Blandt Well-Known Member

    Can someone put this into a package ? :)
     
    arabic likes this.
  6. Blandt

    Blandt Well-Known Member

  7. Nasr

    Nasr Well-Known Member

    Did you check the BBcode Manager? I think it has a flash BBcode included.
     
    CyberAP likes this.
  8. anotheralias

    anotheralias Well-Known Member

    I've been doing that with the Flash BBcode with no problems.
     
  9. DRE

    DRE Well-Known Member

    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.
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  11. TheSalt

    TheSalt Active Member

    Would it be a problem hosting the flash file in the root folder?
     

Share This Page