Source for learning templating in Tridion using XSLT and C# - c#

I am working on a project which requires Tridion Component Templates to be written in XSLT and page templates to be written in C#. I know XSLT basics and I am totally new to C#.
Can anyone guide me to any sources of learning XSLT and C# templating for Tridion 2011. It would be of great help if you could. Thanks in advance!
If there is any better way to do the templating, suggestions are welcome. We can see if our client is accomodative for that.
Regards,
Keirthana

+1 to Nuno's point, the instructions, examples, and access to someone that's done it before makes training well worth it.
SDL Tridion Compound Page Templates are not written in C# alone, but use a combination of Template Building Blocks. Template Building Blocks (TBBs) consist of a layout part (typically DWT) as well as C# TBBs.
Alternatives
Template approach depends on the developers, development process, and available technologies. I've seen programmers struggle with Component Templates, not because of Tridion, but simply because of the languages involved. Be sure to get a good fit for your customer.
XSLT Component Templates may make SDL Tridion's inline editing features harder to implement. Though you have the flexiblity from XSLT's <template match="">, you lose some things you get "for free" such as:
resolving links and publishing binaries
a programmatic content model and access to the Tridion Object Model (at least at the CT level)
the package
separation of code from content
An alternative would be Compound Component Templates (modular templating). But again it depends on your environment.
Resources
SDL Live Content has high-level background information and examples. The first page and diagram under SDL Tridion 2011 shows the big picture and extension points.
SDLTridionWorld.com is another excellent resource for examples and descriptions, customers also have access to the API documentation. The forum especially has a lot more examples for XSLT CTs than StackOverflow (for now).
The community-driven Tridion Cookbook has examples and explanations as well, but across the entire Tridion API stack.
Reach out for training through SDL.com.
Basic Introductions
I've written some basic introductions and example for XSLT CTs and C# TBBs, but these aren't a substitute for training.
Basic XSLT template to see the source of a component.
The same idea, but with a C# TBB.
How to set up an C# assembly (uploaded a TBB as opposed to a TBB fragment)
Example DWT TBB
You mention being familiar with XSLT, I find using basic XSLT functions to help understand component details.
I've attempted the excercise Nuno describes as well (video included).
The biggest risk in skipping training, IMO, is getting either BluePrinting or the content model wrong. Definitely come back to ask questions as you go along.

I have to recommend taking a training as the easiest way to start. I understand this is not always well received by partners or customers due to training costs, but you definitely get your value back very quickly by not wasting time trying to figure out the basics.
Once you understand the basics, then it's like any other technology: practice makes perfect. An exercise I used to ask people to do when they started with Tridion was to output a simple page, like the google.com homepage, then start slowly changing the content to come from components, add inline editing, etc.
Baby steps - and ask your questions here!

I think, You can find some of best example of C# templating on below link
http://yatb.mitza.net/

Agreeing with Nuno. You may also read SDL Live content documentation (requires login).

Related

Prerequisites for creating a project in WPF with C#

