How to call Vbscript function in the Compound template (using C#fragment) in Tridion? - tridion

Please let me know How to call Vbscript function
in the Compound template (using C#fragment) in Tridion 2011?

I'm pretty sure this isn't possible. You can't mix the legacy templates with Modular templates.

Sounds like you are mixing legacy style VBScript page templates with current style Compound component templates (or something similar). Mixing the two types is (sometimes) possible, but you cannot call functions in page templates from your component templates like you could with a pure VBScript setup.
You will need to re-implement your VBScript function's functionality as either a Dreamweaver template callable custom function or a .Net based Template Building Block (C# fragment or .Net assembly) depending on your use case.

OK - just for fun, a strictly literal answer. Please note that I do not advocate this approach.
Write your function in VBScript
Convert your VbScript file into a Windows Script Component
Create a .NET Interop wrapper for your Windows Script component
Put the thing in the GAC I should think...
Call it from your C# fragment
As I said - this is a strictly literal answer to your question as stated. It's enough to say that it's technically possible to do what you are asking, but it won't be useful, because apart from all the technical grief of working through all those layers, what you want to do in a template is usually to invoke the Tridion APIs, and of course, the APIs that are available from the VBScript templating environment are different from the ones available via Compound Templating.
In practice, you'll probably find that your old VBScript templates are due for a re-write anyway. Having to do this occasionally is a good thing.

Related

getting involved in developing web application with symfony framework

well I'm a php programmer who for a period create some php application by using codeigniter framework. Now I would pass to the next level using a framework more powerful and my choose is gone to symfony framework. I read good things about it and looking for some infos about it, it seems me a good next level. I saw that it uses a templates engine names Twig and since I come from codeigntiter I fell a little uncomfortable.now I would know which are the advantages in using twigs?is it really of help using it in web application?
In my short, subjective opinion, templating engines typically result in cleaner views, and in some engines' cases (some more than others), better enforcement of separation of concerns.
As far as discussions & articles go, there are many if you search for them. Here are a few references though:
What are the real advantages of templating engines over just using PHP?
PHP vs template engine
(older, and also could be biased towards Twig since it was written by Fabien)
http://fabien.potencier.org/article/34/templating-engines-in-php
Twig's website even gives you an overview of why it can be helpful:
http://twig.sensiolabs.org/
One thing to keep in mind regarding Symfony is that you are not locked in to using Twig. In my opinion, it's easier if you do, but you can just as easily tell Symfony you want to use straight PHP templates instead.
Twig is dead simple yet powerful templating language, and is just a bunch of shortcuts to what you'll do in PHP.
There is cool built-in tools like filters to avoid inline php common treatments on strings (for example), macros and possibility of extending the language. The syntax is very clean, and easy to learn.
There is a great documentation.

Script# and Asp.Net updatepanels compatibility

This is a simple question, NikhilK answered to this question:
"Script# doesn't support ASP.NET Ajax anymore"
Does that mean that we can't use Asp.net UpdatePanels (which need a ScriptManager) in the same page where we load mscorlib.js? Even if mscorlib is manipulating DOM elements that are not inside the updatepanel?
When I mentioned asp.net ajax is not supported, it is primarily a two-fold statement:
MSAjax assemblies allowing you to program against the msajax scripts are no longer included.
There was a mode of the compiler which caused generated script to use the type system defined in msajax scripts.
Conceptually you should be able to load mscorlib.js and program using it in any page, including one using asp.net ajax (and update panels). As a heads-up you may run into one particular issue... mscorlib.js extends Array.prototype, which I don't think affects msajax scripts, but might affect some other scripts (eg. sharepoint scripts).
In the future, I plan to generate scripts differently that would not require extending Array.prototype, but that work hasn't been done yet.
So hopefully that clarifies things. If you try and run into issues, I'd love to know. I can't guarantee they'll be fixed (esp. given that even asp.net is primarily focused around jQuery rather then the old msajax scripts), but I can try helping to see if any of them have reasonable workarounds.

New asp "showat" attribute required inconsistently in VS2010. Why?

When I generate code using T4 templates in Visual Studio 2010, I get the following error for each of my asp controls when I try to compile:
Control "ddState" is missing required attribute "showat".
I have never gotten this error in previous versions of .NET. Further, I don't get this error when I manually construct my pages either by dragging/dropping, nor do I get it when I type out the control text myself. When I generate code, I have to manually add showat="client" to my tag for the compiler to be happy. It was my understanding that I never had to explicitly specify this tag. The following:
<asp:dropdownlist id="ddState" runat="server" showat="client" />
solves the problem. Why do I have to add this to generated code but not other times?
(It's a VS-2010 webforms project, using VB, in case that makes a difference.)
Apparently .NET 5 or another one of those super service packs is going to allow something called targeted rendering. It was originally intended for use just in the context of webforms, but I've heard recently there will be some fancy way to use it in MVC (using some helper classes) and in services using WCF. It will work well with Dynamic Data but is very loosely coupled with it; you can use one or the other completely independently. If you configure your dynamic data with certain tags you can have it constructed on the client, etc.
For now, just put showat="client" in all your tags, and all is good. That's supposed to be the implicit default, but I've heard of cases where the IDE seems to require it. In the future, showat="client" will be the safest setting anyway, giving the expected behavior in 99.9% of cases.
This is required in VB, but not C#, which is why it seems to not be necessary sometimes. To be more specific, the C# compiler puts the equivalent of showat=client into the IL automatically, unless you specify a showat target other than client.
"showat='client'" should currently have little effect on your coding. It's main purpose is for future WCF output targeting, which they will want to be backward compatible. For now, the only possible value is "client", but in the future there will be other possible values that will allow pre-rendering of cached values, and apparently "pushing" output to services. The example I saw at the last code camp was where you could push to a service at (probably) the same site as well as to the client machine, for logging/debugging purposes. You'd have something like (to use your example):
<asp:dropdownlist id="ddlCP" runat="server" showat="client, logService" />
. . . and then the rendering would go to your log file. Or, to your session provider (if you've got multiple web servers and are implementing a shared session provider), etc. I think logService above would have to be defined in the web.config or something.
Check to see if VB does anything in the web form designer page when you use the IDE to add the control. I'm not sure how VB inserts the implicit tag. But that would be something the T4 template would miss, just a thought...
Agreed that my VS2010 solves this issue for you. Then you can remove the tags completely. I would suggest getting the upgrade. It's well work the $599 upgrade cost. Otherwise, look to add the showat="client" in all the tags. I think that Rising Star got that one right, although I haven't tested it yet.

Can C++.NET and J# be used to make a website?

I didn't see an option to create a web site in the c++ area. Is there a way around this or am I just stuck with C# and VB.NET
A bit of googling turned this up, not sure how applicable it still is:
http://www.codeproject.com/KB/mcpp/helloworldmc.aspx
However, I'd question WHY you'd want to use C++.NET over C#, given that the languages are fairly similar at the basic level. Any perceived "speedups" would probably not be very noticable given that they both compile to the same IL, and as such are both subject to the JIT-compiler.
You can probably make your website work using C++/CLI. There is no tight coupling between a .NET page (aspx or ascx) and the language of implementation. You might even get the intellisense from within the aspx/ascx files but don't quote me on that.
So to set this up you would need to create a C++/CLI project and use managed C++ to extend Page, Control, etc classes, use HttpContext etc.
Another question is whether or not there is any point doing that. You would still be targeting .NET and calling to the same API. There won't be much performance benefit if at all and you will lose the IDE support for creating controls and you wouldn't be able to use WebForms from the designer.
Edit. If you haven't done ASP.NET before you will almost definitely be firing up a normal ASP.NET project and seeing how to implement something, which classes to extend etc. So it kind of defeats the idea of using another language.
You can, in theory, use any .NET language to build ASP.NET pages. F#, for example, is fully supported in VS 2010. Whether all languages are fully supported in the tools is another question -- particularly for a language like J# that has been deprecated beyond VS 2005 and doesn't support the full depth of features of the other languages (such as the ability to create new attributes).
At a minimum, you will need to do things like define an appropriate build provider to get things going.

jQuery and Asp.Net compatibility

I am trying to use jQuery and Asp.net Ajax library. The jQuery code is solid, I have it working on a separate page. When I incorporate the jQuery code into an existing page that using Asp.net Ajax, the jQuery code does not work.
I think this has something to do with name mangling.
How can I stop asp.net from name mangling or whatever else is going on?
If you're running into major naming issues then leverage QJuery's ability to use almost anything as a selector, including classes. Sure, class lookup isn't as fast as id lookup, but it is far less prone to being mangled by auto-generated code.
Here is a good article detailing How To Work With JQuery in ASP.NET.
Generally, the two frameworks do not interfere with each other. You can run into issues though, since asp.net ajax adds a hole bunch of extra functions to some of the base types like string, int or data.
But usually that is not a problem when only using jquery, but I have had issues with a few plugins that was not written probably, so that might be where your problem is.
With that said, it is hard to give you any concrete help without more information or/and code.
Maybe the two frameworks (jQuery and ASP.Net AJAX) collide in defining some operators like the $.
This old forum post is made by someone facing similar situation.

Resources