Sunday 15 February 2015

sitecore - how to manage presentation details for multiple pages in single place -



sitecore - how to manage presentation details for multiple pages in single place -

i have next item construction in sitecore:

root (tab 1)tab 2tab 3tab 4

items can accessed urls:

/root/root/tab-2/root/tab-3/root/tab-4

this items renders tabs user , user can click tab , switch other tab. on /root first tab active.

items have few placeholders: header, footer, content, aside, , tab.

all items have render same controls placeholders except "tab" placeholder. tab placeholder have different controls, see different things on each tab.

easy solution inquire client edit controls on items. instance if want's add together image above tabs, have add together image on items: root, tab 2, tab 3, tab 4.

but need solution this, client edit controls in 1 place. have separate controls each tab.

update:

i using ajax request switching tabs, regular request should work tabs , urls tabs should above. of course of study can specify initial set of controls on _standard values template, when editor alter within page editor should reflect on tabs.

so far come next solution (but editing in page editor in not working tabs root one):

i crated processor within pipeline (after: sitecore.pipelines.insertrenderings.processors.getitem):

class="lang-cs prettyprint-override">public class setroottabascontextitem : insertrenderingsprocessor { /// <summary> /// processes specified args. /// </summary> /// <param name="args">the argumentss.</param> public override void process(insertrenderingsargs args) { assert.argumentnotnull(args, "args"); var contextitem = context.item; if (contextitem.isinsideroottab()) { args.contextitem = context.item.getroottabitem(); } } }

i created additional placeholders tabs: tab_1, tab_2, tab_3. within tab placeholder there sublayout has additional placeholders in displaying placeholder should visible on specific tab.

so tab's presentation details configured on root tab. processor created controls root tab rendered on tabs.

but sadly page editor working on root tab. when i'm trying add together command page editor when i'm on not root tab, i'm getting javascrip error, null reference.

another alternative utilize jquery/javascript based tab plugin (something jquery ui tabs). in "root" item add together tab control, renders required html markup (to match spec of javascript tab plugin).

the tab command should @ it's datasource value or if not set iterate on it's own children specific template. need decide best placed. in global shared folder, straight beneath content item (putting in folder in case there sub-navigation number page)... both have advantages , disadvantages, comes downwards design selection based on requirements , preference.

your url's change, using hashes instead of specific paths end result same. can see illustration of on tab page linked to.

/root /root#tab-2 /root#tab-3 /root#tab-4

so rest of page same. also, advantage of there no page reload in order show content.

remember design component page editor in mind, javascript plays little bit of funkiness additional markup sitecore injects in, can detect page mode in javascript.

edit:

personally not bother ajax load unless there big amounts of info nowadays in tabs, call.

an alternative insert processor after itemresolver, checks if current request tab template. if so, set context.item parent. can switch right tab using javascript extract lastly part of current url (which should same tab id). if utilize right controls , set item on correctly pageeditor should work.

it get's tricky if need ajax load tab data, since request tab url redirect user (essentially). pass additional parameter in ajax call, ?request=ajax or check request type. processor skip it's logic , homecoming tab content instead. of course of study not work in pageeditor, instead need add together logic sublayout check if page in editing mode fall not using ajax.

sitecore sitecore7.2

No comments:

Post a Comment