We are currently implementing a new site with support for the new UI/XM (Experience Manager). Currently though it seems not possible to add a 'paragraph' (which is a multivalued embedded schema) to our 'article' components. I imagine such basic functionality to be working.
Also, we have a component that links to multiple other components in a multivalue component link field. These indiviual linked components are editable (they are rendered using RenderComponentPresentation()), but we cannot add new component links to the multivalue field.
Anyone have an idea how to get this working?
Kind Regards
Edit:
This will be fixed in 2013 SP1!
Adding multi-value embedded schemas is currently not a possible in Tridion's Experience Manager UI. I suggest opening the Component in form view to add the paragraph.
If you think it is a good idea for SDL to add the feature you miss, you could suggest it at: http://ideas.sdltridion.com.
According to the documentation (password required, see http://docportal.sdl.com/sdltridion for details) you should use the following in your DWT template:
<!-- TemplateBeginRepeat name="fieldname" -->
##RenderComponentField("fieldname", TemplateRepeatIndex)##
<!-- TemplateEndRepeat -->
But that isn't so useful for Component Links as it just renders the TCMURI in your template, so you probably want it to become a dynamic link and then you can use the following in your DWT Template:
<!-- TemplateBeginRepeat name="fieldname" -->
<tcdl:ComponentField name="fieldname" index="${TemplateRepeatIndex}">
##Field##
</tcdl:ComponentField>
<!-- TemplateEndRepeat -->
If you require the title of the linked component in that link, you could use the Dreamweaver Get eXtension (DGX) for example.
This will now get you the value of all fields editable, and when you edit one of the fields, you get a green plus button in the upper left corner of the field properties, from where you can add a new value (you will see a delete and move button in the top of the field properties too).
Please note that if your multi value field is initially empty, you will have to make sure there is a tcdl tag allowing XPM to understand it should show the field edit properties there, you could use something like this for that:
<!-- TemplateBeginIf cond="CollectionLength('Field.Values') == 0" -->
<tcdl:ComponentField name="${Field.Name}"></tcdl:ComponentField>
<!-- TemplateEndIf -->
See the documentation for more details around inline editing.
EDIT:
It seems I misinterpreted the question a bit, indeed as Frank mentions unfortunately XPM has currently no ability to add multi-value embeddable fieldsets. I was tempted to use the following construct, which allows me to edit all the fields, but the multi-value buttons are missing then (since that is not supported):
<!-- TemplateBeginRepeat name="fieldname" -->
<tcdl:ComponentField name="fieldname" index="${TemplateRepeatIndex}">
<!-- TemplateBeginRepeat name="Field.embeddableFieldname1" -->
##RenderComponentField(FieldPath+".embeddableFieldname1", TemplateRepeatIndex)##
-
##RenderComponentField(FieldPath+".embeddableFieldname2", TemplateRepeatIndex)##
<!-- TemplateEndRepeat -->
</tcdl:ComponentField>
<!-- TemplateEndRepeat -->
I use this code to render fields of a multi-value embedded Paragraph schema and it works just fine in XPM:
<!-- TemplateBeginRepeat name="Fields.Paragraph" -->
##RenderComponentField("Fields.Paragraph[${TemplateRepeatIndex}].Body", 0)##
<!-- TemplateEndRepeat -->
Related
I created a mini CMS to store code snippets.
It pulls articles form a mongodb database.
I use highlgiht.js to display the code and allow users to copy the snippets.
With HTML, everything works as expected:
{{#article}}
<h1>Demo</h1>
{{{markup}}} <!-- prints raw HTML in the screen, yay! -->
<h1>HTML</h1>
<pre class="pre-scrollable"><code class="html">{{markup}}</code></pre>
<!-- prints escaped HTML in the screen, and highlight.js highlights it perfectly! YAY -->
{{/article}}
Now, with Javascript:
{{#article}}
<h1>Demo</h1>
{{{js}}} <!-- prints empty script tag: <script></script> -->
<h1>JS</h1>
<pre class="pre-scrollable"><code class="html">{{js}}</code></pre>
<!-- prints <script></script> -->
{{/article}}
The content of the field "js" in the database is "console.log("test");"
Why is it not outputting what's saved in the db, but instead it is making up a new script tag on its own??
Thank you!
After pulling most of my hair, I figured it out:
I had a name collision where my document property/field was named "js" and that conflicted with the name of a helper from a library I am using:
https://github.com/helpers/handlebars-helpers/blob/master/lib/html.js#L85
In Dreamweaver Templating we can access the fields of a component in two ways.
1.##Component.Field.FieldName##
2.##RenderComponentField("FieldName",0)##
similarly to access the Component Presentation
1.RenderComponentPresentation()
Is there way to access it in another way.
You should really consider editing your question and clarifying it a
bit to make it more clear of what you are asking. Reading all the
answers you dismiss and their comments, I think what you are trying to
accomplish is to have some Component Presentations on the Page editable
and others not.
Depending on the version of SiteEdit you are using there are two solutions:
SiteEdit 2009 SP3 - You should remove the inline editing TBB from the Component Template which you do not want editable, the Page will still generate a hover-over the Component Presentation so it can be moved.
UI 2012 (the new UI or Experience Manager) - You can disable inline editing per Component Template, through the checkbox in the Component Template.
If you also need to have the hover-over on the Component Presentations removed, then I think the only solution is to remove the Inline Editing features of the Page Template (for SE 2009 SP3, remove the TBB and for UI 2012 disable it on the Page Template) and generate all the required SiteEdit marking yourself in the Page Template.
An interesting question to all this would be "why?", what is your requirement exactly to have the need for only enabling inline editing on some of the content on the Page. Since you could also accomplish that through (editing) permissions for certain user groups.
The default TBBs that ship with Tridion, SiteEdit 2009 and the new UI/Experience Manager all insist on generating markup around Component Presentations and Component Fields. You can control the markup elements they generate, but there is currently no way to turn them off.
To gain such full control, I created a simple extension function for use in DWT templates. You can find it here: http://code.google.com/p/tridion-practice/wiki/TridionUI2012FunctionsForUseInHtmlTemplates
RenderComponentPresentation would be from the Page Template, and the first examples are from the Component Template, or within e.g. a repeating region:
<!-- TemplateBeginRepeat name="Components" -->
Fields.*FieldName*
<!-- TemplateEndRepeat -->
But either way, why are you asking?
You can also call RenderComponentPresentation from within another Component Template, using this code:
##RenderComponentPresentation(Component.ID, ComponentTemplate.ID)##
Where the arguments are the tcm ids of the component you wish to render, and the template to render it with.
For dynamic component presentations you can use the following in a page template:
<tcdl:ComponentPresentation type="Dynamic" componentURI="${ComponentID}" templateURI="${DynamicComponentTemplateID}" />
But in this case these dynamic component presentations won't be published during the publishing page. So, you should publish them before publishing page.
I am working on Dreamweaver TBB in SDL Tridion 2011 SP1. In the TBB I am using the data from different component presentations.
My Template Building Block looks like this.
Main Component:
<div>##Component.Schema.Title##</div>
<!-- TemplateBeginRepeat name="Fields.link" -->
##RenderComponentPresentation(Field, "tcm:1-8142-32")##
<!-- TemplateEndRepeat -->
Component Template: tcm:1-8142-32
Its DWT TBB looks like this.
<!-- TemplateBeginIf cond="Component.Fields.text" -->
<div>##RenderComponentField("text",0)##</div>
<!-- TemplateEndIf -->
When I previewed the Component I got the output and all component presentations executed as expected.
Output:
SchemaName
data1
data2
Then I created the Page with the page TBB.
<html>
<head></head>
<body>
<!-- TemplateBeginRepeat name="Components" -->
##RenderComponentPresentation()##
<!-- TemplateEndRepeat -->
</body>
</html>
The output is not as expected. The Component Template "tcm:1-8142-32" is not executed.
output:
SchemaName
I want to make SiteEdit to linked component also.
Do I need to add extra templates to the existing ones? I am using Tridion 2012 UI.
I came to know that we need add isQueryBased, property must be set to true.
If yes, can any one help the command to set it true?
I don't know where the problem lies.
Can any one help me out to modify the code and implement SiteEdit for the embedded Component?
In a Dreamweaver template RenderComponenetPresentation() can be called in two ways.
If you are iterating through the Component Presentations on a page ( which I think is what you are doing?)
If for some reason you need to Render a component with a different template, not the one you've added it to the page with.
Assuming number one is what you are doing, then you have added the Component to the page with the correct Template. Therefore you can call ##RenderComponentPresentation()## with no arguments like this:
<html>
<head></head>
<body>
<!-- TemplateBeginRepeat name="Components" -->
##RenderComponentPresentation()##
<!-- TemplateEndRepeat -->
</body>
</html>
"IsQueryBased" is unrelated to your problem. This is connected to SiteEdit and Dynamic Component Presentations.
Update -
It looks like you have 2 questions here:
How can I call RenderComponentPresentation for linked components
How can i make the Component be "SiteEditable"
Looking at question 1 - Assuming you the array of components are not component presentations on the page your initial method was almost correct:
##RenderComponentPresentation(Component.ID,"tcm:xx-xx-xx")##
You should be able to get the component ID from the array, but you will need to specify the ComponentTemplate ID yourself.
For testing purposes, first of all hard code the Tcm ID of the Component Template.
Since putting Tcm ids in templates is bad practice, you will then need to write a TBB to make this available in the package for you. You can then replace the Tcm Id you used for testing.
In relation to your SiteEdit question, this guide might help, if not post a new question detailing the exact nature of your issue.
My page is showing regular component presentations very well.
I have a flash/video file in my local machine and i want to upload this file on my page.
How can I achieve this?
I have this code snippet for rendering components on my page:
<!-- TemplateBeginRepeat name="Components" -->
<!-- TemplateBeginIf cond="ComponentTemplate == 'HomePageCT'" -->
##RenderComponentPresentation()##
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
Please provide all details related to flash files and video files.
Placing a Flash file on a page follows exactly the same process as placing any image in the output of your templates. The steps are outlined below:
Create a Multimedia Schema which allows the Flash multimedia type (e.g. Flash Video Schema)
Upload your Flash file using your new Schema
Create a Component Template to render the HTML you want to use to display the Flash file, and actually publish the binary itself. (e.g. Display Flash CT)
Create a page template (you seem to have done this part) which renders the Page, and renders the Components on the page using ##RenderComponentPresentation()##
Create a Page, and place your Flash file on it using the Display Flash CT
Publish the Page
Without details of the output you want to produce, it is hard to provide the sample Dreamweaver Template Building Block code for the DisplayFlash CT, but it might look something like this:
<embed src="##Component.Id##" allowFullScreen="true" width="540"
height="438" bgcolor="#000000" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
Make sure you use the Default Finish Actions TBB after this in your Component Template so that the src link is processed and the binary is published.
There is nothing special about Flash files with Tridion. They can be treated just like any other Multimedia Component. You can upload them into the CME (or by using Webdav) and thus you will have a Multimedia Component. Make sure of course, that you Multimedia Schema allows the Flash (and extension) as Multimedia Type.
Regarding how you put the Flash file on the Page - again just like a normal Multimedia Component. In your CT you have to generate the output that will make use of your Flash file URL somewhere. You will have to publish your Flash MMC in order to get its URL. You can use Engine.AddBinary or RenderedItem.AddBinary methods for that, or use the Publish Binaries in Package Default TBB, if your MMC is in the package. Then you can simply refer to your Flash URL as package item. Have a look at this URLs for some inspiration: http://yatb.mitza.net/2012/03/publishing-images-as-variants.html (your case doesn't have to be that complex) and http://yatb.mitza.net/2012/04/referencing-image-variants-from.html.
There are several approaches to rendering Multimedia with a Tridion-managed page.
Multimedia components can be:
Part of a component presentation, added to a page with a template selected
As a linked-to multimedia component within a "container" component, which is added to a page
In a rich text format (RTF) area within another component
You could also just publish binaries with dynamic component templates and handle the markup and links outside of Tridion. Get creative with the above basic scenarios depending on the markup and/or metadata you need.
Chris addresses #1 and Mihai explains schema setup and .AddBinary. The second option would be similar, except you'd have to get the referenced ID rather than the component on the page. The third option requires you to parse multimedia within RTF which depends on your templating language and multimedia type.
I've seen XSLT (<xsl:template match="">), grep, and various .replace options to parse specific markup such as Flash videos.
To get a one-off view on a Plone folder I do something like this (not all code shown):
In configure.zcml:
<!-- Marker interface. Set this on the folder through the ZMI
interfaces tab.
-->
<interface interface=".interfaces.IMySpecialFolder" />
In browser/configure.zcml:
<!-- Special case view. Set as the folder's view through the ZMI
properties tab (layout property).
-->
<browser:page
for="..interfaces.IMySpecialFolder"
name="special"
template="special.pt"
permission="zope2.View"
/>
This works great, but I would like to control the folder's display menu to list only my special case view. I can add it, and it shows up only on my marked folder, but I have to change the site-wide ATFolder FTI.
In browser/configure.zcml:
<include package="plone.app.contentmenu" />
<browser:menuItem
for="..interfaces.IMySpecialFolder"
menu="plone_displayviews"
title="Special view"
action="##special"
description="Special case folder view"
/>
In profiles/default/types/Folder.xml:
<?xml version="1.0"?>
<object name="Folder">
<property name="view_methods" purge="False">
<element value="special"/>
</property>
</object>
Of course I cannot remove the existing available view methods without affecting every folder on the site.
Is there a way to do this one-off display menu tweaking without changing a content type's FTI?
Actually, it seems like this problem has been tackled before. p4a.z2utils patches CMFDynamicViewFTI to get the list of available views from an IDynamicallyViewable adapter lookup. (dateable.chronos uses this mechanism for its folder calendar views). So my question becomes:
Is there a way to do this one-off display menu tweaking without changing a content type's FTI and without patching Plone?
The plone display menu builder uses ISelectableBrowserDefault to get available options in the Display menu (see
http://dev.plone.org/plone/browser/plone.app.contentmenu/trunk/plone/app/contentmenu/menu.py#L220)
So I think (but I haven't tried this) that if you define an adapter for a more specific interface (in your case IMySpecialFolder) that provides the Products.CMFDynamicViewFTI.interface.ISelectableBrowserDefault it should work.
The adapter should have the methods required by plone.app.contentmenu.menu.DisplayMenu above.
Answering my own question, I've realised that the most straightforward way to achieve one-off folder views is to follow the pattern Plone itself applies in the Members folder: a PythonScript index_html that calls the custom view, e.g.
member_search=context.restrictedTraverse('member_search_form')
return member_search()
Products.CMFPlone illustrates how to setup such a PythonScript with a GenericSetup import handler.
In retrospect I realise I didn't need the marker interface in my question scenario. It's not necessary here in the answer either.
Note that this solution doesn't result in "the folder's display menu listing only my special case view" as I asked, but does away with the display menu altogether. I'm fine with that.
One way you could have solved it is using traversalhook to register menu items, or in this case, unregister menu items, or register menu items with conditions that make them not appear. With the traversal hook you can use a marker interface to make it just happen in a certain folder, subsection or page.
You can see where we implemented similar code here
https://github.com/collective/collective.listingviews/blob/master/src/collective/listingviews/browser/views/controlpanel.py#L105
In this case we just wanted to register new display menu items dynamically based on control panel configuration.