Page 1 of 1

[No entries to print]on category

Posted: Thu Mar 05, 2009 11:35 pm
by newway
hi all,
i have recently upgraded Serendipity to 1.4.1 - from 1.3
but found out somehow my category doesn't feel right -
when i click any category it returns no result - the "No entries to print"

anyone had any clue?
I cannot see anything wrong with my Mysql though...

one thing to note, when I go to admin page after I replaced all my 1.3 files, it didn't see any "Serendipity upgrader", but the version said 1.4.1 ...

Re: [No entries to print]on category

Posted: Fri Mar 06, 2009 1:14 am
by Don Chambers
Can you post a URL to your site?

Re: [No entries to print]on category

Posted: Sat Mar 07, 2009 3:56 pm
by newway
http://www.wei.staff.shef.ac.uk/blog/

i am suspecting that something went wrong during the upgrading...

Re: [No entries to print]on category

Posted: Sat Mar 07, 2009 4:14 pm
by Don Chambers
I'm not certain. You could FTP upload all the files again, overwriting everything, then open the file serendipity_config_local.inc.php which will have a line in it like this:

Code: Select all

$serendipity['versionInstalled']  = '1.4.1';
Simply change that version number to something lower, such as 1.3, write the file back to your server, then hit your site. It should trigger the upgrade process again.

Re: [No entries to print]on category

Posted: Mon Mar 23, 2009 2:44 pm
by rockblog
I've been having similar problem for over a year already. It kinda dismotivated me from blogging but I thought I'd give it one more try now, and ask advice here (been spending days on trying to solve this every now and then for the past year).

My blog can be found at: http://blog.rockreviews.org
As you can see the blog functions otherwise well but if you try the RSS feed link of Categories or click the category, it will say that the category doesn't have any entries to print (in reality most of them have, and the amount is included correctly inside the parentheses). However, the syndication RSS feed that I included at the bottom of right navigation bar seems to work fine :P

I've been searching for solution with no luck (also been updating serendipity always to latest version yet this issue hasn't gotten fixed). I tried different templates and it won't work on those either, so it's not my custom templating work either. So if you have any ideas which might be causing this, or can point the direction to look at, it would be most appreciated :)

Re: [No entries to print]on category

Posted: Mon Mar 23, 2009 3:20 pm
by garvinhicking
Hi!

Not only the RSS feeds are broken, but also any usual pages like: http://blog.rockreviews.org/categories/ ... g-the-site

Usually, this only happens when either the URL Rewriting does no longer work or when the database scheme differs from what serendipity would expect (read: a failed upgrade).

When did this start happening? When you upgraded? If so, can you access a tool like phpMyAdmin and tell us which columns you have in the serendipity_categories database table?

It might help, if you could edit the file include/functions_entries.inc.php and there search for the serendipity_fetchEntries() function. At the end of it, you should see a line like:

Code: Select all

// die($query);
Remove those two "//" and save the file, then view your page. You should see a longer SQL statement, this is the query that gets executed. You could copy+paste that one to phpMyAdmin and see if you get an error; or copy and paste it here, we might be able to see if there are some conditions that fail...

Regards,
Garvin

Re: [No entries to print]on category

Posted: Tue Mar 24, 2009 4:22 pm
by rockblog
Hi Garvin,

thanks for the quick reply. This started happening just all of the sudden with my blog (not after an upgrade or anything). My host kinda became unreliable with lots of downtime, and sadly I didn't have any prior backup of the blog... so before I managed to fix this issue, to further complicate things I had to change webhost and I took this somehow "bugged" backup with me to the new webhost. From there onwards I've been upgrading my blog to most recent build always, and been wishing to solve this issue on my own but thus far no luck :/

My database table is called Blog_category instead of plural "categories" (is this the problem?)
it consists of categoryid, category_name, category_icon, category_description, authorid, category_left, category_right, parentid

Is there anything missing that should be there?

I just followed your instructions but phpMyAdmin doesn't give any error (simply returns 0 rows as result)... the SQL statement is as follows:
SELECT ep_sticky.value AS orderkey, e.id, e.title, e.timestamp, e.comments, e.exflag, e.authorid, e.trackbacks, e.isdraft, e.allow_comments, e.last_modified, a.realname AS author, a.username AS loginname, a.email , e.body, e.extended FROM Blog_entries AS e LEFT JOIN Blog_authors a ON e.authorid = a.authorid LEFT JOIN Blog_entrycat ec ON e.id = ec.entryid LEFT JOIN Blog_category c ON ec.categoryid = c.categoryid LEFT OUTER JOIN Blog_entryproperties ep_access ON (e.id = ep_access.entryid AND ep_access.property = 'ep_access') LEFT JOIN Blog_entryproperties ep_sticky ON (e.id = ep_sticky.entryid AND ep_sticky.property = 'ep_is_sticky') LEFT JOIN Blog_authorgroups AS acl_a ON acl_a.authorid = 0 LEFT JOIN Blog_access AS acl_acc ON ( acl_acc.artifact_mode = 'read' AND acl_acc.artifact_type = 'category' AND acl_acc.artifact_id = c.categoryid ) WHERE isdraft = 'false' AND (( (c.category_left BETWEEN 0 AND 0))) AND e.timestamp <= 1237907100 AND (ep_access.property IS NULL OR ep_access.value = 'public') AND ( c.categoryid IS NULL OR ( acl_acc.groupid = 0) OR ( acl_acc.artifact_id IS NULL ) ) GROUP BY e.id ORDER BY orderkey DESC, timestamp DESC LIMIT 15
Thanks for taking the time to help, I really appreciate this =) I think the problem most likely lies in the database since normal articles like: http://blog.rockreviews.org/archives/44 ... oning.html work just fine, and it somehow is able to find the correct amount of articles assigned to each category on the sidebar.

