0

I realize this might be slightly counter intuitive... but in a compound component template, is there a convenient way to access the Page object or the TCM URI of the page being rendered? I realize the result might be null if the component template is being rendered into broker or being debugged using the template builder. But I would like to get the page id if it is available.

Chris Summers
  • 10,153
  • 1
  • 21
  • 46
DaveBeta
  • 447
  • 1
  • 5
  • 11
  • 1
    Can I invite you to post this question on the Tridion-related Q&A site? http://tridion.stackexchange.com – Nuno Linhares Jun 04 '13 at 17:47
  • 1
    possible duplicate of [Access container page of a component in .net based CT](http://stackoverflow.com/questions/12562360/access-container-page-of-a-component-in-net-based-ct) – Nuno Linhares Jun 04 '13 at 17:50

2 Answers2

2

Yes, you can create a TBB to do this. If you look on sdltridionworld.com there are Generic SDL Tridion 2011 Template Building Blocks available: https://sdltridionworld.com/community/2011_extensions/generic-2011-tbbs.aspx

In there there is a handly file called TemplateBase with a method called GetPage. You can use it to get the page in a TBB and then push the Page ID to the package.

Nickoli Roussakov
  • 3,434
  • 16
  • 22
2

This is also covered (for a C# TBB) in this Stack Exchange question: https://tridion.stackexchange.com/questions/743/accessing-page-object-in-c-tbb-used-in-the-component-template

Community
  • 1
  • 1
Jonathan Williams
  • 2,015
  • 1
  • 19
  • 23