SDL Tridion Consulting and Solutions
Header image

Show Template Source – A Tridion Custom Page

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



Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">