I have been thinking a lot lately about making a fully functional project with a small team using C# WPF UI. The goal is to create a construction management software. It is not about "reinventing the wheel", the idea behind this is to gain experience in software programming.
Some of the general knowledge that we possess:
We have been introduced in OOP at the University.
We have programmed in Visual Studio before, but only standard C#.
We watched this playlist of Tutorials on WPF
We have also been looking at some tamplates on Telerik, but our understanding in WPF is too shallow right now to comprehend them.
Some of the things we would love to understand:
What SQL Server would be appropriate for this kind of software, we used Microsoft SQL Server so far.
Any recommendation of books that might help us enhance our skill in building a database such as: reading from it, creating appropriate relation-ships, etc would be greatly appreciated.
Any recommendation of books for C#, LINQ or anything you know and might help us.
We want to treat this project seriously and we know that we will struggle with this documentation step for quite a while. Please let us know if there is any other step or fundamental thing that we missed, thank you!
With WPF you should use MVVM. Unfortunately, there are no good books that will teach you that though.
I have a bunch of articles and samples on TechNet wiki and Gallery. A number of these originated from coaching and teaching newbies.
https://social.technet.microsoft.com/wiki/contents/articles/30959.user-page-andy-oneill.aspx
Some of what's in there ought to help.
Use viewmodel first for navigation.
Don't use pages, use usercontrols and bind content to a property returns a viewmodel.
Template using datatype=vmtype into usercontrols in the ui.
I think redcurry's recommendation of pro c#7 is good. I like Jon Skeet's c# in depth.
For database theory.
Bear in mind it has changed very little in 20 years. Hence rather old books are still good and you can pick up copies really cheap nowadays. For example https://www.amazon.co.uk/dp/0201752840?slotNum=0&linkCode=g12&imprToken=uS5pZKPLsrVEOJop6zd4iA&creativeASIN=0201752840&tag=javarevisit01-21 well worth a fiver.
My big tips on indexing:
By default - add an auto integer as primary key rather than using any natural key you think will "always" be unique. They inevitably change.
Don't add too many indexes.
The old advice is still true. Normalise 'til it hurts and then denormalise 'til it works.
SQL server is good, easy to find online advice and sql express is free. Jobs are very useful but the "full" version of sql server is expensive. If you will have large quantities of sql server and low/no budget then MySQL.
There are free resources for sql server on the web. For example http://www.sqlservercentral.com/
I've never read a book on LINQ. I learnt it as I went by looking up stuff on the web. I rely heavily on intellisense when writing anything isn't fairly simple. My big tip on LINQ is not to use it for complex queries and as complexity increases in one you're writing you should look at the generated sql. Complicated linq is prone to generating terribly inefficient sql.
I really enjoyed the book Pro C# 7. I think it's very well written and comprehensive. It even covers WPF at a reasonable level. There are also chapters on dealing with SQL databases.
Once you're familiar with C# and some WPF basics, you can read Windows Presentation Foundation 4.5 Cookbook. I found that their specific examples and explanations helped me understand how WPF works.
Then it's about getting your hands dirty by trying things out. You'll find a lot of resources online as you search for problems you run into. There are tons of blog posts explaining specific WPF solutions, and of course there's StackOverflow.
Good luck.

Google AngularJS Framework - Worth the risk?

