Invenzzia »

Pages: [1]   Go Down
  Print  
Author Topic: OPTv2: Conditional whitespace  (Read 1084 times)
0 Members and 1 Guest are viewing this topic.
duclet
User

Offline Offline

Posts: 8


View Profile
« on: November 28, 2009, 16:27:06 »

Is there a way to specify within the template that the content of the specified tag should keep the whitespace as declared. Right now I see the <pre> tag does this but lets say I want the content of a <div> tag to keep the whitespace but only for that one div. So there something like <div keepwhitespace="yes"> I can use?
Logged
Zyx
Your programmer
Administrator
User
*****
Offline Offline

Posts: 291



View Profile WWW
« Reply #1 on: November 29, 2009, 08:30:09 »

Such feature is planned for OPT 2.1, but perhaps I'll do some extra patch for 2.0 branch, because you're not the first one who asks for it.
Logged

PozDrX, Zyx
---Invenzzia group---
duclet
User

Offline Offline

Posts: 8


View Profile
« Reply #2 on: November 30, 2009, 00:45:18 »

Cool. Thanks.

One other question that is somewhat similar. Is there a way to allow some comments to be displayed on the page but the rest is still hidden? Basically, I want to use the conditional if's to include some extra stylesheets if it is Internet Explorer. Currently, the only way to get it to display is to have printComments set to true. I don't want that since I would prefer those other comments not be shown.

Actually, as I am writing this, I just thought of a way and that is to have the HTML for that part in a variable. I noticed that when outputting a variable, the whitespace is kept in tact so I would assume that goes for the comments. However, I would prefer to stay away from using that since that kind of defeats the purpose of templating. Is there any other viable options?
Logged
Zyx
Your programmer
Administrator
User
*****
Offline Offline

Posts: 291



View Profile WWW
« Reply #3 on: November 30, 2009, 10:16:02 »

Of course, you can always generate certain comments with opt:literal:

Code:
<opt:literal type="comment">Some text here</opt:literal>

The result:

Code:
<!--Some text here-->

You can also use the "transparent" type. For example, in one of my projects I use the following code for conditional IE comments:

Code:
<opt:literal type="transparent">
<![CDATA[<!--[if lte IE 6]>]]><link rel="stylesheet" parse:href="$global.website.path~'design/ie.css'" type="text/css" /><![CDATA[<![endif]-->]]>
<![CDATA[<!--[if IE 7]>]]><link rel="stylesheet" parse:href="$global.website.path~'design/ie7.css'" type="text/css" /><![CDATA[<![endif]-->]]>
</opt:literal>

The comment tags are enclosed within CDATA sections. opt:literal strips the CDATA tags during compilation, leaving correct conditional IE comments.

See:

http://static.invenzzia.org/docs/opt/2_0/book/en/syntax.instructions.literal.html
http://wiki.invenzzia.org/wiki/Conditional_comments_for_IE
Logged

PozDrX, Zyx
---Invenzzia group---
duclet
User

Offline Offline

Posts: 8


View Profile
« Reply #4 on: November 30, 2009, 20:05:06 »

Thats what I get for not skimming the docs. That works perfectly. Thanks.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Subject Started by Replies Views Last post
OPTv2: OPT 2.1 - ideas and proposals Zyx 0 959 Last post March 14, 2009, 22:57:23
by Zyx
OPTv2: conditional prolog whumble 4 608 Last post March 03, 2011, 20:44:43
by whumble
OPTv2: Wyƛwietlanie komentarzy warunkowych « 1 2 » nediam 17 2218 Last post March 03, 2009, 20:24:32
by eXtreme