This is a migrated thread and some comments may be shown as answers.

Templates and HTML tags

4 Answers 184 Views
Editor
This is a migrated thread and some comments may be shown as answers.
garfield
Top achievements
Rank 1
garfield asked on 11 Feb 2008, 07:45 PM
Hi!

Is there any way to keep rad editor from stripping html, head and body tags from a template just added from the template manager?


EDIT:

Extended explanation.

I have a folder with html files I want to use as templates to create new html files. But when I load them using the template manager, all the head section, and the <html> and <body> tags disappear, and so do all the css classes defined inline.

I've noticed that on telerik examples happends the same.

Is there any way to keep all that information instead of being stripped away?

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 12 Feb 2008, 03:26 PM
Hi Marc,

You can fix this browser problem by overriding the TemplateManager command and manually setting the stripped by the browser HTML, HEAD and BODY tags. Here is an example how to do that:

<telerik:radeditor runat="server" ID="RadEditor1" TemplateManager-ViewPaths="~/" TemplateManager-UploadPaths="~/"></telerik:radeditor>
<script type="text/javascript">
Telerik.Web.UI.Editor.CommandList["TemplateManager"] = function(commandName, editor, args)
{
   var myCallbackFunction = function(sender, args)
   {
       var resultImageObject = args.Result;
       editor.set_Html("<html><head></head><body>" + resultImageObject + "</body></html>")
   }
  editor.showDialog("TemplateManager", {}, myCallbackFunction);
};
</script>

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
garfield
Top achievements
Rank 1
answered on 12 Feb 2008, 03:55 PM
Hi Rumen

I'm sorry but that's not what I was looking for.

I mean... I have my templates folder, and each template has a code meant to be for itself: Inline classes definitions, attributes of the tag... whatever. I just can't create a script for each of them. And of course there's the possibility to upload new templates, so a script is not an option.

I'm including an example:

One of my templates would be something like that
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
  <HEAD> 
    <TITLE>title</TITLE> 
    <link href="_stilos.css" rel="stylesheet" type="text/css">  
    <STYLE type=text/css>.Estilo2 { COLOR: #333333 } </STYLE> 
  </HEAD> 
 
  <BODY text=#000000 vLink=#0000ff aLink=#0000ff link=#0000ff bgColor=#ffffff   
  leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">  
 
    <TABLE cellSpacing=0 cellPadding=0 width=402 align=center border=0>  
      <TR> 
        <TD>Contents</TD> 
      </TR> 
    </TABLE> 
 
  </BODY> 
</HTML> 

But once I include it by using the template manager, only this code remains
<TABLE cellSpacing=0 cellPadding=0 width=402 align=center border=0>  
    <TR> 
        <TD>Contents</TD> 
    </TR> 
</TABLE> 

How should I proceed?

Thank you very much


0
Rumen
Telerik team
answered on 14 Feb 2008, 05:24 PM
Hi,

By default, the IE strips the HTML, HEAD and BODY tags. To fix the problem set a simple &nbsp; entity before the <HTML> tag. After that when you insert the HTML file through the Template manager, the LINK and STYLE tags will be not stripped.

&nbsp;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <TITLE>title</TITLE>
    <link href="_stilos.css" rel="stylesheet" type="text/css"> 
    <STYLE type=text/css>.Estilo2 { COLOR: #333333 } </STYLE>
  </HEAD>
 
  <BODY text=#000000 vLink=#0000ff aLink=#0000ff link=#0000ff bgColor=#ffffff  
  leftMargin=0 topMargin=0 marginwidth="0" marginheight="0"> 
 
    <TABLE cellSpacing=0 cellPadding=0 width=402 align=center border=0> 
      <TR>
        <TD>Contents</TD>
      </TR>
    </TABLE>
 
  </BODY>
</HTML>

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Scott Allen
Top achievements
Rank 1
answered on 16 Apr 2010, 03:26 PM
Thanks! Just saved me a lot of time.
Tags
Editor
Asked by
garfield
Top achievements
Rank 1
Answers by
Rumen
Telerik team
garfield
Top achievements
Rank 1
Scott Allen
Top achievements
Rank 1
Share this question
or