Re: [No entries to print]on category

Posted: Wed Mar 25, 2009 11:33 am
by garvinhicking
Hi!

Okay, the trouble seems to stem from the part "c.category_left BETWEEN 0 AND 0".

This NEVER happens, thus the query returns no entries.

This "0" comes from the URL, where the category-URL actually tries to be matched to a category ID. If your permalink of the categories does not hold a %id% portion, the lookup would be performed on the Blog_permalinks DB tabe. In your case, you do have the %id% in the URL string, so some other mismatching must happen.

Let's take this on by checking some more things. Open up your index.php file in the editor, this is where the main redirection logic of Serendipity is kept. At around the middle of the file, the URL is checked against all possible URL variants to see, what kind of URL serendipity should open when you view a category.

The precise case to view a category is this one:

Code: Select all

} else if ($is_multicat || preg_match(PAT_PERMALINK_CATEGORIES, $uri, $matches)) {
At around line 405. Now we'd have to see if this really gets evaluated in your case. So, after this IF statement insert a

Code: Select all

die('CATEGORY VIEW');
statement, and view your category URL. See if you get this output only. If you do, we can work on further from that and see why $serendipity['GET']['category'] is not properly assigned. To do this, within the same IF-clause a few lines down you see:

Code: Select all

    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
(line 459) - there, you simply change it to:

Code: Select all

    die('CATEGORY-ID:' . print_r($serendipity['GET']['category'], true));
    include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
and see which output you get.

Now for the other case, if you DO NOT get the "CATEGORY VIEW" output previously, we would need to check why the regular expression does not match.

To do that, you put this code at the VERY END of the index.php file, and you should see the output in the HTML sourceode of your blog then:

Code: Select all

if ($is_multicat) {
  echo 'MULTICAT.';
} else {
  echo 'NO MULTICAT.';
}

echo 'Matching ' . PAT_PERMALINK_CATEGORIES . ' on ' . $uri . ':';
if (preg_match(PAT_PERMALINK_CATEGORIES, $uri, $matches)) {
  echo 'Matched : ' . print_r($matches, true) ;
} else {
  echo 'Match fail.';
}
HTH,
Garvin

Re: [No entries to print]on category

Posted: Wed Mar 25, 2009 12:56 pm
by rockblog
I tried it and got the category view output... and apparently based on different category it does print the category correctly. For example, second category News would return "CATEGORY-ID:2" and first Regarding site category returns "CATEGORY-ID:1"

Re: [No entries to print]on category

Posted: Wed Mar 25, 2009 2:01 pm
by garvinhicking
Hi!

Okay, this does help us further. So it seems the general fetching does work.

Now let's proceed on how the category_left BETWEEN 0 and 0 statement is created. Can you check your Blog_category (singular, I posted it wrong in the first time) table and see, what the columns "category_left", "category_right" and "hide_sub" are set to?

I bet that the column "hide_sub" does not exist for you. This is a column that was introduced in a serendipity 1.2 update. So if your update didn't execute there, you'd have a database schema that does not comply with the actual one.

If your hide_sub column is missing, you can use phpMyAmdin to create it for you:

Code: Select all

ALTER TABLE Blog_category ADD COLUMN sort_order int(11);
ALTER TABLE Blog_category ADD COLUMN hide_sub int(1);
CREATE INDEX categoryso_idx ON Blog_category (sort_order);
Regards,
Garvin

Re: [No entries to print]on category

Posted: Wed Mar 25, 2009 3:03 pm
by rockblog
wow, you're good :) that "hide_sub" column indeed was missing, and once I executed that code to alter my database and reverted back to original index.php my blog is back to being fully functional.

Thanks you so much :mrgreen: now I sure don't have a single doubt about what CMS to recommend my friend to use for her personal blog site :wink:

hmm, is there anything else my 1.2 update might have not done that I should be aware of?

Re: [No entries to print]on category

Posted: Wed Mar 25, 2009 3:10 pm
by garvinhicking
Hi!

You're welcome. A few months ago, this specific issue was more on my radar, I'm sorry that this didn't come back to my attention earlier in this thread. But all is well that ends well. :-)
hmm, is there anything else my 1.2 update might have not done that I should be aware of?
You might want to browse through the sql/db_update*_mysql.sql files and check, if the mentioned new columns there all exist on your installation?

Regards,
Garvin

Re: [No entries to print]on category

Posted: Wed Mar 25, 2009 5:18 pm
by rockblog
Yup, they all were there. And I went through my database to make sure everything else is in order... seems only had that one sql update missing :oops:

No need to be sorry, we got this glitch solved rather quickly :) Thanks once more for your excellent work with Serendipity ^^