Page 1 of 1

Can I display the recent entries on an external Web page?

Posted: Mon May 01, 2006 6:41 am
by spackler
I'd like to be able to display the recent blog entries as you can within the blog but on an external .php page within the same domain.

For example: visitors can go to my blog at www.mydomain.com/blog/ but I'd also like them to see the most recent blog entries on www.mydomain.com/index.php or www.mydomain.com/contactus.php, etc.

I'm sure this has been asked before but I had a hard time finding an answer. I found http://spartacus.s9y.org/cvs/additional ... ackend.zip
which says it provides javascript output of recent entries for inclusion on other, extern websites, but the instructions are very hard to follow


Any thoughts?

Re: Can I display the recent entries on an external Web page

Posted: Mon May 01, 2006 2:40 pm
by garvinhicking
Hi!

You have several options

1: The backend plugin, which you already saw. There should be an example code with it, and the parameters are explained IMHO sufficiently. Where do you have exact problems with? What did you try already?

2. You can embed your RSS feed on the foreign site. There are dozens of PHP codes for that, which can read your feed and display it. Parses like Onyx or MagpieRSS will help you a lot with this.

3. You can also use the Serendipity functions / framework to show your blog contents. If you know some german, here are code examples:
http://www.s9y.org/forums/viewtopic.php ... tchentries
http://www.s9y.org/forums/viewtopic.php ... tchentries

Ask back if you need more help! :))

Best regards,
Garvin

Posted: Mon May 01, 2006 11:33 pm
by spackler
Thank you Garvin, you do a lot of great work here I see.

I got the plugin to work. In the docuemntation for that there is no direction on where to upload the files but I was able to figure it out and get it working. I would prefer the look of the Recent Entries on the sidebar though. I have to tinker some more.

On those other suggestions, my German is not very good at all but I tried your suggestion of:

Code: Select all

<?php 
$olddir = getcwd(); 
chdir('/path/to/s9y'); 
include_once('serendipity_config.inc.php'); 
include_once('include/genpage.inc.php'); 
chdir($olddir); 
?>

&

<?php 
chdir('/path/to/s9y'); 
include_once('serendipity_config.inc.php'); 
serendipity_printEntries(serendipity_fetchEntries(null, true, 15)); 
chdir('/path/to/your/app'); 
?> 
my full /path/to/s9y/ is /home/customernumber/usernumber/html/blog/index.php and I have used both the full path and relative path and get errors.

I am getting the following errors trying those php snippets:
Warning: chdir(): No such file or directory (errno 2) in /home/custnumber/usernumber/html/recententries.php on line 129

Warning: main(serendipity_config.inc.php): failed to open stream: No such file or directory in /home/custnumber/usernumber/html/recententries.php on line 130

Warning: main(): Failed opening 'serendipity_config.inc.php' for inclusion (include_path='.:/usr/share/pear') in /home/custnumber/usernumber/html/recententries.php on line 130

Warning: main(include/genpage.inc.php): failed to open stream: No such file or directory in /home/custnumber/usernumber/html/recententries.php on line 131

Warning: main(): Failed opening 'include/genpage.inc.php' for inclusion (include_path='.:/usr/share/pear') in /home/custnumber/usernumber/html/recententries.php on line 131


Danke.

Posted: Tue May 02, 2006 9:02 am
by garvinhicking
Hi!

The PHP error you get is becaues the path that the script tries to chdir() to is invalid. Did you really enter "/home/customernumber/usernumber/html/blog/index.php"? If so, that is not a full path. You need to enter "/home/customernumber/usernumber/html/blog/" instead. :)

Regards,
Garvin

Posted: Wed Nov 22, 2006 6:29 pm
by RainHawk
Hi,
sorry for pushing this one up, but I´ve got some problems with adding the code to my page:

Code: Select all

<script src="http://www.tcg-source.de/serendipity/plugins/serendipity_event_backend?num=5&order=DESC&date=1&dateformat=d.m.Y&time=1&timeformat=H:i"></script>
is what I´m using, but the site stays blank.
The path to the plugin is:
http://www.tcg-source.de/serendipity/pl ... nt_backend
In the plugin configuration I tiped in the name of the folder:
serendipity_event_backend
Wheres the problem?
Sorry for my bad English and thanks :)

Posted: Wed Nov 22, 2006 6:45 pm
by garvinhicking
Hi!

Sadly you are using a completely invalid URL. :)

Try this:

Code: Select all

<script src="http://www.tcg-source.de/serendipity/index.php?/plugin/backend?num=5&order=DESC&date=1&dateformat=d.m.Y&time=1&timeformat=H:i"></script>
Instead of "backend" you might need to use the value that you configured in the backend event plugin. By default it's backend. If you changed it to 'serendipity_event_backend', then use this:

Code: Select all

<script src="http://www.tcg-source.de/serendipity/index.php?/plugin/serendipity_event_backend?num=5&order=DESC&date=1&dateformat=d.m.Y&time=1&timeformat=H:i"></script>
Note the crucial difference between 'plugin/' and 'plugins/'. The one is valid, the other is not. :)

HTH,
Garvin

Posted: Wed Nov 22, 2006 6:58 pm
by RainHawk
Thank you for the fast answer! It´s working now :)