Search code examples
embedexpressionengine

Expression Engine plugin to allow {embed} code in entry body


Trying to create a generic video plugin for Expression Engine 2 where I can put the {embed:video_plugin file_name='FILE'} within the entry article body and have it then load the plugin.

We are able to have this work on one template using the HTMLPurifier module, but that strips out too much code like script, style and other tags we still want to allow.

Does anyone know of a plugin or way to allow this functionality?


Solution

  • Allows EE code to be placed in your entries then parsed by the template: http://expressionengine.com/downloads/details/allow_ee_code/

    Various video players: http://devot-ee.com/search/results/search&keywords=video%20player&channel=addons&addon_version_support=ee2

    Alternative solution: I usually create a field (Matrix) that contains all my images and videos, I can then output these on a per entry basis.

    Using NSM Transplant or the free MX Jumper, I can then replace any specific {embed} within a lump of text with my video. Here's an example:

    {exp:mx_jumper:out_global}
        {images}
            {exp:mx_jumper:put name="image-{row_count}"}
                <a href="{image}" rel="prettyPhoto" class="{if "{alignment}" == ""}right{if:else}{alignment}{/if}">
                    {exp:ce_img:single src="{image}" alt="{alt-text}" width="690" crop="no" bg_color="FFF"}
                </a>
            {/exp:mx_jumper:put}
        {/images}
        {content-text}
    {/exp:mx_jumper:out_global}
    

    This example outputs images from a matrix field (called images), but the same principle can be used for video. In my Wygwam textfield, called {content-text}, I add {image-1}, {image-2}, etc within the text to position the item.

    Whatever EE code or even html code you use to display the video can be placed into the {exp:mx_jumper:put} tag pair, using video paths pulled from the entry.

    You could replace Matrix for a simple textfield which just contained the path.