Page 1 of 1

functions_config.inc.php question regarding preview

Posted: Thu Aug 07, 2008 10:57 pm
by Don Chambers
What is the purpose of this 225px div???? It definitely seems to interfere with some templates - placing a 225px tall div above the entry body in preview.

Code: Select all

        case 'preview':
            echo '<div style="float: left; height: 225px"></div>';
            serendipity_printEntries(array($entry), ($entry['extended'] != '' ? 1 : 0), true);
            echo '<br style="clear: both" />';

            $show = true;
            break;
    }

Posted: Thu Aug 07, 2008 11:24 pm
by judebert
Don't know. I'm betting it's there to clear the header background in the default admin page.

Posted: Fri Aug 08, 2008 9:53 am
by garvinhicking
Hi!

I do not remember exactly, but I know it was needed so that the preview body was not cutoff.

I only remember, we had larger trouble without this floating div...

Regards,
Garvin

Posted: Fri Aug 08, 2008 4:22 pm
by Don Chambers
Well, most templates render their entries beginning with a div serendipity_Entry_Date.... if any template clears that div, they will get 225px of dead space above it. I do not know how widespread the issue could be.. I just happened to notice it in a template I was helping someone with.

Posted: Fri Aug 08, 2008 7:56 pm
by yellowled
Don Chambers wrote:Well, most templates render their entries beginning with a div serendipity_Entry_Date.... if any template clears that div, they will get 225px of dead space above it. I do not know how widespread the issue could be..
Oh. My. God.

I have experienced this particular 225px wide div problem in previews so many times ... can we please assign an id to this div so template designers can hide it in the preview window (using display: none;) if it creates problems?

YL

Posted: Wed Dec 17, 2008 11:30 pm
by Don Chambers
yellowled wrote:
Don Chambers wrote:Well, most templates render their entries beginning with a div serendipity_Entry_Date.... if any template clears that div, they will get 225px of dead space above it. I do not know how widespread the issue could be..
Oh. My. God.

I have experienced this particular 225px wide div problem in previews so many times ... can we please assign an id to this div so template designers can hide it in the preview window (using display: none;) if it creates problems?

YL
This should be a no-brainer for 1.4.... while I could add it myself, I do not want to ruffle any feathers....

So Garvin, can you add a class or id to this div? I have yet to encounter its benefits, but it seems to be a problem for me more often than not.

My suggestion: <div id="preview_spacer">

Posted: Thu Dec 18, 2008 12:11 am
by garvinhicking
Hi!

id="serendipity_preview_spacer" would be clearer to me, IMHO. Otherwise people might think it's a spacer needed for Bulletproof or other CSS framework hacks, and not be s9y specific? You can add that if you like?

Regards,
Garvin

Posted: Thu Dec 18, 2008 12:26 am
by Don Chambers
Committed as suggested by Garvin. I cannot help but wonder if this div is even still necessary in any template, or exactly what its purpose is... but at least a template designer can now hide it.

Posted: Thu Dec 18, 2008 2:02 am
by yellowled
Don Chambers wrote:I cannot help but wonder if this div is even still necessary in any template, or exactly what its purpose is... but at least a template designer can now hide it.
Yay! :-)

So, let's see if we can find out more about the little bastard. It's a div container without content with inline styles float: left; and height: 225px;.

I'd say the fixed height indicates that it's supposed to ... I don't know, maybe act as some kind of spacer? I'm trying to think - no offense - more like a coder than a template designer here. Maybe this was meant to produce some kind of spacing without having to put up with side effects margin or padding could have produced?

The float is another thing. Why float something which has no content? The only reason to float something which isn't actually meant to be floated is to clear a float with a float. (Boy, I bet no one can follow this! :-D)

Hmmmm.

YL

Posted: Thu Dec 18, 2008 3:47 am
by Don Chambers
yellowled wrote:So, let's see if we can find out more about the little bastard.
I have been trying to do that with YOU for a few years now!! :lol: :lol: :lol:

As I first mentioned, I have never discovered any template that actually benefits from this. I have not, however, investigated every possible template.

I agree with you questioning the float rule - why float it? If you want it to completely replace everything, you would display: block; width: 100% (or something) the whole thing.... floating keeps the possibility open that something could wrap around it.

The only possible exception I can think of is if a template places a tall background graphic on <body>... and preview_iframe.tpl loads <body> styles that interfere with entry body now that the header/banner is not showing for an entry preview.....

I pulled up about a half dozen templates in the current distribution pack - none seem to benefit from this, newer templates, depending on their html structure and css, were not hurt by it. Others would have benefited WITHOUT it.

I say, get rid of it!!!

Posted: Thu Dec 18, 2008 12:47 pm
by yellowled
Don Chambers wrote:If you want it to completely replace everything, you would display: block; width: 100% (or something) the whole thing....
You're thinking like a web designer. Don't.
Don Chambers wrote:I pulled up about a half dozen templates in the current distribution pack - none seem to benefit from this, newer templates, depending on their html structure and css, were not hurt by it.
I think out question right now is not so much what it does but why it appears. Remember the other day when we were discussing the bluetrip-based template I was working on? I didn't get the spacer div in that one's preview, but I do get it in the same dev blog with other templates. So there must be something in a template or it's preview_iframe.tpl which "triggers" the spacer div. Now, what may that be?
Don Chambers wrote:I say, get rid of it!!!
C'mon, where's the Don Chambers I know who wants to investigate every little bug until he knows why the bug appeared in the first place? :wink:

YL

Posted: Thu Dec 18, 2008 3:31 pm
by Don Chambers
I doubt there is any real mystery behind it - just depends on the html structure and css of the template. So you have preview_iframe.tpl, entries.tpl, and css. To top it off, we have templates that are <table>s and some are <div>s.

I do not have the time to dig any deeper into it right now. Wish I did.