functions_config.inc.php question regarding preview

Discussion corner for Developers of Serendipity.
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

functions_config.inc.php question regarding preview

Post 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;
    }
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Don't know. I'm betting it's there to clear the header background in the default admin page.
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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">
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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!!!
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.
=Don=
Post Reply