We have a "component A" , which has a multivalue field of type 'embedded field'.
The embedded field in turn has a multivalue field of type 'Component Link'.
This looks like:
Component A -> Embedded Shcema Fields -> Component Links
How to iterate and access the fields of 'Component Links'in dreamweaver?
Also the component field supports three different schemas and We want to check on these schema names in dreamweaver.
I found this post useful. But more details would be indeed great.
Have a look at these questions:
How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1
Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable
And this page from the Tridion practice cookbook:
http://code.google.com/p/tridion-practice/wiki/IteratingOverMultivalueEmbeddedFields
They cover the most common problems you may have with accessing fields in a DWT.
If these don't answer your question, update your question with:
the relevant XML fragment of your Component
the DWT fragment showing what you already tried
You can easily iterate through component link of multi value embedded field but there is no direct way to get component link values, you have to use either dwt extension, or .net tbb. There are some available on sdltridionworld.com.
I did this earlier with nested template. You may also try nested/sub template from your main dwt tbb based on schema of component link field component in the loop.
Also I would suggest to use razor templates.
You can iterate through the multi-value field paragraph in the embedded schema field paragraphs as follows:
<!-- TemplateBeginRepeat name="Component.Fields.paragraphs" -->
<h2>##Field.header## (##TemplateRepeatIndex##)</h2>
<!-- TemplateBeginRepeat name="Field.paragraph" -->
<p>##Field##</p>
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
As Vikas previously mentioned, repeating over the multivalued component link field of a multivalued embedded schema field is relatively simple. Your DWT code should follow this form:
<!-- TemplateBeginRepeat name="XML Name of Embedded Schema Fields" -->
<!-- TemplateBeginRepeat name="XML Name of multivalued Component Link field" -->
##Field## - Should write out the TCM ID of your linked component
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
You can not, however, access the fields or schema details of these components with "out of the box" Dreamweaver Templates.
You can:
install the Dreamweaver Get eXtension on your Content Manager server, which will allow you to retrieve fields of linked components (amongst other things) using the ##Get(...)## syntax
Use the "Get Linked Components" .Net TBB from the Generic SDL Tridion 2011 Template Building Blocks before your Dreamweaver Template, which will place the linked components into the templating package so that you can iterate over them directly
Write your own .Net TBB to handle your specific business logic related to these links and output html (not recommended) or a named package item, items or array of items that you can handle from your DWT.
Call another (nested) component template from your DWT with ##RenderComponentPresentation(Field, "tcm:x-xx-32")##
Any combination of the above
Please try using below code:
<!-- TemplateBeginRepeat name="paragraphs" -->
<!-- TemplateBeginRepeat name="Internal_Link" -->
<!-- TemplateBeginIf cond = "Internal_Link != ''" -->
<p> ##Component.ID## </p>
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
To check for zeroth component you can use below code:
<!-- TemplateBeginRepeat name="paragraphs0.Internal_Link" -->
Related
Using the Ghost blog routes.yaml file it is possible to use the collections block to create a custom collection made from some tag(s) and / or other data. You can also tell this collection to use a custom theme template see:
https://docs.ghost.org/tutorials/creating-content-collections/
https://docs.ghost.org/concepts/routing/#content-structure
For instance:
collections:
/example/:
permalink: /example/{slug}/
controller: channel
filter: tag:example-tag
template:
- example
All of the above works and my collection properly uses my new example theme file.
The issue is that unlike the tag page (for example-tag) my new custom collection does not have a readily documented way to work with the title etc.
It does not pull the title / meta description from the tag used to build the collection (which would be great for collections built from single tags). In an attempt to work around that I tried some {{#has}} statements but I can't figure out what context the custom route would fit into.
With the above example routes.yaml the title for the custom collection ends up as 'My Site Name (Page 1)' — and there is no Meta Description.
This issue also extends into the Open Graph data which lists an identical title as well as no description for the custom collection.
My guess is that it may be possible to use a data property attached to the routes.yaml file to achieve this (see: https://docs.ghost.org/concepts/routing/#data) but I haven't found a solution as of now.
While my initial attempts at googling for a solution came up empty, this is the best reference I have seen to the issue:
https://forum.ghost.org/t/dynamic-routing-page-post-data-context-in-default-hbs-nested-navigation-on-custom-collections/4204
https://github.com/TryGhost/Ghost/issues/10082
I found a way to work around.
You create a page called example in the Ghost Admin tool.
Customize routes (instead of collections) in the routes.yaml as following:
routes:
/example/:
controller: channel
filter: tag:example-tag
template: example
data: page.example
The page.example will use the metadata of this page in the Ghost.
This is possible only with workaround described in issue: https://github.com/TryGhost/Ghost/issues/10082
Generally do following:
create page Example (with slug example) and fill metadata title & description you want
in routes.yaml alter your collection definition /example/ add following:data: page.example to link your collection root with specified page
now in your template definition example.hbs you could use e.g. {{#page}} {{content}} {{/page}} tag to insert content from your page. You can do it also in default.hbs template which is included from your example.hbs. So replace: <title>{{meta_title}}</title> in default.hbs with following:
{{#unless page}}
<title>{{meta_title}}</title>
{{else}}
{{#page}}
<title>{{meta_title}}</title>
<meta name="description" content="{{meta_description}}"/>
{{/page}}
{{/unless}}
This will set specific title/description for your collection root pages in general way. It is possible to generate schema.org metadata in the similar way. Unfortunately Facebook and Twitter metadata is not so simple to do because, {{ghost_head}} tag in default.hbs already inserts site metadata to this page. Last note: besides {{meta_title}} and {{meta_description}} I suppose you could use all metadata fields defined here.
In default.hbs I added the following block:
{{{ block "metaTitle"}}}
and eg. in post.hbs I filled that block as follows:
{{!< default}}
<div class="content-area">
<main class="site-main">
{{#post}}
{{#contentFor "metaTitle"}}
<title>{{title}}</title>
{{/contentFor}}
...
For other pages like page.hbs, blog.hbs, author.hbs I did the same. I think that solution is more flexible because we have more control over title value.
I set up a Drupal page, which has two different content-types. One is "articles", one is "reviews".
In my theme folder, I set up two node templates for these content types. node.html.twig (standard template - articles), and node--reviews.html.twig.
When I add an article, node.html.twig is used, when I add a review, node--reviews.html.twig is used.
Now, it's possilbe to have different comments types too. I want to add the standard comment (comment.html.twig) for articles, and a custom comment type to reviews.
In Drupals theme naming documentation it's written, to name a template override like this: comment--node-type.html.twig. So I named my comment template comment--node-reviews.html.twig.
Is there anything else I have to do - apart from clearing the cache?
Because I simply cant get it to run.
Enable Twig Debugging, then you'll get template suggestions printed as HTML comments directly into the markup.
I did that and got the following output:
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'comment__field_my_comment_field__article' -->
<!-- FILE NAME SUGGESTIONS:
* comment--field-my-comment-field--article.html.twig
* comment--field-my-comment-field.html.twig
x comment.html.twig
-->
<!-- BEGIN OUTPUT from 'core/themes/classy/templates/content/comment.html.twig' -->
So, the templates are supposed to be named like the following pattern:
comment--field-name-of-the-comment-field-in-the-content-type--content-type.html.twig
comment--field-name-of-the-comment-field-in-the-content-type.html.twig
I am using event manger plugin.
How to use this code in a custom template file??
{fully_booked}content{/fully_booked}
You have to put your HTML content between the conditional placeholder. For example:
{fully_booked}
<div id="myId">
<p>
There are not tickets available
</p>
</div>
{/fully_booked}
Content will only be displayed if the condition is met, otherwise the whole placeholder will be omitted.
More info in Events Manager Doc
[UPDATED]
You can use it fomr PHP too, but it is a bit different. In the Plugin page you have a tutorial
I'm currently developing a custom search in Alfresco for some custom aspects that I've created . Can you direct me to the correct xml file which I need to edit to add my custom aspects in the search? I have researched numerous posts on the web but I couldn't find anything...
Explain better,
do you mean the default advanced search in Alfresco Explorer?
In that case, you should search for a file named web-client-config-custom.xml.sample inside:
/Alfresco/tomcat/shared/classes/alfresco/extension
or
/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension
Then rename the file removing the sample extension, to have web-client-config-custom.xml and copy the file inside the first path above (the "shared" one, not the webapps/alfresco one);
Then, inside, search for a tag named "config evaluator" Advanced Search, it should be something like this:
<!-- Example of configuring advanced search -->
<!--
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<custom-properties>
<meta-data aspect="app:simpleworkflow" property="app:approveStep" />
</custom-properties>
</advanced-search>
</config>
-->
There, you can add your custom aspects that you created in your customModel.xml file.
To extend the custom advanced search capabilities, you could add some custom content type search or properties that are not part of the aspects, like this:
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
<type name="myNamespace:customType" />
</content-types>
<custom-properties>
<meta-data type="myNamespace:customType" property="myNamespace:customTypeProperty" />
<meta-data aspect="myNamespace:customAspect" property="myNamespace:customAspectProperty" />
</custom-properties>
</advanced-search>
</config>
hope it helps..
I need to alter the output of a view that displays in a in a block in order to apply it to some format of a Jquery UI script so I need the following format for a grouped taxonomy query that I'va configured for some node type..
<div id="tab">
<ul>
<li>Tab1Title</li>
<li>Tab2Title</li>
<li>Tab3Title</li>
</ul>
</div>
<div id="tabs-1">Content2</div>
<div id="tabs-2">Content2</div>
<div id="tabs-3">Content3</div>
You need to create a Style Plugin, and expose it to views 2 API.
A complete style plugin is made up of these components:
An implementation of hook_views_api so Views will load your include
files;
An implementation of hook_views_plugins to declare your style
plugin;
An implementation of the views_plugin_style class;
A theme preprocess function for your style theme;
A theme .tpl.php page.
Here is good reference about extending views 2 with custom modules (from which I taken this component list):
http://groups.drupal.org/node/10129
You need to create your own views style-plugin. Look at views_plugin_style_default.inc in your views module folder.
Then go to Style plugins and find out more about how to implement a style plugin from your own module.
You basically implement the hook_views_style_plugins() and then create your own class that extends views_plugin_style.
Best of luck!