Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all the item that is using a common Sublayout in sitecore 6.2.0

Tags:

sitecore

Is it possible to obtain a list of all the items in sitecore that is using common sublayout or XSLT's in presentation tab for rendering i.e. suppose there is sublayout called layout1.ascx that is being used by 5 items.is it possible to obtain the list of all these 5 items by search method.

Thanks in advance.

Regards, Divya

like image 798
user166013 Avatar asked Apr 12 '12 06:04

user166013


2 Answers

You probably need to do this in two steps (or one if it's only 1 template).

You need to use the Link database.

The simplest way of seeing these "links" is to go to the Sublayout or Rendering and go to the "Navigation" menu and then click on "Links". This should show you all the items that point to this current item and all the items that the current items points to (ie. both ways).

This will probably give you a list of templates and/or items (if the sublayout is set directly on an item).

Then go to a template and see how do the same to see which items are have a refernce to the template.

This should show you which items are using which sublayouts.

Of course this requires the Link database is up to do (should be done automatically, but you can force this with Start > Control Panel > Databases > Rebuild Link Database) and that the Sublayouts etc are bound in Sitecore..

I hope this helps.

like image 57
Holger Avatar answered Nov 23 '22 18:11

Holger


The Link database suggestion is great, but if your sublayout is used by hundreds of items, it may take a little while to load.

Another alternative is this fast query:

fast://*[@__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%' or @__Final Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']

This can be run in the developer center, under Tools > XPath Builder (or for Sitecore 8.x the XPath Builder can be found at /sitecore/shell/default.aspx?xmlcontrol=IDE.XPath.Builder).

Sitecore 9.x no longer supports the XPath Builder, but you can still run this if you install the Sitecore PowerShell Extensions.

The following command can be run:

Get-Item -Path "master:" -Query "fast://*[@__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%' or @__Final Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']"

Change the guid above as needed.

like image 25
James Skemp Avatar answered Nov 23 '22 18:11

James Skemp