AEM/CQ5 how to share component values? - aem

I want to have a header component that is shared across multiple page rendering components. The header component has a text label. How do I make the value of this text label available to all page components.
Do I have to make the path in the <cq:include> to a common format?

Design mode, if properly understood, can work quite well. However, it doesn't replicate content in the same manner as page activation, and thus can be confusing for your authors. Also, the sharing model is limited to the exact page type - which may or may not be the granularity you desire.
From CQ5's Best Practices (https://dev.day.com/docs/en/cq/current/developing/developing_guidelines_bestpractices.html), they strongly encourage the paragraph system (iparsys to inherit/share). iparsys named the same can be shared across different page templates (while design mode will only apply to a single template type).

I can archive that by creating a design dialog that is similar to dialog (http://dev.day.com/docs/en/cq/5-6/developing/components.html#Dialogs) under the header component. You add the text label field to design dialog. And to enter value for the field, you switch the page to the design mode and click on Edit button on the top of the component. The entered value will be available to all pages that contain the header component.
Note: design dialog will be named as design_dialog

This functionality is now offered in ACS AEM Commons as Shared Component Properties - http://adobe-consulting-services.github.io/acs-aem-commons/features/shared-component-properties.html
Supports standard content activation and internationalization (values stored below the homepage) and anything else you would expect from content.

If the component is baked in the template(i,e page rendering component), yes you can make the <cq:include> path attribute to point to some common place where the data for this is stored and all the pages irrespective of , type of the template can get the values configured.

You can create header component and then include it using <cq:include> in base template/page. This base template/page will be inherited by all other templates. This way the header once configured in base page is availble through out different templates/page components.

If the goal is to share "across multiple page rendering components" the design dialog will only help if the page share the same rendering component.
If you want to have the header component displayed in a page and all its subpages, then you should use iparsys.
If you just want to reuse the properties of that header component, then it needs to have a fixed path (cq:include in a page component) and then you can reference the properties you need in other page rendering components. I would not suggest that approach since it breaks the idea of having a component. Everything becomes tightly coupled.
What you could also do is save those properties at the page level (some top parent page) and then use InheritanceValueMap in the subpages to read those properties.

Related

Copy presentation details and data from a page to a placeholder of another page on the fly in sitecore 8.1

I have a requirement from my customer where I need to make the footer of the website dynamic in terms of adding sublayouts in footer placeholders via page editor by the Content Author.
The footer shall consist of:
One content slot - to which any sublayout/sublayouts like grid component or rich text can be added.
I want to add a new placeholder 'ContentSlotPH' to my footer which picks up its presentation details and data from a common page at "/sitecore/Content/Common/Footers/FooterContent/" ( where I have added my sublayouts like grid/richtext for the footer); and shall apply to all the pages of the website where the footer is present.
I want this change to be visible on the fly so that in future if the presentation details on FooterContent page change, new presentation and data gets applied to the ContentSlotPH of the footer.
Can someone help me in implementing this?
This functionality is not available out of the box unfortunately, the only way to achieve it with standard features (as Anton mentions in the comments) is to set them as presentation details on the standard values of a base template.
Unfortunately, this is not user friendly or editable through the Experience Editor (out of the box). It would also mean giving Content Editors write access to the templates and standard values, something that is normally locked down since making a mistake could cause exceptions especially on a production system.
Instead you could look to utilise Sitecore Placeholder Fallback. This will allow you to set up the headers/footers on a top level page and then any children will fallback to use the renderings in the placeholder from a parent item if they have not been set.
We have tried to approach this problem by using components that have presentation details on them. We call these Content Blocks, but other accelerators have different names for them with similar functionality. Essentially, this becomes a 'page inside a page'. You add your component to the template and reference a central datasource which has your footer datasource (including presentation details).
This allows for authors to have access to edit the footer by editing the footer component datasource without accessing template details.
Check out my Sitecore Base Layouts project:
http://www.awareweb.com/resources/video?vid=7d52fef2a67c453fa38dd092bd9ae7e2&
https://github.com/BenGGolden/Sitecore.BaseLayouts

Binding to custom built control according to different data

Here's the issue, I build a special book reader/browser (For holy quran), my code behind loads the page and constructs how it should look. and then it should bind that look to a some kind of data-bindable custom control to view it properly. the problem is, the look differs from page to page, so I cannot bind to a certain control or wrap panel.
here's how it generally looks:
The decorative border top of the page is always there at any page, it indicates the part and chapter the viewer is in.
If you're starting a new chapter it have additional image under that decorative border or anywhere in the page (there can be multiple chapters in the same page) something like this
or this:
The normal text is not an issue, it's just a special font, however, I put each individual word in its own text block for reasons of user selection by word.
The issue here is, given the previous information, and knowing how random it is to place the decoration picture or the amount of words (text blocks) per page. how can I bind that to some kind of view to separate the view from the VM and Engine that builds the page.
my past solution was to actually build everything in the VM in a wrappanel built inside a scrollviewer having lots of textblocks and images according to the page. but that's naiive solution. I want to rebuild that in a more professional separated way. I also want to do this for Windows RT beside Windows phone so I need to reuse the code behind in a Portable class library.
I think all you need to do is slightly adjust your current design. So perhaps have a VM that represents the entire content, and that would have a Collection of say Pages or Sections. A second VM would represent the Page/Section, allowing you to create a property for the WrapPanel content (i.e. the words) and another property for the Header and or other things.
In the View you would have the scrollviewer and bind to the main VM collection. Then create another View or DataTemplate that represents the Page/Section.
You should be able to do this is a strict MVVM sense quite easily and it will be dynamic based on the content.
You could even cater for advanced scenarios where each section has a different template/view.

How to create some custom box into a Typo3 web page?

I am very new in Typo3 world (I came from Joomla and WordPress) and I have some doubts related a thing that has been requested by a customer that use Typo3 for its site
He ask me to create some colored boxes into a specific page. Each of these boxes simply must contain text or links.
How can I do this?
I am thinking that I can solve in the following way (but I have not idea if this is a GOOD solution):
In the backend I go in the Page section and I open the settings related to the page that I have to modify
Here I have 3 columns (Left, Normal, Right) and for example I add a NEW Regular Text Element into this central column
Now appear to me the wysiwyg editor, so I click on the Toggle text mode icon and I pass from the wysiwyg mode to the pure HTML editor's mode and now I will create some div tags (settings the CSS settings for the background color and the dimension) that rappresent my boxes (and into these div I put their textual contents).
Is it a possible solution or is it a bad solution?
Tnx
Andrea
You may either use the RTE typoscript config to add some new paragraph styles, which will make the boxes or use the section_frame field in tt_content, a field called "frame" in the backend when you edit a content record. Both solutions would just need some typoscript (which you will deal with very often in the TYPO3 world) and CSS code.
If you need some more structure in the backend, there is also an extension for that called multicolumn. If you just need "more" columns in the backend (in combination with backend layouts) to achieve different looks, this can also be done by adding some typoscript config. To give you a more precise recommendation, some sort of scribble or design screenshot of what you want would be nice.

Component without a dialog won't display in Sidekick

If a component is created, but a dialog.xml file isn't included within it, it will not show as available within the Sidekick, even if enabled in Design mode, and with a Component Group specified — why is this?
If you add a cq:editConfig node to the component it will show up in the sidekick, after being enabled in the design dialog of the parsys, without having a dialog.
As reference: http://dev.day.com/docs/en/cq/5-3/developing/components.html#Components and their structure
dialog boxes are meant for dynamically adding content to the components.
if there is no dialog box in a component there is no reason for component to display in sidekick .
u can directly hard code the component like this.
<cq:include path="par0" resourceType="/apps/...." />
Have you gone into the design portion to allow your component? I've often created a new component, and been unable to add it simply because I forgot to allow it in the design mode on that page.
EDIT
Good point - I do believe a dialog.xml file is required for it to show up in the sidekick. Otherwise you have to hard code the include of your component where you need it. I would suggest adding a dialog.xml file, even if it is only for the reason of showing it in the sidekick, so you can add it dynamically to different pages.

Sitecore - how to persist a Layout change

I developed a Sitecore control I'd like to put into a layout on one page.
In this case it's a registration page, and my control is defined as a sublayout.
What I did is went into the Page Editor interface, and plonked the control into one of the placeholders.
What I want to do now is to create a package only containing the information that this control is on this particular page, without affecting e.g. the content or subitems of this node.
Can you please advise on the best way to create such packag, what exactly to select in the Package Designer?
Thanks
I don't believe the Package Designer gives you granular control to include just specific fields of an item. You need to add the item as whole.
You should configure layouts and renderings in the presentation details of an item OR even better in the __Standard Values of the template.
You can call the presentation details dialog through the content editor. Just select an item in the content tree, click on the Presentation tab in the top ribbon and select Details. You can configure all layouts/renderings for the selected item here.
But ff you want to prevent content changes you really SHOULD configure the presentation in the __Standard Values of the template. This is also the way, which is recommended by Sitecore. If you do this, the layouts are all you have to put into a package.