Could someone point me in the right direction to figure out how to do this? I thought it had something to do with the rss feed, but I can't seem to get things to come out right.
Thanks.
Feeding blog topics into static html page
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Feeding blog topics into static html page
Hi!
You need to describe this more detailed. Do you mean with "static html page" something unrelated to your blog? Or you you mean a "static page" using the s9y static page plugin?
You have various options, like using the serendipity_event_backend plugin for using JS to show feed topics.
Or using an RSS Feed parser (PHP-tools are available) for your RSS Feeds.
Or using custom PHP code by using the serendipity_fetchEntries function (search the forum for that keyword).
Or using the serendipity_event_smartymarkup plugin and using {serendipity_fetchPrintEntries}. Read the www.s9y.org technical docs or search the forums for details on that.
Best regards,
Garvin
You need to describe this more detailed. Do you mean with "static html page" something unrelated to your blog? Or you you mean a "static page" using the s9y static page plugin?
You have various options, like using the serendipity_event_backend plugin for using JS to show feed topics.
Or using an RSS Feed parser (PHP-tools are available) for your RSS Feeds.
Or using custom PHP code by using the serendipity_fetchEntries function (search the forum for that keyword).
Or using the serendipity_event_smartymarkup plugin and using {serendipity_fetchPrintEntries}. Read the www.s9y.org technical docs or search the forums for details on that.
Best 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/
Has anyone else been successful in using the serendipity_event_backend plugin? I'm pretty sure it's what I want, but I can't seem to make it work. For example, the readme file says the script should looks something like this:
So, I tried to do something similar, using a category from the blog:
I put both of the above into a page, and only get the first one:
http://www.neoutdoorvoice.com/blogfeedtest.html
Any ideas on what I'm doing wrong? Have I messed up something in the setup of the plugin?
Code: Select all
<script src="http://blog.linux-stats.org/plugin/backend?details=1&category=s9y&num=30&order=DESC&date=1&dateformat=d.m.Y&time=1&timeformat=H:i"></script>Code: Select all
<script src="http://www.neoutdoorvoice.com/blogs/plugins/backend?details=1&category=all&num=30&order=DESC&date=1&dateformat=d.m.Y&time=1&timeformat=H:i"></script>http://www.neoutdoorvoice.com/blogfeedtest.html
Any ideas on what I'm doing wrong? Have I messed up something in the setup of the plugin?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You are just using the wrong URL; your Blog does not have URL Rewriting enabled, so you need to prefix the URL like this:
This should work.
Regards,
Garvin
You are just using the wrong URL; your Blog does not have URL Rewriting enabled, so you need to prefix the URL like this:
Code: Select all
http://www.neoutdoorvoice.com/blogs/index.php?/plugin/backend?details=1&num=30&order=DESC&date=1&dateformat=d.m.Y&time=1&timeformat=H:i
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/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You would need to edit the plugin file for that.
Best regards,
Garvin
You would need to edit the plugin file for that.
Best 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/
I'm assuming that means editing the serendipity_event_backend.php file, but I have no idea what to change when I look at it. If it was a .tpl file, or even a .css I might be able to figure it out, but the .php file has me stumped.
Here's what's in the serendipity_event_backend.php file if that's helpful:
I'm guessing it has something to do with this part:
Then again, I'm only guessing...
Can I get another hint Garvin? Please?
Here's what's in the serendipity_event_backend.php file if that's helpful:
Code: Select all
<?php
# (c) 2005 by Alexander 'dma147' Mieland, http://blog.linux-stats.org, <dma147@linux-stats.org>
# Contact me on IRC in #linux-stats, #archlinux, #archlinux.de, #s9y on irc.freenode.net
// Probe for a language include with constants. Still include defines later on, if some constants were missing
$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
include $probelang;
}
include dirname(__FILE__) . '/lang_en.inc.php';
#########################################################################################
class serendipity_event_backend extends serendipity_event {
var $debug;
function introspect(&$propbag) {
global $serendipity;
$propbag->add('name', PLUGIN_BACKEND_TITLE);
$propbag->add('description', PLUGIN_BACKEND_DESC);
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '0.1');
$propbag->add('author', 'Alexander \'dma147\' Mieland, http://blog.linux-stats.org, dma147@linux-stats.org');
$propbag->add('stackable', false);
$propbag->add('event_hooks', array(
'external_plugin' => true
)
);
$propbag->add('configuration', array(
'backendurl'
)
);
$propbag->add('groups', array('FRONTEND_FULL_MODS'));
$this->dependencies = array('serendipity_event_entryproperties' => 'keep');
}
function introspect_config_item($name, &$propbag)
{
global $serendipity;
switch($name) {
case 'backendurl' :
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_BACKEND_BACKENDURL);
$propbag->add('description', PLUGIN_BACKEND_BACKENDURL_BLAHBLAH);
$propbag->add('default', 'backend');
break;
default:
return false;
}
return true;
}
function generate_content(&$title) {
$title = PLUGIN_BACKEND_TITLE;
}
function event_hook($event, &$bag, &$eventData) {
global $serendipity;
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
case 'external_plugin':
$uri_parts = explode('?', str_replace('&', '&', $eventData));
// Try to get request parameters from eventData name
if (!empty($uri_parts[1])) {
$reqs = explode('&', $uri_parts[1]);
foreach($reqs AS $id => $req) {
$val = explode('=', $req);
if (empty($_REQUEST[$val[0]])) {
$_REQUEST[$val[0]] = $val[1];
}
}
}
$req = trim($uri_parts[0]);
switch($req) {
case $this->get_config('backendurl'):
if (!headers_sent()) {
header('HTTP/1.0 200');
}
if (isset($_REQUEST['category']) && !empty($_REQUEST['category'])) {
$category = trim(urldecode($_REQUEST['category']));
} else {
$category = '';
}
if (isset($_REQUEST['num']) && !empty($_REQUEST['num'])) {
$num = intval(trim(urldecode($_REQUEST['num'])));
} else {
$num = 10;
}
$order = (strtolower(trim(urldecode($_REQUEST['order'])))=='asc' ||
strtolower(trim(urldecode($_REQUEST['order'])))=='desc' ?
trim(urldecode($_REQUEST['order'])) :
"DESC");
$showdate = (intval(trim(urldecode($_REQUEST['date']))) >= 1 ?
1 : 0);
$dateformat = (trim(urldecode($_REQUEST['dateformat']))!='' ?
trim(urldecode($_REQUEST['dateformat'])) :
"Y-m-d");
$showtime = (intval(trim(urldecode($_REQUEST['time']))) >= 1 ?
1 : 0);
$timeformat = (trim(urldecode($_REQUEST['timeformat']))!='' ?
trim(urldecode($_REQUEST['timeformat'])) :
"g:ia");
$point = (trim(urldecode($_REQUEST['point']))!='' ?
trim(urldecode($_REQUEST['point'])) :
"");
$details = (intval(trim(urldecode($_REQUEST['details']))) >= 1 ?
1 : 0);
if ($category == "") {
$entries = serendipity_fetchEntries(null, true, $num, false, false, 'timestamp '.$order, '', false, true);
} else {
$entries = serendipity_fetchEntries(null, true, $num, false, false, 'timestamp '.$order, 'c.category_name = \''.serendipity_db_escape_string($category).'\'', false, true);
}
for ($a=0, $maxa=count($entries); $a<$maxa; $a++) {
if ($showtime == 1 && $showdate == 1)
$date = date($dateformat." ".$timeformat, $entries[$a]['timestamp']);
elseif ($showtime == 1)
$date = date($timeformat, $entries[$a]['timestamp']);
elseif ($showdate == 1)
$date = date($dateformat, $entries[$a]['timestamp']);
else
$date = "";
$entryurl = serendipity_archiveURL($entries[$a]['id'], $entries[$a]['title']);
if ($details <= 0) {
if ($date != "")
$date = "[".$date."] ";
echo " document.write('".(trim($point)!=""?trim($point)." ":"").$date."<a href=\"".$entryurl."\">".addslashes($entries[$a]['title'])."</a><br />');\n";
} else {
echo " document.write('<span class=\"blog_title\">".addslashes($entries[$a]['title'])."</span>');\n";
echo " document.write('<hr class=\"blog_hr\" />');\n";
serendipity_plugin_api::hook_event('frontend_display', $entries[$a]);
$entries[$a]['body'] = preg_replace('@(href|src)=("|\')(' . preg_quote($serendipity['serendipityHTTPPath']) . ')(.*)("|\')(.*)>@imsU', '\1=\2' . $serendipity['baseURL'] . '\4\2\6>', $entries[$a]['body']);
$body = str_replace("\n", "", str_replace("\r\n", "", trim($entries[$a]['body'])));
if (substr($body, strlen($body)-5, strlen($body)) == "<br />")
$body = substr($body, 0, strlen($body)-5);
if ($date != "")
$date = " @ ".$date."";
$body = str_replace("'", "\'", $body);
echo " document.write('<span class=\"blog_body\">".$body."</span>');\n";
echo " document.write('<hr class=\"blog_hr\" />');\n";
echo " document.write('<span class=\"blog_body\">".addslashes($entries[$a]['author'])."".$date." [<a href=\"".$entryurl."\">read original...</a>]</span><br /><br />');\n";
}
}
break;
}
return true;
break;
}
}
return true;
}
}
/* vim: set sts=4 ts=4 expandtab : */
Code: Select all
echo " document.write('".(trim($point)!=""?trim($point)." ":"").$date."<a href=\"".$entryurl."\">".addslashes($entries[$a]['title'])."</a><br />');\n";Can I get another hint Garvin? Please?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
That's right. Have a look on how the docoument.write from javascript outputs the different HTML tags.
Just play with it, edit stuff that is written there and you'll see what changes. That's the best way to learn
Best regards,
Garvin
That's right. Have a look on how the docoument.write from javascript outputs the different HTML tags.
Just play with it, edit stuff that is written there and you'll see what changes. That's the best way to learn
Best 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/
