Friday, 15 June 2012

tridion - Using several RenderComponentPresentations for XPM templates w/ Razor -



tridion - Using several RenderComponentPresentations for XPM templates w/ Razor -

as know, i'm working hard on xpm templates razor. i've ran issue, time concerning rendering components within templates in order create them siteeditable.

the next i'm not sure about. i've got component has title field called "title", , multivalue componentlink fields consists of components title, description , image. let's phone call 1 "linked usp" now.

currently beingness rendered template called 'page banner', , iterates on fields if-loops determine it's presentation, title. in order xpm work, template needs render component presentation of "linked usp". we've created template called "[xpm] usp item". - component template has 'enable content editing tbb" added it.

now issue arises when want create title editable well. sounds straightforward, no? not - because when parent template has got "enable content editing" tbb added, add together <span> tags editable fields templates gets invoked within template have <span> -tags, bloating html , making impossible edit fields within rendercomponentpresentation because of duplicate <span>s.

some code fun , illustrate issue:

<h1>@rendercomponentfield("title", 0)</h1> @foreach(var linkedusp in fields.usps){ @rendercomponentpresentation("linkedusp.id", "tcm:10-1076-32") }

this template has enable content edit tbb added.

now, rcp mentioned above, within [xpm] template:

<div class="title">@rendercomponentfield("title", 0)</div> <p>@rendercomponentfield("description", 0)</p> <tcdl:componentfield name="img"> <img src="@img" alt="img.metadata.alt"> </tcdl:componentfield>

this 1 has "enable content edit" tbb added. on front end end happens:

<div class="title"><span><span>men</span></span></div>

because parent template adds spans field.

so question: how solve this? title field mentioned above has within parent template, can't create special template becuase no component link. can't tbb out of rcp template, because won't editable way. interesting huh?

can't disable spans within template builder somehow?

tridion tridion-2011 experience-manager

No comments:

Post a Comment