Adding parameters in Dreamweaver Templates in SDL Tridion 2011 SP1 - tridion

I learned about Custom parameters and expressions in Dreamweaver MX templates.
So I tried adding them in my DWT TBB, like this.
<!-- TemplateParam name="border" type="number" value="1" -->
##border##
<table>
<tr>
<td>##(border)##</td>
<td><!-- #TemplateExpr expr="border" --></td>
</tr>
</table>
But I am getting a blank output without any error.
I want to add variables to my Dreamweaver TBB and get their values. Can anyone suggest if there is any other approach?

Unfortunately Tridion DWTs only share some syntax with the full Dreamweaver templates, so the above syntax will not work.
There is however a way to set variables, which is well documented here:
http://www.tridiondeveloper.com/get-and-set-variables-in-dwts

Related

TinyMCE autocloses HTML tags - How to disable?

In TinyMCE, when I edit HTML code (using code plugin) and delete closing tags it will automatically add them right after clicking OK.
For example a piece of code like
<table>
<tr>
<th>Foo</th>
</tr>
becomes
<table>
<tbody>
<tr>
<th>Foo</th>
</tr>
</tbody>
</table>
I find this unwanted in my usecase but I cannot figure out how to turn it off.
I've already seen this question and tried these options with no result:
forced_root_block: false,
verify_html: false,
verify_css_classes: false,
cleanup: false,
cleanup_on_startup: false,
fix_list_elements: false,
valid_children: '+body[style],head[style]',
valid_elements: '*[*]',
My TinyMCE version is 4.3.11.
TinyMCE is an awesome addition to the community, with that being said it was meant for users that do not regularly code in HTML. If the HTML tags are not auto generated and one of your users did not specify the html on the page, the page would not look correct. This is why TinyMCE has an auto clean on start to clean up HTML code.
Anyway to disable the auto html you need to disable the verify_html : false, on newer editions you might not be able to disable validation but you can define how TinyMCE will treat html tags. as some tags you will want to keep like the <h1>,<h2> ect.., here is a fiddle and the link to the forum post.
I hope this helps you
EDIT:
MAybe a code editor would suit you better. CodeMirror CodeMirror is a JavaScript component that provides a code editor in the browser. When a mode is available for the language you are coding in, it will color your code, and optionally help with indentation.
The idea is to use a single input, Fullpage plugin, and HTML comments <!-- like this one --> as dividers.
TinyMCE preserves HTML comments, but they are not visible in editor. Only in Code view.
There are so many reasons why you might want to disable the auto closing of tags. For me its because I have to copy paste a ton of text content then mark it up. So I get this...
<p>
</p>Airstream hitching is a much longer and more complicated...
when I type the opening p tag next to the word Airstream.
I have resorted to typing all the closing tags first. Telling people the 8million reasons why this is somehow good for them is just lame. Who cares why they want to disable this? We don't all need WP and everything else to protect our code from ourselves.

Visual editor WordPress deformats code link embedding YouTube-video

