Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

outline


Go to End


7 Posts   1985 Views

Avatar
Nicolaas

Forum Moderator, 224 Posts

14 May 2007 at 4:48pm

Hi Folk

I am just building my first site and one thing that really pisses me off is that the outline of the html is a bit messy. I like my outline to be precise so that I can visually see immediately what is going on

<div>
<ul>
<li>
etc....

Are there any tricks to get this sorted?

Avatar
Sean

Forum Moderator, 922 Posts

14 May 2007 at 6:27pm

Are you meaning the HTML Source Editor for the CMS editor box?

Cheers,
Sean

Avatar
Willr

Forum Moderator, 5523 Posts

14 May 2007 at 6:30pm

Edited: 14/05/2007 6:45pm

do you mean indentation? - http://en.wikipedia.org/wiki/Indent_style eg I use something like.

div
-tab-- ul
--2 tabs---- li
--2 tabs---- li
-tab-- /ul
/div

EDIT: ah forum doesnt like indentation. And Sean posted a second quicker then me! yeah I have noticed TinyMCE outputs shit in its html editor.. I would perhaps just copy the code from there into a HTML formatter (trying to find a link) and then copy it back...

Avatar
Sean

Forum Moderator, 922 Posts

14 May 2007 at 6:57pm

Edited: 14/05/2007 7:01pm

It's difficult, if not impossible to make the code in the source editor look 'nice' as well as it being editable. Otherwise we'd be making an inline HTML editor like TextMate on the web. :-)

Here's a parser to tidy up the HTML;

http://infohound.net/tidy/

I've used this before with badly formed HTML inside the WYSIWYG editors, it does a fairly good job at cleaning up the mess TinyMCE cannot handle.

Also, in terms of the forum - we've already developed some ways of inserting styles in these forum posts like my bold text and [link]www.google.com[/link], similar to BB code. We're in the process of testing. This means you can put some snippets of PHP or HTML in these posts with syntax highlighting and actual tabbing. :-)

Cheers,
Sean

Avatar
Nicolaas

Forum Moderator, 224 Posts

14 May 2007 at 9:40pm

Hey Dudes

Sorry, what I meant is for my actual published website. The one that I have just created and it would be easier to work with the css if saw the outline (indentation) in a logical way.

My template page is outlined (indented) correctly, for example:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<% base_tag %>
$MetaTags
<link rel="stylesheet" type="text/css" href="$project/css/style.css" />
<link rel="stylesheet" type="text/css" href="$project/css/typography.css" />
</head>
<body>

the base tag and the meta tag may not be in the right place. it would be nice if the indentation was perfectly clean. I know that this would probably be a real luxury, but if you suffer from OCD then it is a bit of a must have ;-)

Nicolaas

Avatar
Ingo

Forum Moderator, 801 Posts

15 May 2007 at 8:42am

Edited: 15/05/2007 8:44am

as sean mentioned, thats what you use tidy for (php-integration at: http://www.php.net/tidy)...
for complex sites, its just too much hassle to keep track of the indentation-level across multiple nested templates.
for simple sites: make sure that you don't have any whitespace between template-commands and the following html (ugly, but keeps indentation correct).
or even easier: use a proper source-viewer in your browser ;) install firefox web deveoper toolbar, firebug and the "source chart"-plugin

Avatar
Nicolaas

Forum Moderator, 224 Posts

15 May 2007 at 10:07am

Hi Ingo

I am familiar with the solutions you mention, but is there an easy way to add it to my SS development? I am completely new to SS and I was wondering if you could just add a command or something that would clean up the html.

Thank you

Nicolaas