I have been asked to build a small web application for one of our clients and think it might be a good opportunity to try out a different framework for building web applications. Most of the applications we build are based on asp.net web forms and we have no yet done anything in an MVC architecture but I am eager to start building web applications in a more structured manner with the right tools.
I have been researching things like asp.net MVC and the likes which look quite good but I am wondering is there anything to be said for using something like the Google AngularJS Framework.
If possible I would still like to be able to write my server side code using c# and I have not researched AngularJS enough to know if this is even possible, although I assume I could use web services.
Has anyone had any experience with developing an app using AngularJS and if so, how was it and can you point me in the right direction for some tutorials?
We have been developing a port of a Swing fat-client application in AngularJS for the last couple of months and I think it is worth recommending. As far as learning resources go, check out the official project site (and be sure to read the tutorial) and the mailing list (the authors are very helpful).
The good stuff:
great testability
the two-way data binding is a very powerful feature, and it can be extremely helpful once you "get it"
IMO the AngularJS templates are much less brittle than using data- attributes or "special" CSS classes to mark elements that do something
it greatly reduces the need for using jquery plugins, because implementing that functionality in AngularJS is very easy (stuff like trees, tabs, accordions, etc.)
The bad stuff:
the learning curve seems pretty steep (I didn't have much of a problem, but I've seen some people struggle with it)
validations in AngularJS suck for the time being (a new implementation is on the way)
not all libraries/jquery plugins play nicely with Angular and usually you have to wrap them
the API is still being polished, so expect breaking changes (not a big problem with frequent releases and very good changelog, though)
performance is OK up until several thousand bindings on a page - most of the time this is not a limitation, but there are cases when this could be a problem.
Some pointers (if you ever decide to learn AngularJS):
some people really overuse widgets. In my experience, it's much better to use HTML "partials" + services, and only use widgets sporadically.
read source code of the library - it's the best place to learn stuff about angular
no DOM manipulation in services/controllers
if you use css classes to bind to events, you are doing it wrong
+1 #psycho's answer
AngularJS is client-side framework, so you can use any language on the server. It's designed to work well together with jQuery, with big emphasis on testing...
Here are some resources you might find useful:
TUTORIAL: http://docs.angularjs.org/#!/tutorial
API DOCS: http://docs.angularjs.org/#!/api
Developer Guide: http://docs.angularjs.org/#!/guide
Some example apps:
http://cburgdorf.github.com/angular-todo-app
http://www.fluid.ie/angular/calculate/
http://hookercookerman.github.com/angularjs-todos/
http://paul-hammant.github.com/StoryNavigator/navigator.html
Adapter for SenchaTouch: https://github.com/tigbro/sencha-touch-angular-adapter
Adapter for jQ Mobile: https://github.com/tigbro/jquery-mobile-angular-adapter
Feel free to ask any question on mailing list !
We are still in beta, but there are already several internal apps at Google, powered by AngularJS.
UPDATE (26th July 2012):
AngularJS v1.0 has been released.
For some public AngularJS-powered apps, check out http://builtwith.angularjs.org
IMHO developing something for a client which they may have difficulty supporting is unprofessional. You have to bear in mind that it will be difficult for your client to hire experienced Angular professionals, or train their own people to climb that "steep learning curve". Also, so far the documentation is not that great. Can you easily, in a few moments, answer the question, "How can I connect my shiny Angular app to my client's database?" Can your client sometime in the future easily grab some existing code and adapt it to their potential future needs? Be honest.
Compare plain old reliable LAMP development to Angular. For a "small web application" I really believe that a professional should give his client something maintainable and simple.
It's not to say that Angular isn't cool and sexy etc etc. But you have your client's future maintainability to think about in addition to the latest framework fad. Tread lightly would be my recommendation. Build your own website with Angular first and see what you think before you bestow your fabulous new skills on some trusting client.
I remember reading this SO thread couple of months back with same question in my mind, and we decided to go ahead with AngularJS, and the best decision we made on this project yet.
We are using AngularJS + ASP.NET MVC4 REST WebAPI.
Most probalbly after such a nice client side Javascript MVC framework, you would only need REST API layer interacting with Business Logic Layer at server side, and no MVC at server Side (ASP.NET MVC/Spring/Structs would feel like old memories).
You will find Angular-UI good add-on (esp ng-grid)
Soon after our project finishes, we might put some of our directive we wrote for open source world.
I have been researching the merits of AngularJS for many months to utilize as a core framework for product I am creating.
There are many aspects of AJS that make it worth while to learn. Yes there is a bit of a learning curve but its well worth it, especially if you wish to have more control on client side capability.
JQuery manipulates the DOM at run time, whereas AJS situates itself within the JS rendering lifecycle. This allows you to teach the DOM new tricks by creating your HTML Elements and Attributes. This is very, very powerful. As what you are able to do is introduce new Element behaviors for whatever your purpose and need. In AJS these custom HTML Attributes/Elements are called Directives. With the ability to craft your own Directives, you are able to build functionality that the current HTML doesn't have, pushing out capabilities that will run on all modern browsers now and into the future. Of the many approaches to inducing new behavior, AJS appears to be the safest direction one could take due to how they have chosen to implement it.
There is a huge performance gain over JQuery in AJS.
I love the simplicity of the two-way data binding, and the separation of concerns in their client side MVC pattern, which as pointed out above provide great testability. There scope object is the glue between the View (HTML), the Model (your Data) and your custom Controllers. The scope provides access to parent attributes and can be isolated at the sibling level, which is important for some reusable templates.
Templates can created and reused across your application which can contain 0 or more custom directives.
I have been using frameworks such as PRISM and MEF but I am finding that AJS has most of the same features that exist in these .NET frameworks but in a 29K footprint. There is rumors that they are working on lazy-loading which if provided will provide for some very interesting LOB type capabilities.
There are a number of UI frameworks that are being built for AJS but you can wrap any 3rd party control lib as needed, given a bit of effort. The trick is to ensure that when these 3rd party controls have changes induced, that you ensure AJS is properly notified using their apply method.
If you combine AJS with MS TypeScript within VS 2012, it provides the ability to manage and build some very impressive projects which will work well for those who are more comfortable with projects within VS.
There are a ton of other reasons to look at AJS, but if you are considering frameworks such as KnockOut I'd highly recommend AJS instead, regardless of it's perceived learning curve. Knockout is a library, AJS is a framework.
So far i think Google's Angular is great. Particular like the databinding and dependency injection.
For other js framework, there are knockout.js , backbone.js etc.
here are some posts:
angular.js example in backbone.js and/or knockout.js
I realise this post is old and you haven't gone with Angular, but I have a similar background to you, and I'm at the same point as you when asking the question.
So for the benefit of future visitors, some of the "risks" and links to resources I've found useful...
As many have already mentioned, Angular can have a very steep learning curve "Not only me, but co-workers that I consider highly smart developers, have struggled with some of the basic concepts" AngularJS is amazing... and hard as hell (link also has some good tutorial links which you asked for), and the version 2 stuff is looking more like java, which wouldn't have been a problem with your C# background, in my opinion Directives are hard enough to understand without verbose annotations and so on.
Angular performance can be poor in some cases, especially when using ng-repeat on a large number of elements Considering Speed and Slowness in AngularJS and Scaylr's experience. Other's have mentioned that performance really degrades over ~2000 bound elements, but that's usually met with arguments about how any app with more than that many elements probably isn't a good app. Keep it in mind though if you have legitimate use cases which call for many bound objects.
Angular is popular in terms of contributors, but ranks way way behind, say, jQuery in terms of production usage. Finding Angular developers might be tough, and jQuery or other developers converting have that "steep learning curve" to deal with.
Because Angular is young, you have no guarantee that it'll gain enough traction for your new Angular skills to be employable, and your new application not to quickly become legacy code
In v1.2 Angular doesn't support IE7 and below and v1.3 will drop IE8. For >=IE9, you need to follow some special coding practices.
The many javascript widgets, plugins and libraries which you might be used to using can't be used properly with Angular without heavy modification and people often suggest to re-write your component in Angular anyway.
UPDATE March 2014: after 2 months attempting to build a non-trivial densely functional one page app: There are many versions of Angular, and it's hard to say which is the best or most stable. It will depend on what you're coding with it. I'm finding some bugs Angular that are fixed by upgrading to a later version and others fixed by regressing to an earlier one. I've never had to go version shopping like this with jQuery.
UPDATE May 2014: Young, broken tools. Batarang is great until it doesn't work. I can't trust it until they fix this one.
And finally, the three best resources I've found for learning this stuff
Todd Motto's ultimate guide, and
UPDATE April 2014: this eBook chapter is quite amazing. I didn't buy the rest of the book yet, but the concept is fantastic
A full non-trivial app written in Angular (the accompanying book is OK, but doesn't really talk about the non-trivial app enough, as they appear to be saying advertised on their site)
I would say yes to this and check out John Papa's hottowel implementation as a way to do it.

asp mvc to spring mvc

I have about 4-6 years .NET experience. Primarly using ASP.NET MVC/Nhibernate/Castle Windsor/MSpec/etc in visual studio with Resharper.
I'm starting a new job in a week where we will be using Java with the Eclipse IDE and Spring Framework.
I've read up on the differences between Java and C# and I don't see myself having much trouble adapting (well except java not having LINQ, lambas, etc etc). The architecture style they're using is for the most part the same as I do things in C# as well and I am comfortable with it.
But I installed Eclipse and the Spring tool set and I am completely lost as to where to even begin vs working within Visual Studio. I downloaded a few open source spring apps and I don't even know how to get them to open in Eclipse.
Is there any good sites/tutorials/books anyone could recommend that would get me at least somewhat up to speed with Eclipse/Spring (not Java language books..)? One of my first tasks will be getting the atlassin suite set up as well (primarly Bamboo) which I've never touched before...
Welcome to the community! Those aforementioned books are great ways to learn the Spring framework, but are of substantially less use if you're trying to get started with Java development with Spring, in general, as they can overwhelming. This webinar - http://www.springsource.com/webinar/getting-started-spring-and-springsource-tool-suite - (if you don't want to fill out the form, there's a link that says, "I'd rather not fill in the form. Just take me to the download page" in reaaaly tiny fonts below "Download Now!" button. The advantage of that link is that you can download the slides + webinar. If you'd prefer to just watch it online, check out http://www.youtube.com/springsourcedev#p/c/7B74449D5224CC99/0/kSITVsOUvLU ) introduces the SpringSource Tool Suite (a freely downloadable Eclipse derivative) and introduces getting started with simple 80% case type stuff. By the time you're done, you'll have tooling, an idea of what the framework is, and an idea where to get started for a few different approaches. (e.g., "I want to build a web application," or, "I want to data access..") This webinar's an hour, and perhaps then - with a few working examples under your belt in Java - you can tackle those books at your leisure ;-)
I would recommend these two books:
http://www.amazon.com/Professional-Java-Development-Spring-Framework/dp/0764574833
http://www.amazon.com/Pro-Spring-Rob-Harrop/dp/1590594614
Both books are from very well known publishers so you can't go wrong with giving them a quick read.
Spring in Action, from manning is the best first book for learning Spring.
You can try Spring Roo as well. It's a command line tool for generating complete web application, with security i18n and so on.
It's so easy to use and you will find the greatest guide for building Spring applications.
There will be a book from manning soon and there's a short introducing book from O'Reilly, available as free download.
Of course, you must visit http://blog.springsource.com/

Programming with .net

I've just recently learned C# and am interested in .net but I don't know where to begin.
I know .net is just a bunch of libraries and can be used for web programming?
I'm not quite sure what areas in .net that I need to learn?
I don't know what I am trying to accomplish with .net? But I want to learn .net.
What other things can be achieved with .net?
Thanks.
Added -
The 2D class that I finished was a C#/Winform/XNA class working with 2d objects. Though there was never once a reference about .net in class. I just learned C# which is comparable to C++ and Java and Winform = just using the tool box and hooking up controls to back end code. XNA portion was being able to use the hardware to draw primitives and manipulate data going through the model->view->project pipeline.
What part of this class was .net? None right?
You can do nearly anything with .net (the same is true for most other platforms).
You can use ASP.NET for web programming, Windows Forms or Windows Presentation Foundation for GUI development.
There are also lots of functionality for networking, database development and XML or Image processing.
But the question is, what do you want to achieve?
I know .net is just a bunch of libraries and can be used for web programming?
.NET is much more than this. It is not restricted to web programming. There are possibilities for doing Windows Applications (WPF), Web Applications (ASP.NET), Network Communication (WCF), Database Access (ADO.NET), ..., you name it. So just pick a language you would like to learn like C# and go ahead and visit MSDN.
.Net is a managed runtime with libraries. It is not exclusive to building "web" applciation or pages.
The .Net Framework is 'the libraries'.
The CLR is the runtime (where the specification thereof, is deposited into a standarization organization)
C#/VB.Net/F# are flavors of different syntaxus (how do you spell this in plural?) used to instruct the runtime, using the libraries, to perform actions in an order you define (AKA programming)
Wanting to learn .Net is akin to learning another language/gammar. If you have no previous knowledge of "language/gammar" itself, you are using this specific language/runtime to learn 'language' in general.
Hope this helps,
Sorry, but if you've just used the toolbox to hook some stuff together you haven't learned C# or programming. You've learned how to hook some stuff together, but you're obviously interested in learning how it works. Seems like you're going to have to learn a lot of stuff from scratch. There's a lot to learn...
I think your best bet to learn .Net and C# (you can't really learn one without the other) apart from following a course specific for that goal is to find yourself a good book that explains the whole picture and run through the examples in the book.
Looking on internet, asking questions, and collecting bits of examples, etc. will give you little pieces of understanding, but I doubt you'll be able to get a comprehensive understanding of programming, .Net and C# that way, simply because you won't find a big picture explanation. I find a good book gives me a deeper understanding even though I've already worked with .Net/C# since it first came out, simply because there is much more explanation of how things work and why.
Personally I really like the Pro series from Apress: have a look at Pro C# 2010 and the .Net 4 Platform
It might be perfect or not depending on your understanding of software development. Otherwise just search for C# and see if other interesting books pop up.

Which namespace from the .NET Framework should I research?

I am just beginning to play around with .NET (using C#).
Which namespace, aside from System.*, do I need to research ?
UPDATE: A number of people are asking why research namespaces.
My previous programming experience is mainly non-OOP and VBA (self-taught).
I have no idea at all to what has already been provided in the .NET framework.
I don't want to sit down and write string-handling functions (for example) to then find out that all the string-handling I could ever need is already written for me (and works better than mine)
Why do you want to start with namespace?
Rather start with windows form applications, web apps, database operations.
While working on these applications, you will need the details of required namespaces and classes.
At that time you can look int only required namespace.
I think you would benefit a lot more by reading over the source from a few decent applications than you will from researching a namespace. Of course, that largely depends on what you're trying to do - if you just want academic knowledge of C#, then that may be a solid direction. But if you want to actually build something, I would look at samples.
BabySmash is an interesting WPF app: http://babysmash.codeplex.com/SourceControl/changeset/view/17438
Speaking of, Scott Hanselman did a long series called "The Weekly Source Code" where he blogged about numerous open source projects whose source he was reading - to be a better developer. Most of those are C#.
I'm not sure whether it makes sense to try to research on whole namespaces. They are large and it could get boring...
My best way to dive into new frameworks or languages is examples.
Try to achieve something specific (e.g. create a simple web shop, a hello world winforms app, ...). For that, google on how to do that. While studying the code examples answering your specific problems, you will get to know the object model without even noticing.
You could also start with some tutorial. Or, if you like books, buy a book and read it. Namespaces, however, I do not even care about what namespace provides a certain class. I just right-click the class and choose "Resolve".
Some tutorials:
http://www.w3schools.com/ngws/default.asp
http://www.dotnetcurry.com/ShowArticle.aspx?ID=377&AspxAutoDetectCookieSupport=1
http://www.c-sharpcorner.com/UploadFile/jmukharjee/WindowsFormsTutorial111282005011245AM/WindowsFormsTutorial1.aspx
using Microsoft;
And there are many others on the internet, you'll find some good one on CodePlex, or write your own.
My recommendation would be start with the System.IO (Deep understanding of IO, reading and writing files, streams, etc).
For an "academic" vision of the framework read this book:
http://www.amazon.com/MCTS-Self-Paced-Training-Exam-70-536/dp/0735622779
Greetings ;)
This reminds of DNR episodes, where they have a namespace or a class to be the thing of the day - much like the letter of the day on Sesame Street.
Seriously though, researching a namespace in language framework will not give you much practical knowledge. Far better to trawl through online tutorials and give yourself a mini project to work on.
If you really want to research into Namespaces, then Microsoft and System are the only places you really need to go. Whithin the System namespace you should check out:
System.Collections
System.Data
System.Linq
System.Web (If you're interested in ASP.NET)
There are of course many others, but these are the main ones for starting out. You can check out MDSN for more info on these.
I agree with most of the others answers though in the fact that really you should just read a book or do some web tutorials (check out MSDN again). Its the way I learnt and it worked just fine, although I suppose it will not suit everybody.

Categories