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.

1
  • 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
    Mar 28, 2013 at 9:08

2 Answers 2

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.

2
  • 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. Mar 23, 2013 at 16:32
  • In that case, as detailed in other answers, you'll need the Get eXtension or a custom function.
    – Ant P
    Mar 24, 2013 at 10:04
13

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

1
  • 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 Mar 22, 2013 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.