s9y 1.5beta1 - Preview stopped to work [solved]

Found a bug? Tell us!!
Post Reply
iwkse
Posts: 2
Joined: Mon Nov 02, 2009 11:47 pm

s9y 1.5beta1 - Preview stopped to work [solved]

Post by iwkse »

Hi all,
i'm using s9y 1.5beta1 and i notice an issue with showing the preview of new or old posts.
While clicking on preview i have this error:

Code: Select all

Error in SELECT count(distinct e.id)
ERROR: missing FROM-clause entry for table "e" LINE 1: SELECT count(distinct e.id) ^
I see it's referring to function serendipity_getTotalEntries in include/functions_entries_inc.php
$serendipity['fullCountQuery'] looks like empty here.
I'm using postgresql and php 5.2.6

---------------------------------------------------------------------------------------------

Now the preview is working again, i did two main changes:
Made available this to serendipity_getTotalEntries()

Code: Select all

// Store the unique query condition for entries for later reference, like getting the total article count.
    $serendipity['fullCountQuery'] = "
                FROM
                    {$serendipity['dbPrefix']}entries AS e";
    if ($joinauthors) {
        $serendipity['fullCountQuery'] .= "
                    LEFT JOIN {$serendipity['dbPrefix']}authors a
                        ON e.authorid = a.authorid";
    }

    if ($joincategories || !isset($serendipity['enableACL']) || $serendipity['enableACL'] == true) {
        // Category joins are REQUIRED when the ACLs are enabled.
        $serendipity['fullCountQuery'] .= "
                    LEFT JOIN {$serendipity['dbPrefix']}entrycat ec
                        ON e.id = ec.entryid
                    LEFT JOIN {$serendipity['dbPrefix']}category c
                        ON ec.categoryid = c.categoryid";
    }
    
    if ($joinown) {
        $cond['joins'] .= $joinown;
    }

    $serendipity['fullCountQuery'] .="
                    {$cond['joins']}
                    {$cond['and']}";
and comment out this:

Code: Select all

parent.document.getElementById('serendipity_iframe').style.height = document.getElementById('mainpane').offsetHeight
                                                                               + parseInt(document.getElementById('mainpane').style.marginTop)
                                                                               + parseInt(document.getElementById('mainpane').style.marginBottom)
                                                                               + 'px';

which breaks the preview giving the wrong height.

This is a fast hack though, but i've noticed the issue is still present in svn code.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: s9y 1.5beta1 - Preview stopped to work [solved]

Post by garvinhicking »

Hi!

Hm, the fullcountquery should actually always be set; a missing "FROM" clause should never really occur. While your hack might work on your specific installation, this would break a couple of things.

Did you do any other manual modifications to your blog? Did you use any custom templating that utilizes smarty {fetchPrintEntries} or similar functions?

The other code you uncommented would mean that you are using a preview_iframe.tpl that is not built for your own template; this file always need adaptation if you do not use the normal s9y class names for containers...

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/
iwkse
Posts: 2
Joined: Mon Nov 02, 2009 11:47 pm

Re: s9y 1.5beta1 - Preview stopped to work [solved]

Post by iwkse »

Hi Garvin!

Thanks for your reply, i'm using the theme/template Bex01 which doesn't seem to use {fetchPrintEntries} or something similar i think.
Probably i did some other small modifications, what i actually did is to switch form s9y 1.4 to 1.5beta1 and i think i had to do few small changes to let it works or to let away the warnings. Anyway if this is only my personal issue it's ok since i found a workaround to it.

Keep the occasion to thank you & the other s9y developers for the great blog, i like it a lot :-)

Best regards
Salvatore
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: s9y 1.5beta1 - Preview stopped to work [solved]

Post by garvinhicking »

Hi!

You're welcome! If it surfaces again, just come back here and we'll try to investigate it some more :)

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/
cvelo
Posts: 2
Joined: Thu Apr 22, 2010 1:38 pm

Re: s9y 1.5beta1 - Preview stopped to work [solved]

Post by cvelo »

I have recently upgraded from 1.4.1 to 1.5.2 and am using the BEX01 theme and old and new blog entry previews have also stopped working for me. I haven't done any customizations of the BEX01 theme or the Serendipity installation.
I am not seeing any errors when I click on preview - just a thin green line (like the top of my BEX01 theme).
Unfortunately the code in serendipity_getTotelEntries has changed so the workaround posted will not work for me. :-(
(fyi: using PHP version 4.3.9)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: s9y 1.5beta1 - Preview stopped to work [solved]

Post by garvinhicking »

Hi!

Does the bex01 template have a "preview_iframe.tpl" file? This one is usually the culprit when the CSS and the HTML structure of the preview code do not match up. Usually this is caused when template authors port over foreign templates, without adapting the preview_iframe.tpl file to match the global HTML structure, so that usual CSS can be applied properly...

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/
cvelo
Posts: 2
Joined: Thu Apr 22, 2010 1:38 pm

Re: s9y 1.5beta1 - Preview stopped to work [solved]

Post by cvelo »

Thanks for the response.
Actually, the BEX01 does not appear to have a "preview_iframe.tpl" file. The temporary workaround I ended up using was to edit the $SERENDIPITY_HOME/serendipity_config.inc.php file and set the value:

Code: Select all

$serendipity['use_iframe'] = false;
I don't get the full preview with header and footer, but I can preview enough of my blog entry to be somewhat workable.
Post Reply