XPM / UI : Creating new pages based on Page Type with copied components - tridion

I relatively simple question regarding XPM this time. It's about creating Page Type which editors could use to base their new website page on. When defining a Page Type, you can use an exisiting page to enable this as an example page, including its components. You can copy these components to enable editors to edit these freely without tampering with existing pages using these components as well.
On the SDL Live content docs they explain the following:
Change the setting from Include this Component Presentation to
Include a Component Presentation that contains a copy of this
Component. If you use this Component in multiple Component
Presentations on this Page, then saving the Page causes all of those
Component Presentations to have the setting you configured last for
any of those Component Presentations. A number of new controls appear.
This means that whenever an editor clicks 'new page' within XPM, this page type is available and the components that are defined inside it are copied with user-specific prefixes. You can define this inside the page defined as a Page Type itself, by clicking on the component presentations tab, then clicking on a component and selecting Page Type settings. note the following:
As you can see, the copy of the content is being created in 050 - Web - Global, which is, in our blueprint, the wrong publication. However, in the popup you cannot select the correct content location, only the one where the page type is residing.
I've tested this, also with the UI -specific blueprint context settings, where you should define where content and pages are created. However, when creating a new page, the components are copied inside 050 - web - global; the wrong publication. As we're moving to a training, I'd imagine that dynamically created components like this might clog the CMS with content in the wrong location, making it unusable for other publications. Is there a reason for this behaviour, and if so, a way to make this work properly?

If you set the BluePrint Context for Components to the Publication where you want them to be created, it should work as you expect.

Related

How do I tie a Drupal template to a webform with multiple environments?

Disclaimer: I inherited a Drupal 7.44 site with no experience in Drupal at all.
The business is trying to make a new webform and they want it to look exactly like an existing one. After looking around I found that the webform has a template tied to it. From the docs it seems I'm supposed to create more template files with the format webform-form-[nid].tpl.php where [nid] is the webform node id.
We have multiple environments that all changes must go through - dev, test, and finally prod. Wouldn't the node id be different in every environment for newly created webforms? Also, if I want to apply the same template to multiple webforms, do I really need to make multiple identical template files?
I also found some CSS styling for the existing webform and it looks like .webform-client-form-25 button.webform-submit and such. That 25 is the node id. I have little CSS experience, but this feels really bad. I don't want to copy blocks of CSS, changing node ids over and over. What's the proper way to assign generic, reusable CSS classes to webforms? I saw "Custom classes" under "Manage Display" when editing the form, but it didn't seem to change the actual HTML of the form. Was I on the right track though, should I just read some docs about it?
You are absolutely right, these detailed selectors do not make sense for reusable layouts.
Each webform HTML form gets a default class of .webform-client-form (that's generic) and an id including the webform's nid #webform-client-form-<nid>.
So, you could change #webform-client-form-25 to the class mentioned above. Please be aware, that this will affect all webforms then.
To set layout settings to several, but not all webforms, you need to give these webforms some class to distinguish them from the rest. Sadly, the Webform module itself doesn't provide an option to do that, but you can add a form alter hook in your theme's template.php:
function mytheme_form_alter(&$form, &$form_state, $form_id) {
$affected_forms = array('webform_client_form_25', 'webform_client_form_37', [...]);
if (in_array($form_id, $affected_forms)) {
$form['#attributes']['class'][] = 'my-custom-class';
}
}
With .my-custom-class you can then define CSS just for the group of webform forms listed in $affected_forms.
As for the template files, Webform itself states:
This file may be renamed "webform-form-[nid].tpl.php" to target a specific webform on your site. Or you can leave it "webform-form.tpl.php" to affect all webforms on your site.
So, again, it doesn't provide an option out-of-the-box, but you can create theme suggestions in your template.php by extending $vars['theme_hook_suggestions'] in a page preprocess function.

Creating custom layouts for Images in page content TYPO3 6

Typo3 provides option to add multiple images to a page content, but all the images are wrapped under some default <div> tags. I want these images to be wrapped under <ul> and <li> tags instead and giving my own custom CSS ids and classes to it.
There are not many resources on TYPO3 for me to approach this issue. Can TYPO3 allow to use custom tags for the page content elements?
UPDATE
From Jost's answer was able to get my images displayed, but how do I split the image details?
My each image will have title, alt-text, image-path and image-link. Now, using TypoScript how do I retrieve this, because each details has to go in separate tags.
Check the TypoScript object browser. There you will find the object tt_content, which contains the rendering definitions for content elements. The rendering definition for images is found at tt_content.image.20, for example
tt_content.image.20.imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap" style="width:{register:totalwidth}px;"> | </div>
The default definitions given there are usually provided by the static TypoScript of CSS-styled-content. You can overwrite them in your own TS, but when updating to a newer TYPO3-version, the default template may change, which could result in additional wrappers.
Update
Most content rendering in TYPO3 is defined in the TypoScript object tt_content. You can browse all TS-objects that will be used on a page by selecting the "Template" module and the page in question, and then choose "TypoScript Object Browser" in the selectbox at the top of the window. To understand what that stuff means, knowledge of TypoScript is necessary (Tutorial, Reference).
You can add your own TypoScript, which may override existing settings. You can do that in the Template-module too, but usually this is done by creating a file containing the script somewhere in the fileadmin folder and including it from the Template module.
The above enables you to edit the markup of the page. (Additional) CSS is usually defined in external files, that are included by a PAGE object (see the reference about that).
This post is a bit older but I want to add the following:
If you want to understand how the different content elements are wrapped, you may have a look into the css_styled_content extension. I assume that you have included the "Static Template (from extension)" in your main Typoscript template.
You can find the setup.txt here:
typo3/sysext/css_styled_content/static/setup.txt
There you´ll find the line Jost mentioned in line 860 (TYPO3 version 6.1), for example. And of course a lot of other definitions, too.
But check to read the documentation and tutorials on typo3.org.
HTH
merzilla

How to customize dexterity-through-the-web-content view?

I created a content in my Plone 4.3 site (no grok here) with the very nice Dexterity through-the-web editor. Now I'd like to customize the default view for this content.
I've read Martn Aspelli's book but the problem is that through-the-web content does'nt have a specific interface (so I can't use it to create my specific view).
If you want to do this all through-the-web, then do the following:
Create a template for your view in the "custom" folder of
portal_skins (through the ZMI). You'll probably want to start with a
copy of something like the page template
(portal_skins/plone_content/document_view). Give it a name like
your_content_type_view. Test it by appending /your_content_type_view
to the URL for a sample object.
Edit the Factory Type Information (portal_types/your_content_type/Default
view method) to be your_content_type_view.
What you will have done is create a skin-level view for the type. This is different from the browser views that Martin is discussing, which do indeed require a class. The Dexterity development team is working on a way to provide TTW maintenance of browser views, but that's for a later version of Plone.
Meanwhile, if you later transfer your Dexterity content type to a Python add on, you'll be able to use your template, possibly unmodified for a browser view.

