Get StructureGroup ID in Dreamweaver

12

I was wondering if this is possible? Have tried following cases:

Page.OrganizationalItem.ID @@Page.OrganizationalItem.ID@@
Page.Context.OrganizationalItem.ID @@Page.Context.OrganizationalItem.ID@@
Page.StructureGroup.ID @@Page.StructureGroup.ID@@
Page.OrganizationalItem @@Page.OrganizationalItem@@
Page.StructureGroup @@Page.StructureGroup@@
Page.Context @@Page.Context@@
Page.Context.ID @@Page.Context.ID@@

Haven't got any values from examples above. Do I need to develop C# functionality for this or exist any other DWT way to read SG ID field.

Bogdan Stojanovic

Posted 2013-03-22T09:34:55.810

Reputation: 490

Hi Bogdan, did you resolve your problem? If you have solved the problem using one of the approaches provided in an answer, please accept that answer so that others can see easily what approach was taken. – Ant P – 2013-03-28T09:08:41.863

Answers

10

Alternatively to using the Dreamweaver Get Extension, you could retrieve this information with the use of a C# TBB. Something along the lines of the following should work (assuming this is a page template):

Item p = package.GetByType(ContentType.Page) as Page;
if (p != null)
{
    Page page = engine.GetObject(p.GetValue("ID")) as Page;

    if (page != null)
    {
        StructureGroup sg = page.OrganizationalItem as StructureGroup;
        package.PushItem("structureGroupId",
            package.CreateStringItem(ContentType.Text, sg.Id));
    }
}

If you're in a Component Presentation, you can use the following instead:

Page page = engine.PublishingContext.RenderContext.ContextItem as Page;

You can then simply use @@structureGroupId@@ within your DWT.

Ant P

Posted 2013-03-22T09:34:55.810

Reputation: 1 909

Thanks for suggestion. As usual we can use C# for almost everything. Just wondering if it is possible to get these property using DW command. – Bogdan Stojanovic – 2013-03-23T16:32:58.173

In that case, as detailed in other answers, you'll need the Get eXtension or a custom function. – Ant P – 2013-03-24T10:04:25.533

13

You need the Dreamweaver Get Extension for this. Check it out on https://sdltridionworld.com/community/extension_overview/dreamweaver_get_extension.aspx.

Quirijn

Posted 2013-03-22T09:34:55.810

Reputation: 4 351

As suggested above, you should use Dreamweaver Get Extension or DWT Extension for this. Just keep few things in mind: 1) You need to register this in GAC on CMS server and for use the correct GacUtil.exe as GacUtil depends on .Net Framework and if you use a wrong GacUtil, you will still see a success for Registration but still you would not be able to load the DWT extension 2) You MAY need to restart you Tridion Services, COM+ and may be IIS as well – Pankaj Gaur – 2013-03-22T12:26:08.167