Coming from a mixed content delivery (ASP.NET) and business analyst background, I've been interested in the same type of resources. I've typically followed the Tridion community, asked questions, and shared what I've learned.
Here are some posts I've shared along with my favorite public sources that explain approaches and include much appreciated context ...
Jamie has included some great suggestions. All of which I recommend over this one, but most people don't realize that there is limited string manipiulation possible using JScript functions (i.e. substring and indexOf) within DWT TBBs. So this is possible:
The Tridion practice project is explicitly aimed at gathering together good examples of different areas of Tridion practice. In the cookbook section, there's an entire "chapter" about compound templating. Maybe this can become an even better resource if more people are aware of it and help with their own contributions. (It's Free... under an MIT license.)
Siva answered how you check for inequality, but I'll chime in how to check for existence.
The equivalent of String.IsNullOrEmpty(Component.Key) would probably be
<!-- TemplateBeginIf cond="Component.Key" -->
This condition will only pass if Component.Key exists and it has a value.
People often use that construct to ensure that a field exists/has a ...
Well... if Tridion had the resources (and following) of Microsoft, I'm sure you would have such books. Since Tridion/SDL doesn't have those resources, we have to be creative and (maybe) write one ourselves.
The best start is probably to go through the CHMs (available for download here - login required), not everything is fully documented but it is improving ...
You are doing the correct thing by adding addAnchor="true" if you want to link to a specific ComponentPresentation on the target Page. You can achieve this by adding tridion:anchor="true" to your anchor in your DWT.
I am not sure why you think that the #1, #2 or #3 are wrong. These are links to the OrdinalPosition of the target Component on the Page.
I am going to make my answer a little broader than DWTs/c# TBBs and instead address the wider availability of study materials for Tridion 2011.
As Nuno mentioned, there are not any books like the Wrox Professional series of books on .net for SDL Tridion.
However, in addition to the documentation on SDL Live Content Nunos has linked to in his answer, there ...
Depending on what the use case is, there are several approaches, for example, do you want to apply this behaviour to all the email addresses in the output? is it in a specific situation?
If it is the first case (apply to all email addresses) you can achieve that by implementing a C# TBB that "finds" all the email addresses (with a regular expression for ...
It's only a checkbox when displayed in the CME.
Basically it's a field like any other, so you can just check for the actual value.
Something like this should work:
<!-- TemplateBeginIf cond="MyField='MyValue'" -->
<!-- TemplateEndIf -->
Your solution seems fine, except for the hardcoding of the CT's TCM ID. So it sounds like you need a way to reference the component template without hardcoding the TCM ID. Have a look at the comments in the answer here: https://stackoverflow.com/a/10802912/1284894
The solutions discussed are to:
add a Parameter schema on the DWT TBB that specifies the ...
This is absolutely possible and in your case it is not working because the syntax that you have used is incorrect:
You should have written your code as
<!-- TemplateBeginIf cond="'title'=='title'" -->
<!-- TemplateBeginIf cond="'title' == 'title'" -->
Mind the space before and after the equal operator.
Also, consider the ...
The code inside the <!-- TemplateBeginRepeat --> has context... Just test your value as such.
Also, you need an "is equal to" operator, rather than an "equals" I think ;)
The following works for me...
<!-- TemplateBeginRepeat name="OffersText" -->
<!-- TemplateBeginIf cond="Select == 'Offer A'" -->
<div class="col-sm-3 ...
You can use HTML comments:
<!-- My HTML comment -->
Then write a TBB strip them out; though no need for custom syntax unless you want to differentiate between your DWT logic comments and actual HTML comments that you want to keep.
I think the best way to do it is to add a C# Fragment or .NET TBB to calculate the number of elements you will be rendering in your DWT and push it in a Package Variable so that you can access it.
<span>1</span> of <span> @@NumberOfElements@@ </span>
This is not possible via DWT. The 'name' value of TemplateBeginRepeat cannot be evaluated. You can write another TBB that loops through the package finding your comp1, comp2 and etc and rendering each component.
You can also use @@RenderComponentPresentation(compID, templateID)@@ inside your top-level CT and avoid relying on GetLinkedComponents.
It retrieves the first item named Component from the top of the stack. Most likely your "Working" Component is the last one pushed onto the stack and therefore that one is retrieved. If you try swapping around the order of the Components, then you'll end up with and error.
When you say creating
your own syntax for this
... do you simply mean pre-fixing/wrapping the HTML comments with some sort of 'strip-me' identifier ... to allow some HTML comments to still push through?
<!-- this comment will make it through -->
<!-- debug:this is an internal comment and will be stripped on LIVE publishing -->
I quite ...
The easiest way is to modify the Tridion Page Template(s) to include something like this in your Dreamweaver Template Building Block:
<!-- PageId: @@Page.Id@@ -->
At publish time Tridion will resolve Page.Id to the current page's ID and output something along these lines:
<!-- PageId: tcm:123-123-64 -->
If you're not using Dreamweaver ...
To my knowledge the Tridion provided custom controls don't support either custom anchors or query string elements for component links; you will either have to resort to using inline code to resolve component links (and add the anchor/query string there) or create your own custom controls for link resolving (which can optionally extend Tridion's; all you ...
You can also use the Nuno's Get Extension that is available here
That approach is very interesting and very useful, you don't need to create a C# TBB, but you will need to register the Get extension in the GAC.
@@Component.Description@@ is a shortcut which in 2009 mapped to the only available Description field, which was your text field.
In 2013 (possibly already in 2011) they introduced a bit more content in the SDL Tridion Template Expression Language via the Dreamweaver Mediator. One of those were the description fields of a Schema. Hence that now @@Component....
Assuming you want to render a component presentation on a PT.
To render a component presentation selectively, you need a way to identify it. If you want to do it based on the component title, you can do it like below:
<!-- TemplateBeginRepeat name="Components" -->
<!-- TemplateBeginIf cond="Component.Title == '[Insert Component Title]'" --&...
You can set a Context Variable in a TBB and use it in a Page Template, what you need to do is the following thing.
Instantiate the Context Variable (Page Template)
Set your context variable in a .NET TBB or C# Fragment (Component Template)
TcmUri linkId = new ...
I am confused as to why you cannot directly use the field @@episode_number@@ rather than using built-in function in your DWT. If it is in the component it should be accessible. Otherwise I would recommend posting your component xml to give a better idea. And, indeed as @Eric mentions the DWT is evaluated inside to outside, so the innermost repeating region ...