Yet another embedded problem.

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
jolu
Regular
Posts: 5
Joined: Wed Apr 02, 2008 1:58 am

Yet another embedded problem.

Post by jolu »

Hi,
Yes i also have a problem with embedding serendipity into a php site =) After a few days work, (in the evenings) iam now almost done,.. well i think and hope.

My problems are:
1)
That i cannot access the administrator part of the site, from the blog (Open Administrator)

2)
No Images are visiable on the page (Icons ect.)

3)
Clicking on any of the buttons, will result in a 404

Info:
Iam using rewrites on the site (http://www.johanneslund.net) to get /me, /blog and /ongoing , and rewrites on the /blog part for s9y. so i have a .htaccess file in / and /serendipity/

Structure:
/root
| .htaccess
| wrapper.php
| index.php
| /serendipity/

wrapper

Code: Select all

<?php
  ob_start();
  chdir("/home/johanneslundnet/www/serendipity/");
  require("index.php");
  chdir("/home/johanneslundnet/www/");
  $serendipity_contents = ob_get_contents();
  ob_end_clean();
?>
serendipity .htaccess

Code: Select all

# BEGIN s9y
ErrorDocument 404 /blog/../index.php
DirectoryIndex /blog/../index.php
php_value session.use_trans_sid 0
php_value register_globals off

RewriteEngine On
RewriteBase /blog/
RewriteRule ^((archives/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.html)/?) ../index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+) ../index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) ../index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) ../index.php?/$1 [NC,L,QSA]
RewriteRule ^(categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+) ../index.php?/$1 [NC,L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html ../index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html ../index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) ../index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) ../index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) ../index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) ../index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? ../index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? ../index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) ../index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) ../index.php?url=/search/$1 [L,QSA]
RewriteRule ^comments/(.*) ../index.php?url=/comments/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) ../index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) ../index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) ../index.php?url=/$1 [L,QSA]

<Files *.tpl.php>
    deny from all
</Files>

<Files *.tpl>
    deny from all
</Files>

<Files *.sql>
    deny from all
</Files>

<Files *.inc.php>
    deny from all
</Files>

<Files *.db>
    deny from all
</Files>

# END s9y
My own .htaccess

Code: Select all

RewriteEngine on
# send the empty url to the me-section
RedirectMatch ^/$ /me [C]

# Send url to the index.php for processing
RewriteRule ^(.*)/$ /$1 [R]
RewriteRule ^(me/?.*|ongoing/?.*|blog/?.*)$ index.php?page=$1
php-snippit to handle url (index.php)

Code: Select all

// adds the variable $serendipity_contents that holds the evaluated serendipity content.
require 's9yWrapper.php';

// Setting the correct page. 
$page = '';
if(ereg('^/blog/.', $_SERVER['REQUEST_URI'])) {
	$page = 'blog';

} else {
	$page = $_GET['page'];
	if( $page == '') {
		$page = 'me';
	} 	
	$page = ereg_replace('/$','',$page);
}
Also i had to change the path for my own css-files, images ect. to absolutes /blah.png to get the layout to show after navigating in the blog.

Have a feeling that is has something to do with the relative paths but i haven't been able to find information on the forum.

Help would be much appriciated!
/JoLu
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Yet another embedded problem.

Post by garvinhicking »

Hi!

It's not good you configured s9y to use "../index.php" that won't work, as you can see from the .htaccess handlers.

Your wrapper and index.php should reside in the same directory because otherwise you will get missing images and wrong paths.

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/
jolu
Regular
Posts: 5
Joined: Wed Apr 02, 2008 1:58 am

Post by jolu »

Hi, and thanks for the help!

ok, made a clean install since i couldn't get into my admin part. And moved the wrapper file to the /serendipity folder, require it from the index.php from the root.

It shows up correclt now on the first page (http://www.johanneslund.net/blog), but if i hit a link, it goes blank-screen.

I had this problem before, and i ended up with the problems i had in the beginning. I must be missing something.

/JoLu
jolu
Regular
Posts: 5
Joined: Wed Apr 02, 2008 1:58 am

Post by jolu »

The problem disapears when if i change the Relative path to /blog/ and the URL to blog to http://www.johanneslund.net/blog/, but then images disapears aswell.

Must be a relativeUrl problem, but i dont know how to fix this.

Thanx in advance =)
/JoLu
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, your links lead to:

http://www.johanneslund.net/serendipity/...

so note the "/serendipity/" in there?! You should configure s9y so that you will be able to view s9y with its index.php also without your embed wrapper.

However, maybe a more basic question: For which goal are you planning to use the embed wrapper? The current site looks quite easy, maybe you can achieve what you want already by simple templating with the smarty template files, or by adding custom PHP code includes to your templates?

Since s9y got Smarty templating, the embed mode is used fairly rarely, it usually only makes sense for installations where complex frameworks are on the same site than serendipity and need to be combined together.

For everything that design and HTML is concerned, Smarty templating does a much better job of making your blog look like the rest of the site...

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/
jolu
Regular
Posts: 5
Joined: Wed Apr 02, 2008 1:58 am

Post by jolu »

hi again,

Followed your advice and looked at smarty, which by the way i pretty neat =)
So its working as i wanted now.

But i got a new problem, when i tried to get the FCKeditor plugin via spartacus. (blog is the serendipity installation folder)

Cannot write to file /root/../www/blog//plugins/serendipity_event_fckeditor/lang_en.inc.php.


Dobble slashes? blog//plugins/ ?

/JoLu
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

The double slashes are no problem, but you need to assign write privileges to the "plugins" directory (777?).

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/
jolu
Regular
Posts: 5
Joined: Wed Apr 02, 2008 1:58 am

Post by jolu »

yep, figured it out =)

Thanx alot for your help!

/JoLu
Post Reply