cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

setting DOCTYPE declaration

Former Member
0 Likes
1,746

I need a DOCTYPE declaration at the top of a portal component's html output in order to make some CSS features work. If you don't know what I am talking about, its a declaration of the type

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

at the top of an html page.

Does anyone know where to set this and on what level.

I noticed the html of SDN does have the DOCTYPE declaration, but our own portal doesn't seem to produce this DOCTYPE declaration.

Accepted Solutions (0)

Answers (4)

Answers (4)

anton_malan
Discoverer
0 Likes

Hallo Theo

I had a look at the example in the A list apart article. I saved the html and css files locally and removed the DOCTYPE declaration and the xml namespace declaration from the html element. I checked the result in Firefox, IE6, IE5.5 and IE5.1, but there was no difference to the layout with the declaration.

You're welcome to e-mail me an example of your HTML mockup and the css and I could look at it.

Regards

Anton

0 Likes

Just to add my little pennys worth. We had a major problem with adding the DOCTYPE statement to the top of the SDN site. With the portal there are severe problems with some of the javascript objects when setting the DOCTYPE to be strict XHTML, and you will probably find a blank square window in the top left of the screen. I believe that this is an iframe that is used to display soem of the messages within the portal which is normally only displayed when certain events happen. However, when setting the doctype to XHTML I found that the iframe was displayed in the top left and without changing the standard javascript of the portal I couldn't get rid of this.

Also, as a side note, there are major differences in CSS when using strict or querks mode of the browsers. Obviously there are ways of getting around this, but it is a painful process.

Email me if you would like me to explain how we managed to get this doctype into the browser.

D

anton_malan
Discoverer
0 Likes

Hallo Theo

I cannot answer your question about how to do it, but I rather question why you would want to.

If one excludes the doctype declaration from an html document or include an incomplete one like the declaration at sdn, one switches modern browsers to rendering the html in so-called "quirks mode". In this mode, a modern browser renders according to the non-standard layout behaviour of older browsers. Some pages may in fact rely on being rendered like that. I would not be surprised if EP relies on such layout behaviour.

If one includes a complete doctype declaration, the browser's rendering mode may be switched to a "strict" or "almost strict" mode. If you do that to pages that rely on non-standard layout behaviour, the layout will appear to be "broken".

The article that I referred to, has good advice on which doctype may be the most appropriate. When an html document does not validate, like the pages at sdn, then rather do not use any doctype.

I am not sure what CSS features are not working without a doctype declaration. If you let me know more about that, I may be able to help.

Anton

Former Member
0 Likes

Anton,

The context is an attempt to create an css based dynamic menu for the portal as a replacement for the default portal menus. I want to entire hieararhy to be visible on the client without a requirement to post back to the server to drill down into the hierarchy as the SAP delivered detailed nav does.

There is the additional requirement to have rounded corners for menu tabs, which is something I also want to achieve through CSS.

My portal component builds an unnumbered list from the portal menu structure. CSS class definitions turn this list into a horizontal dynamic menu.

The idea is inspired by examples available at the following URLs

http://www.alistapart.com/articles/horizdropdowns/

and

http://www.seoconsultants.com/css/menus/tutorial/

The current status of my test project is that the menu works in a pure HTML mockup with the DOCTYPE at the top, but not within the context of my portal component.

PS : thanks for the reference to DOCTYPE article. There is a similar one at alistapart btw which I already read and which is exaxtly the reason why I am trying to set the doctype and see if this solves my problem : http://www.alistapart.com/articles/doctype/

anton_malan
Discoverer
0 Likes

Hi Theo

Even with the DOCTYPE that you note at sdn, modern browsers are switched to quirks mode, instead of strict mode, since it is an incomplete declaration without a reference to the DTD. That has exactly the same effect as not having a DOCTYPE declaration. You might find that switching IE to strict mode, might have unintended rendering effects in the portal.

See a good discussion here: http://hsivonen.iki.fi/doctype/

Former Member
0 Likes

Hi Anton,

thanks for your reply. Haven't tried that yet, switching my browser to strict mode, but it would indeed not surprise me that this leads to some strange effect.

However that does not really answer my question : how can I set the DOCTYPE in the html output of my portal : is it a configuration done with the Visual Admin, do I need to customize the portal's pagebuilder. It's clear you cannot control it from within a portal component as this always get wrapped by an external html container.

In case you or anyone else here has an idea, I would be glad to read that in this thread.

Theo

Former Member
0 Likes

OK, apparently not a clear statement of my problem. So a second try :

Please compare :

This : Source of the page you are currently looking at on SDN. At the top you will find the document type declaration

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

with the HTML of your SAP Enterprise Portal (NW 04 SPS 11 or any other version).

there the portal page starts with <html> but without any document type declaration.

The absence of the document type declaration can cause problems in your browser for correctly handling some CSS features.

So, the question is : if I want to have a document type declaration at the top of my portal page, how do I proceed ? At what level do I need to make changes ? Is it configuration on a global level, is it customization of a JSP, can I add this from within the code of my portal component (which I doubt) or what ?

SDN developers should be able to answer the question as their portal DOES have the document type at the top.