I can embed a YouTube-video by just putting the URL in the HTML-code with some space around it (see: http://codex.wordpress.org/Embeds), like:
<tr><td>
http://www.youtube.com/watch?v=xxxxxxxxx
</td></tr>
This works. But if I open the page with the visual editor and save it the code is deformated like:
<tr><td>http://www.youtube.com/watch?v=xxxxxxxxx</td></tr>
and a link is shown in the webpage instead of the (embedded) video. How can I prevent this?
Proper HTML note here - You should NOT be using blank lines for formatting anyway. The correct way to put in multiple blank lines would be
<div style="clear:both;"></div>
or
<br style="clear:both;" />
If you're using the GUI text editor, TinyMCE Advanced may help, as it supposedly has an option to kill that.
This is what I've found on the wordpress forum. Hope it helps.

handlebars precompiled template issue

we use handlebars precompiled templates in a web app. one of our elements broke recently - incorrect HTML was being used in a certain location. When looking at the precompiled js, I can see that elements are missing. the HTML that is precompiled is quite large and complex with lots of handlebars operators. Here's a very simplified version:
{{#if isGeneric}}
<!-- SEARCH FOR ME-->
<td class="empty"> </td>
<td class="empty"> </td>
<!-- THE END FOR ME-->
{{else}}
<td class="description"><p id="{{productId}}" isGeneric="{{isGeneric}}" productType="{{productType}}" class="bluetext productid_opener">{{description}}</p>
<td class="something">{{productName}}</td>
{{/if}}
This snippet in the HTML is very similar to another snippet (if that makes any difference).
When I precompile this, and search for the HTML in the generated programXX, I can't find the code anywhere (e.g. "SEARCH FOR ME"). I notice that the handlebars programs before and after that specific section of code are numbered with a gap. e.g.:
function program52(depth0,data) { // find elements in the condition just prior to the "if" above }
function program54(depth0,data) { // find elements from HTML in condition just after the "if" above }
so from that I would assume that the function program53 contains the relevant code, but why is it not included in the generated HTML? How does handlebars determine what to include or exclude in the HTML?
I posted https://github.com/wycats/handlebars.js/issues/452, which was actually a dupe of https://github.com/wycats/handlebars.js/issues/428.
The issue is resolved and will be available in npm soon.

ASP.NET MVC theme editor on UI

I'm building a multi-tenant application that allows a tenant to edit the layout (HTML) on the UI in the administration control panel. I thought that I can build an editor for user to edit the razor view but It's need to be compiled to effect the new razor view.
I look into some open source applications. I find this one http://liquidmarkup.org/ It was developed for usage in Ruby on Rails web applications
Anybody have any experience & reference for this in ASP.NET MVC?
Not 100% sure if this is what you are looking for but you could develop your site using jQuery themes (CSS and markup) and then use the theme roller for your clients?
It sounds like you can use Jquery Templates (http://api.jquery.com/category/plugins/templates/) to meet your need.
Here is a random (greatly condensed) sample template from one of my projects:
<table>
<tr>
<th>Response Status</th>
<th>Response Reason</th>
</tr>
<tr>
<td>${RepsonseStatus}</td>
<td>${ResponseReason}</td>
</tr>
Note the ${} tags - these will be replaced with json data at runtime.
And here is how to merge a template with its data
//myTemplate can be sent from a server side function
var myTemplate = SomeFunctionToGetMyTemplate();
//myData is a javascript object/json from the server
var myData = SomeFunctionToGetMyData();
//the html function just replaces the html of the context node (#myTargetDiv) with the //output of the $.tmpl function
$("#myTargetDiv").html($.tmpl(myTemplate, myData));
Jquery Templates are officially deprecated, but there is no official replacement from jquery yet (afaik). There are some helpful video tutorials on pluralsight for jquery templates.
Highwire.com is built on ASP.NET but they use custom templating and custom UI abilities for clients using Apache Velocity Platform.
http://docs.highwire.com/apiv2/html/
Maybe you could use it as well

Overriding default ASP.Net MVC scaffolding HTML

Each time I use Visual Studio to generate a display-template using scaffolding I get something like this:
<fieldset>
...
<div class="display-label">Property</div>
<div class="display-field">#Model.Property</div>
...
</fieldset>
Is there any way to change this template so that it use a HTML definition list instead?
<dl>
...
<dt>Property</dt>
<dd>#Model.Property</dd>
...
</dl>
I know you could use DisplayTemplates, but I want the generated code to be default in all my projects.
Take a look at the following post: http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx. It describes customizing the templates. While it was written about Mvc 1 everything still applies
If you are having trouble finding the item templates you can add them to your project with Nuget: http://blogs.msdn.com/b/joecar/archive/2011/01/06/add-the-asp-net-mvc-3-code-templates-to-your-application-with-nuget.aspx
You can accomplish this through T4 templates. Take a look at the explanation in this thread. How do I create my own Scaffold Template in ASP.NET MVC 3?

Resources