Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ian Christman 13 posts 83 karma points
    Aug 30, 2018 @ 20:50
    Ian Christman
    0

    Responsive Macro for video embed code

    I'm using a textbox parameter to drop in embedCode:

    but it just displays on the page and not in the source where I would like it.

    Partial Macro:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

    @Model.MacroParameters["embedCode"]

    Is there a way to insert parameter into source? So I get this:

    Thanks for any suggestions. -ian

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 31, 2018 @ 06:10
    Dave Woestenborghs
    1

    Hi Ian,

    I think you need to use :

    @Html.Raw(Model.MacroParameters["embedCode"])
    

    But you can make the live of your editors easier by using this property editor to embed video's. It just requires the editors to have the video url instead of copy/paste the embed code

    https://our.umbraco.com/projects/backoffice-extensions/oembed-picker-property-editor/

    This will not work as a macro parameter however out of the box. To make it available as macro parameter you can use this package :

    https://our.umbraco.com/projects/developer-tools/parameter-editor-generator/

    Dave

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 12:36
    Ian Christman
    0

    Hi Dave, It still displays on the page and not in the source, but does fix the syntax:

    instead of:

    <iframe src="https://www.youtube.com/embed/kzHW_-tmS48?feature=oembed"; allow="autoplay; encrypted-media" allowfullscreen="" width="360" height="203" frameborder="0"></iframe>

    so maybe in combination with something else?

    Thanks for the editor tip, I'll check it out. -ian

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 31, 2018 @ 12:40
    Dave Woestenborghs
    0

    So you can see the video on the page ?

    Than it should be in the source. You can only see things that are in the source.

    Dave

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 12:42
    Ian Christman
    0

    No video on the page, just the embed code.

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 12:45
    Ian Christman
    0

    The code works fine if I paste into the source in an rte. The video shows and scales with browser.

    -ian

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 31, 2018 @ 12:59
    Dave Woestenborghs
    0

    So you can see the embed code in the source ?

    Dave

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 13:05
    Ian Christman
    0

    The source looks like this:

    <div class="embed-responsive embed-responsive-16by9">
    

    <iframe src="https://www.youtube.com/embed/kzHW_-tmS48?feature=oembed" allow="autoplay; encrypted-media" allowfullscreen="" width="360" height="203" frameborder="0"></iframe>

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 13:08
    Ian Christman
    0

    When I paste code examples in to the editor they look different in the preview/post. The last one looked correct, but the source code I pasted in wasn't. Am I doing something wrong?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 31, 2018 @ 13:10
    Dave Woestenborghs
    0

    I am actually out of ideas. I must admit I have not used macro's in ages.

    Dave

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 13:33
    Ian Christman
    0

    enter image description here

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 31, 2018 @ 13:36
    Dave Woestenborghs
    0

    Ha,

    Could you try this

    @Html.Raw(HttpUtility.HtmlDecode(Model.MacroParameters["embedCode"]))
    

    Dave

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 13:50
    Ian Christman
    0

    Getting this error: System.Web.HttpCompileException (0x80004005): e:\stage.jacksoncoker.local\Views\MacroPartials\Responsive.cshtml(5): error CS1502: The best overloaded method match for 'System.Web.HttpUtility.HtmlDecode(string)' has some invalid arguments at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult) at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content) at umbraco.macro.LoadPartialViewMacro(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId) at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(macro m, IDictionary`2 parameters, page umbracoPage) at ASP.PageViewsPartialsgrideditorsmacrocshtml.Execute() in e:\stage.jacksoncoker.local\Views\Partials\Grid\Editors\Macro.cshtml:line 15 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at ASP.PageViewsPartialsgrideditorsbasecshtml.Execute() in e:\stage.jacksoncoker.local\Views\Partials\Grid\Editors\Base.cshtml:line 20

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 31, 2018 @ 14:04
    Dave Woestenborghs
    0

    Hi Ian,

    Are you sure that Model.MacroParameters["embedCode"] returns a string ?

    Can you please post the entire code ?

    Dave

  • Ian Christman 13 posts 83 karma points
    Aug 31, 2018 @ 14:50
    Ian Christman
    0

    Partial Macro: enter image description here

    Generated Html:

    enter image description here

  • Ian Christman 13 posts 83 karma points
    Sep 04, 2018 @ 20:20
    Ian Christman
    0

    As it turns out enter image description here

    works in text section component.

    The issue is within a bootstrap grid component. Any ideas on how to avoid this is welcome.

    thanks for all your help -ian

  • Ian Christman 13 posts 83 karma points
    Oct 02, 2018 @ 14:14
    Ian Christman
    0

    I'll address bootstrap environment as a separate issue. Thanks -ian

Please Sign in or register to post replies

Write your reply to:

Draft