Hi
I'm trying to set up Serendipity as a News/Events page but I have one major problem I need to solve before it goes live.
I need to publish entries about Future/Coming soon dates.
eg. A music event on 12th March 2005
Serendipity allows me to enter these posts and they show up on the Recent Entries list, but they don't show in Categories or in the Calendar!
Please take a look
Many thanks.
How can I make the calendar show FUTURE events?
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: How can I make the calendar show FUTURE events?
Well, that they show up in "recent entries" was more a bug in the 0.7 version, which has been fixed in 0.8 so that future entries will never show up.
It was requested by most users, that this is how it's handled - future events shall not show up.
However you could easily fix that in your code.
You can open the 'serendipity_functions.inc.php' file and search for those functions:
serendipity_fetchEntries
serendipity_fetchEntry
serendipity_searchEntries
serendipity_printArchives
Then you can just remove the parts related to "timestamp <= time()" or timestamp <= now" (not the ones with $range in it!). Additionaly, you have to open serendipity_sidebar_items.php, find the calendarclass and there make the change again.
Since I see the need for that function, I have just added a configuration directive for this to our CVS - the snapshot which will be generated today will contain it.
It was requested by most users, that this is how it's handled - future events shall not show up.
However you could easily fix that in your code.
You can open the 'serendipity_functions.inc.php' file and search for those functions:
serendipity_fetchEntries
serendipity_fetchEntry
serendipity_searchEntries
serendipity_printArchives
Then you can just remove the parts related to "timestamp <= time()" or timestamp <= now" (not the ones with $range in it!). Additionaly, you have to open serendipity_sidebar_items.php, find the calendarclass and there make the change again.
Since I see the need for that function, I have just added a configuration directive for this to our CVS - the snapshot which will be generated today will contain it.
# 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/
# 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/
Thanks very much. I'll try that now.
--Edit--
Right, I've changed 'serendipity/serendipity_functions.inc.php' so now the entries show up under categories and in the main blog. - Fantastic!
Now then, I can't find what to change in 'serendipity/serendipity_sidebar_items.php' so I still don't see the future events marked on the calendar.
I'm stumped. Any clues.
Cheers
Ian
--Edit--
Right, I've changed 'serendipity/serendipity_functions.inc.php' so now the entries show up under categories and in the main blog. - Fantastic!
Now then, I can't find what to change in 'serendipity/serendipity_sidebar_items.php' so I still don't see the future events marked on the calendar.
I'm stumped. Any clues.
Cheers
Ian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hm, you are right - I think in the old 0.7 days that part was inside serendipity_functions.inc.php - called something like "serendipity_printCalendar".
Regards,
Garvin.
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/
# 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/
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Yes, that was the right function.
Replace this code:
with this:
Have fun
Replace this code:
Code: Select all
// Find out about diary entries
$add_query = '';
$base_query = '';
if (isset($serendipity['GET']['category'])) {
$categoryid = serendipity_db_escape_string($serendipity['GET']['category']);
if (is_numeric($categoryid)) {
$base_query = 'serendipity[category]=' . $categoryid;
$add_query = '&' . $base_query;
$querystring = "SELECT timestamp
FROM {$serendipity['dbPrefix']}entries e,
{$serendipity['dbPrefix']}category c,
{$serendipity['dbPrefix']}entrycat ec
WHERE e.timestamp >= $ts
AND e.timestamp <= $endts
AND e.timestamp <= " . time() . "
AND e.isdraft = 'false'
AND e.id = ec.entryid
AND c.categoryid = ec.categoryid
AND c.category_left BETWEEN " . implode(' AND ', serendipity_fetchCategoryRange($categoryid));
}
if (!isset($querystring)) {
$querystring = "SELECT timestamp
FROM {$serendipity['dbPrefix']}entries e
WHERE e.timestamp >= $ts and e.timestamp <= $endts AND e.timestamp <= " . time() . " AND e.isdraft = 'false'";
}
Code: Select all
// Find out about diary entries
$add_query = '';
$base_query = '';
if (isset($serendipity['GET']['category'])) {
$categoryid = serendipity_db_escape_string($serendipity['GET']['category']);
if (is_numeric($categoryid)) {
$base_query = 'serendipity[category]=' . $categoryid;
$add_query = '&' . $base_query;
$querystring = "SELECT timestamp
FROM {$serendipity['dbPrefix']}entries e,
{$serendipity['dbPrefix']}category c,
{$serendipity['dbPrefix']}entrycat ec
WHERE e.timestamp >= $ts
AND e.timestamp <= $endts
AND e.isdraft = 'false'
AND e.id = ec.entryid
AND c.categoryid = ec.categoryid
AND c.category_left BETWEEN " . implode(' AND ', serendipity_fetchCategoryRange($categoryid));
}
if (!isset($querystring)) {
$querystring = "SELECT timestamp
FROM {$serendipity['dbPrefix']}entries e
WHERE e.timestamp >= $ts and e.timestamp <= $endts AND e.isdraft = 'false'";
}
# 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/
# 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/
No, that doesn't work I'm afraid!
It kills the Blog totally and gives this message:
By trial and error I think i've narrowed it down to this line:
It kills the Blog totally and gives this message:
--edit--Parse error: parse error in /home/fhlinux194/h/haf.org.uk/user/htdocs/serendipity/serendipity_functions.inc.php on line 402
INCLUDE_ERROR
By trial and error I think i've narrowed it down to this line:
Code: Select all
WHERE e.timestamp >= $ts and e.timestamp <= $endts AND e.isdraft = 'false'";
Done it!! (I think)
I edited just this line, manually:
Seems to work fine now for future events.
The problem is - I have no idea why it works now!
Thanks for your help.
Ian
I edited just this line, manually:
Code: Select all
WHERE e.timestamp >= $ts and e.timestamp <= $endts AND e.isdraft = 'false'";
The problem is - I have no idea why it works now!
Thanks for your help.
Ian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hm, I suppose something bad happened during Copy&Paste from here?
Anyways, give our 0.8 Smarty-powered version a chance if you want to test how the 'future entries' is easily configurable there.
Regards,
Garvin.
Anyways, give our 0.8 Smarty-powered version a chance if you want to test how the 'future entries' is easily configurable there.
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/
# 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/