Show Template Source – A Tridion Custom Page

March 15th, 2012 | Posted by Robert Curlette in Tridion | Tridion Custom Page

If you’re like me and you work in a lot of legacy Tridion implementations then there’s a good chance you spend time each week hunting for that 1 line of code to update, burried somewhere in the thousands of lines of VBScript templates. Oh, you don’t have this problem, lucky you! 🙂

Show Template Source Custom Page

I created a very small custom page that loops through 1 folder and displays all the template code to the screen. My folder structure specifies 1 template type per folder and the custom page is setup that way, and it loops through child folders too.  Also – you can pass in any URI of a folder and get back the source. You need to use ‘View Source’ in your browser and then copy the source to your favorite text editor. One tip – wait until the whole page finishes loading – otherwise you’ll not see all the templates.

*Update:  Pages also supported – thanks to Mihai’s suggestion in the comments.

Code highlights

' Show Template
Response.Write template.Content

The Code is hosted on GitHub as a Gist, https://gist.github.com/2044332 and also embedded here:

Enjoy!

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

2 Responses

  • I would also find it interesting if I. Oils see all the templates code used on by a Page.

    So the input to your tool to be a Page instead of a Folder.

  • robert curlette says:

    Thanks for the suggestion Mihai. I updated the code on GitHub and now also supports pages. Just pass in your PageUri to the page parameter. 🙂



Leave a Reply

Your email address will not be published. Required fields are marked *