when i view the html code in page.tpl.php, it looks nice and formatted.

however, when i look at the page source generated by in browser, the same html often lacks line breaks (among other things) that seem to be present in the template. for instance, multiple line divs in the page.tpl.php condense into incredibliy large one liners that stretch way beyond the edge of the screen. it makes debugging and tweeking the css harder than it needs to be.

i realize that variables provided to the template may account for some of the crazy formatting. like menu links, etc.. But i know that tags that are placed on different lines in page.tpl.php are being joined into multipel lines.

1) is there a way to insert linebreaks into the "inline php" in the templates?
2) any other method for formatting this stuff better?

thanks in advance

Comments

Chill35’s picture

I had noticed that with Garland, when you get many tags for a post, links to 'add comment' and 'read more' get tangled with the tags and it becomes hard to read.

Looking at the CSS, I saw that links were floated left and tags were floated right. I did not want to change that.

So yes, the answer is yes, you can add line breaks. I did add one line break and it was in node.tpl.php. Template files are there to modify the basic way of organizing the html on the page. Node.tpl.php is probably the template you want to look at. Not page.tpl.php. (And there's also block.tpl.php). Using these files in tandem with style.css will get you closer to what you want to see.

Line breaks are not the way to go usually, with layout... but if you can't fix it in the CSS, please do so in the template files. That's my opinion. Or split in different blocks...

The way I do it when I work in the template files is that I keep a notebook and take note of every single change I make, why I make it, and on what line and in what file. I also add a comment above the line with my name.

When I play with the css file, I only add rules at the bottom of the stylesheet --- that way they are all in the same place, I don't mess with what's already there, and "I" get CSS specificity by appearing last. Instead of rewriting rules, I add my own rules. The garland .css file is already bloated (1000-so lines).

Good luck!