How do I use Google Analytics with Sitecore 6?

I know that I need to add the tracking code snippet at the bottom of all my pages, but is there a central location to do this?
Or do I need to add this tracking code to all of my templates?
I guess that I could wrap the snippet in a user control, or external .js file, and reference it on each page, but is there a global footer somewhere? The site I'm working on has about 30-40 layouts, and adding it to each one would be a pain!
Thanks in advance!
Actually, the role of a Sitecore layout is exactly this; to act as a global file that all individual page templates "derive" from.
Normally you'd stick the analytics code into the master layout, and use Sitecore sublayout/placeholder techniques to construct the various page templates you need. You would not normally need more than perhaps one or two layouts for any device you are serving content to. And I guess for most sites, the only device in use is regular web content delivery.
That being said, what you could do, is have all the layouts inherit their codebase from a common base class (inheriting from Page), and inject the google code centrally from here. Would still require you to go through all layout files however.
I have not tried the module, I think that is codebehind version. I have made this in XSLT, its pretty fast and easy to make. I have footer.xslt where I put the code that simply checks if page you are standing on uses template that I want to index and does not belong to page names that I want to exclude. Then I have an item with a custom template for Google Analytics with following memo fields.
IncludeTemplates -field contains list of templates that I want to include for analytics :
ExcludeItemsNames -field for excluding pages by item name
contains($includeTemplates, concat('|',./#template,'|')) and not(contains($excludeItemNames, concat('|',./#template,'|')))
Remember #key and #template is always in small letters
If you run many domains don't forget to add pageTracker._setDomainName("www.example.com"); in analytics script so you can separate sub-domains etc. if they use same footer.xslt
Normally we consider the actual Google code as content. Within Sitecore we normally have a settings folder, something like /sitecore/content/settings. This exists outside the root of the site. Beneath this have a settings item with a plain multi-line text field, I think the field type is memo or something similar.
Afterwards create an XSLT that renders out the content of this settings item. Something like (assuming the field is called value in the setting item):
<xsl:value-of select="sc:fld('Value','/sitecore/content/settings/footerJavaScript')" />
You may or may not need to set the disable-output-escaping attribute.
Then on the aspx page that your pages use as the template add a control that looks at the xslt rendering:
<sc:XslFile runat="server" Path="/xsl/footerJavaScript" />
The reason that we normally keep the javascript as content is this allows the client to change the analytics code without having to contact us.

Sharepoint: Custom SiteMapProvider for custom list

I need to customise the title property for SiteMapNodes.
I am using WSS, and have created a custom document library. While navigating through this library I want to change the names of the nodes in the breadcrumb displayed above the list name.
So far I have:
created a class inheriting from
System.Web.SiteMapProvider,
added my class to the web.config,
changed the sharepoint
default.master page sitemappath (in
PlaceHolderTitleBreadcrumb) to point
to my new site map provider.
I then overwrote the CurrentNode property to edit the CurrentNode.title with the desired name.
My problem is all the previous nodes (parent nodes) revert back to their original names. How do I edit the breadcrumb so that all the nodes navigated through keep their new title?
Any advice or direction would be appreciated.
The way I've done this before isn't by creating a new SiteMapProvider, but by replacing the sealed SharePoint AspMenu control with MossMenu (the same as AspMenu but open sourced by the SharePoint team). I then overrode OnMenuItemDataBound with the behaviour I needed.
If you need/prefer to use SiteMapProvider, have you tried using Reflector or the new .NET Framework debugging support to see how it works? There must be somewhere in the SiteMapProvider code where your overridden changes are, in turn, also being overridden. :-)

Resources