plugin for latest blog entry exerpt for a static php page?

Creating and modifying plugins.
Post Reply
katwomanofsteele
Regular
Posts: 5
Joined: Mon Oct 22, 2007 4:22 am

plugin for latest blog entry exerpt for a static php page?

Post by katwomanofsteele »

I would like to show a latest blog entry exerpt on a homepage with a read more link that will open up to the serendipity blog. I don't want the blog to be the homepage itself, because I have other content on the page other than blogs that I want to display. Is there something like this for serendipity? Thanks in advance :)
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

If the page you're talking about isn't part of Serendipity, then what you need to do is embed Serendipity into your site. Do a quick search here for embedding, there have been a few discussions about this, at least that will let you see if embedding is what you're after.

On the other hand if you want a custom entry page for Serendipity that includes other content then you'll need to edit the template files. Can you give us a bit more information about what you're looking for?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

There are several ways to solve this.

1. You can embed serendipity into your design using an iframe. This is the easiest solution, but might look the strangest.

2. You can use the s9y plugin "Show entries via Javascript". This plugin allows you to call a javascript URL from any page to embed your recent entries. In your foreign page, you simply use:

Code: Select all

http://yourblog/index.php?/plugin/backend
For the options, check the acompanying README and backend.html files of the plugin.

3. You can use a PHP library like MagpieRSS and use it to parse your blog's RSS feed and display it. Check google for MagpieRSS, there are tons of example PHP snippets on how to display foreign RSS feeds inside an application.

4. You can use the Serendipity API, if your blog and your homepage are on the same server. You simply put this piece of PHP code into your application: http://www.s9y.org/206.html

5. If your homepage already uses smarty, you can also include the 'serendipity_config.inc.php' s9y API, register the s9y smarty modifiers as in serendipity_smarty_init() and then use the smarty {serendipity_fetchPrintEntries} functions (http://www.s9y.org/78.html#A2). This is fairly advanced stuff, though.

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/
katwomanofsteele
Regular
Posts: 5
Joined: Mon Oct 22, 2007 4:22 am

latest blog entry plugin

Post by katwomanofsteele »

Carl - Right, this area is not part of serendipity - and I do plan on creating a custom template for the serendipity part. Basically I want the title and latest serendipity entry (or portion thereof) on this page I am designing, with a read more link that will take the user to the serendipity blog.

Garvin - yes, serendipity is on the same server, configured in a subdirectory (but it isn't smarty driven), so your php suggestion #4 is perfect! Exactly what I was looking for! Many thanks!!!
katwomanofsteele
Regular
Posts: 5
Joined: Mon Oct 22, 2007 4:22 am

Embedding latest entry causes strange characters...

Post by katwomanofsteele »

Not sure why this is happening...

Please check this site:
www.legacyconnect.net/beta

Only on the page with the embedded code outside of serendipity - then when you go into the actual blog in serendipity, its fine...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding latest entry causes strange characters...

Post by garvinhicking »

Hi!
katwomanofsteele wrote:Not sure why this is happening...
What is happening? The URL you mention looks good to me?

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/
katwomanofsteele
Regular
Posts: 5
Joined: Mon Oct 22, 2007 4:22 am

strange non-alphanumeric characters

Post by katwomanofsteele »

Hi Garvin -

If you look in the first paragraph, you will notice certain non-alphanumeric characters turn into some other character set - these are sometimes spaces, apostrophes, commas, etc. I went in and manually deleted and reinserted to the blog textarea where they were showing to the other paragraphs, which is why it is only showing in the first paragraph.

Here's that paragraph copied and pasted from that page:
"“You’ve gotta have it all and you’ve gotta have it now!” These are the key words of a new TV add for a large appliance/electronics retailer. I have to say, I’ve found it disturbing..."

She usually copies it from a word doc and pastes it into the textarea window. But a few times she has typed directly into the textarea and it still does this... doesn't seem to be causing the problem on the main blog page though...

Is there a charset maybe I could try specifying in this? I do have this script as a separate php include file...

Thanks for your help!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: strange non-alphanumeric characters

Post by garvinhicking »

Hi katwomanofsteel!

Check the output of your HTML site; you have two <html> declarations - that might not go well with your chars.

Also check if your blog ius configured for ISO-8859-1, usually s9y is installed on UTf-8 charsets, whcih means you should either make your <html> headers with UTF-8 declaration, or change your blog to ISO-8859-1 (and re-edit all your entries).

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/
katwomanofsteele
Regular
Posts: 5
Joined: Mon Oct 22, 2007 4:22 am

drat - still odd characters...

Post by katwomanofsteele »

Hi Garvin -

Looks like still having problems with the odd characters - even with the changes. Any other ideas? Could it be server side charset? The actual serendipity blog pages are fine - it's just this plugin area...

Thanks again!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: drat - still odd characters...

Post by garvinhicking »

Hi!

It definitely might be server-side charset related, yes. Your /beta/ page declares a HTML header of "UTF-8", but your server says "ISO-8859-1" in the HTTP-Header "Content-Type".

And your site really is slow. It took me 5 minutes (!!!) to load the /beta/ page...

How does your latestblog.php file look like? Maybe this one also sets some bad/wrong headers?

And you didn't mention yet if your s9y blog is set to ISO or UTF-8? Sadly the loading here takes so long, I could not inspect that. You must make your blog match the charset of your startpage (or the other way round).

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/
Post Reply