Can I publish component presentation without adding it to a page? The answer seems to be yes. I have a component that is not on any pages. I published just that component and the component presentation ended up at my destination, but where is the component picking up the template? Is it picking it up via the LinkedSchema tab in the template? I did link the schema used for the component to a template.
Thanks
You guessed right. A component is published as a dynamic component presentation (so without a page) if there are one or more component templates that are:
a. linked to the schema the component is based on
b. marked as 'publish as a dynamic component'
Yes, that's right. When you create a component template, you specify the linked schemas which can use this template. Publishing a component with out adding to a page is called dynamic component presentation. In component template general tab, you could specify this as "Published as dynamic component" for the field component presentations based on this template. If you have value as "Publish embedded on a page", your component presentation is static meaning you have to associate this component with page to get it published. Dynamic component presentations makes use of content broker database to query the data and to display it in website. However components embedded on a page would be static and would be served from file system (instead of database). Hope it helps!
Related
Let suppose that in Magnolia's Page application you have few pages with instances of component "A" which have property dialog. These pages are published to Public server.
later you decide to change structure of this properties (add fields or for example change image field to array of images)
to do so you would modify component's dialog yaml file (add/modify fields) and component's template ftl file to render these changes
Question: - will this destroy previously created pages with instances of component "A"? i.e. if you need to modify component's properties it's better to create new component instead of modify existing?
It's fine to modify existing component, as long as you take care of the fact that existing instances will not have any values for newly added properties/fields. So in template you need to expect that you might get empty values and provide good defaults to cover that case. So technically, you can modify the component just fine.
Whether it is better to create new component or modify existing one depends more on the business needs. Is it desired pages to see new component look & get new fields in pages that already use the component or are those changes relevant just for new pages in which component will be used?
Another consideration is the more components you have, the harder it would be for editor to pick the right one from the ever growing list. However the more functionality you cram into single component, the more complex and difficult to test it would become and harder it would be to replace it with something else in the future.
I am using Magnolia CMS 5.3.4, the STK, and freemarker (FTL) template scripts.
Some components I have defined relies on specific javascript files. Right now, what I do is that I include these javascript files in the main.ftl template script. I am looking for a way to get them included only if the specific component is present on the page.
I tried to use the jsFiles property in Template Definitions, but it seems it works only for page template definition.
The jsFiles property indeed works only for pages not for components. This is because Magnolia wants to include those files in header already, rather than loading them in middle of the body when component gets rendered.
As a general practice I would anyway recommend combining your js files into one (look at for example plugin loader in resources on how this is done) and set longer time for caching such file so that browser downloads all the script just once for the whole site rather then page by page. The bigger js file you are sending over the more overhead you are cutting off from requesting separate files and better the compression of content for transport will work.
HTH,
Jan
I'm currently working with magnolia cms 5 and I know how to import xml templates. Now I need to import html5 page template, just I did not find how in documentation, and I do not belive it is impossible.
You have multiple options to achieve what you want.
If you want editors to be able to edit content of the page, you need to put html in FTL file (that you can put on class path or create on the fly in STK/Templates) and replace editable parts with markup to be filled from the user input. You would also need to create template definition, make template available to editors and create dialog. See Creating Magnolia Page Template for more details
If this html is static and not editable by users, you can still put it in FTL or you can place it in /docroot/ folder to make it available under http://your-magnolia/docroot/your-webpage.html url.
If you have magnolia module already, you can also place that html in mgnl-resources folder in your module and have it accessible via http://your-magnolia/.resources/your-webpage.html
You can also go to STK/Resources and upload your page there and have it accessible under http://your-magnolia/resources/your-webpage.html
HTH,
Jan
When you clone a default component in the libs folder to your apps one, it's supposed to override the former, but for me it's duplicating the component's options in the sidekick.
I made a duplicate of libs/foundation/components/parsys/ and moved it to apps/-site-/components/content so that I could add functionality to it. However, when I view the Columns component in the sidekick (which is the /parsys/colctrl/ component) it duplicates my options. I now have "Two Columns", "Three Columns", and "Column Control" list twice.
Ideas?
To override the stock component (instead of create a new component with the same functionality) you have to have the same path but with /apps instead of /libs
Example for parsys - copy it from
/libs/foundation/components/parsys
to
/apps/foundation/components/parsys
An even better way is to create a new component at /apps/foundation/components/parsys and only override the parts you want to change.
If you change the path, you're basically creating a new component - CQ5 has no way of associating the two. It works on a path basis to overlay the /apps on top of /libs.
Hope this helps,
Antony
You will want to use the sidekick's Design Mode to remove the foundation components from the list of candidate components for your pages. See Gabriel Walt's answer to this question: Adobe CQ5's sidekick is empty (no components shown).
Since you've duplicated the component it shows up twice in sidekick -- but you can add the duplicate to a different component group other than "general". In the .content.xml file for the component add componentGroup="Your Component Group" and your component will then show up there; the original will still show in the general component group.
How to take an existing custom component in Flex and convert it into a module?
EDIT: What should be done in the mxml where this custom component is used? Should it be replaced with a to load the module? If yes, how to deal with code that uses instances of the components?
Change the root mxml tag to <mx:Module... then in the properties of the project click on the "Flex Modules" button and add it in there.
Edit: This is assuming your modules are in the same project. I prefer to create new projects per module as it makes development easier with multiple developers. So what I do is create a new project, change the root to <mx:Module..., in the properties of the module project I disable it from creating the html wrapper, then in my main project I just load up the module swf's based on what menu item was clicked
You would need to place a ModuleLoader in place of the custom component like
<mx:ModuleLoader id="moduleLoader" width="100%" height="100%"/>
And load the Module using the url.
moduleLoader.unloadModule();
moduleLoader.url = "path\to\module.swf";
moduleLoader.loadModule();
You can keep the above code in a function and load modules.
If your module will be used in the same project only, you can create a new MXML Module that can be optimized for the project from FlexBuilder