Embedding using HTML and SSI

Having trouble installing serendipity?
Post Reply
kesmit
Posts: 1
Joined: Tue Dec 20, 2005 4:33 pm

Embedding using HTML and SSI

Post by kesmit »

I've been trying to integrate s9y into an existing mostly static HTML site. I say mostly static, since server side includes (SSI) are allowed. This did take some trickery, but it is almost complete. Here is what I did. I have a directory in my existing site called 'blog'. This directory has an index.html file that contains my site's look-and-feel with the following include:

Code: Select all

<!--#include virtual="/s9y/index.php"-->
This URL points to my s9y installation which has the "embed" option turned on. Now, when someone accesses the index.html file, they see the front page of the blog. However, when clicking links, it directs them to the real blog without the headers and footers. This was fixed by adding an .htaccess file in the s9y directory with the following rules, in addition to changing the s9y index file to "index.html".

Code: Select all

RewriteEngine on
RewriteCond %{QUERY_STRING} /admin$
RewriteRule ^index\.html.*$ /s9y/serendipity_admin.php [L]
RewriteCond %{QUERY_STRING} /feeds/
RewriteRule ^index\.html(.*)$ /s9y/index.php$1 [L]
RewriteRule ^index\.html(.*) /blog/index.html$1 [L]
RewriteRule ^$ /blog/index.html
The RewriteCond lines allow the admin pages and feeds to pass through without getting the static HTML information added on. Now, all of the links in the blog work since they are always redirected through the static HTML file.

Everything is working except for the search. This seems odd since the search parameters are just sent in the URL. In fact, here is a URL with search terms where the search doesn't work (the front page of the blog comes up instead):

Code: Select all

http://foo.com/blog/index.html?serendipity%5Baction%5D=search&serendipity%5BsearchTerm%5D=findme
However, if you simply change the '.html' to '.php', the search does work; although you won't get the site's headers and footers since they aren't being added on my the rewrite rules.

The question is, what is preventing the search from working?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding using HTML and SSI

Post by garvinhicking »

You need to use [QSA] to append the query strings in your .htacces redirection file.

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/
Guest

Re: Embedding using HTML and SSI

Post by Guest »

[quote="garvinhicking"]You need to use [QSA] to append the query strings in your .htacces redirection file.

I guess I'm not sure how that would fix it. I'm not adding anything to the query string (which I thought was the purpose of [QSA]); it should continue to use the existing query string. I tried adding [QSA], but it made no difference.

The query strings work fine for bringing up individual articles, feeds, and admin screens. It's just the search that's broken.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding using HTML and SSI

Post by garvinhicking »

QSA is meant so that GET query strings from your incoming URLs are also submitted to the target of your rewrite rule! Else it passes no GET strings on to your target, which can lead to the problem you're experiencing...

I think it definitely is related to the problem that $serendipity['GET']['searchTerm'] might not "arrive" at your target script?!

Sadly I'm a bit short on time and don't exactly get the special mechanism you're using. Basically it reminds me of our "embed" mode -- maybe you can look up our technical documentation on that, it could help you. Especially the "indexFile" configration option...

HTH,
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