Another embedding query

Having trouble installing serendipity?
Post Reply
Choco
Posts: 2
Joined: Wed May 23, 2007 12:19 pm

Another embedding query

Post by Choco »

I'm looking to embed my blog in a subsection of my main website entry page.

I've read through the documentation and searched forums regarding embedding, and I've made it partway and am stuck. I know my html, but any scripting I can vaguely understand working code after the fact, but am finding it impossible to write or modify it when I'm not even sure what my goal is.

My Serendipity blog is in the /blog folder, relative to the web home folder. The installation is specifically in the subdomain blog.mysite.com, which actually is www.mysite.com/blog/.

My understanding (and I may be wrong) is that for my lower level of skill, I should just try to make an index.php file my website's default home page. Within this, I should have a section that echos a variable (for example $theblog) that I've defined in a separate file, wrapper.php, which also resides in the website's default home directory.

Thus far, I successfully have gotten my blog to appear within the page, however all relative links are broken. These include broken images, which want to erroneously be called from www.mysite.com/uploads/, whereas they acutally are in blog.mysite.com/uploads (aka www.mysite.com/blog/uploads).

I've tried a couple iterations, but for starters, here is one version of what I have tried:

My test file is test.php:

Code: Select all

<?php
require("wrapper.php"); // stores S9Y in a variable
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
Your non-Serendipity content goes here.
<?php
echo $blog_data; // Print the variable
?>
More non-Serendipity content here.
</body>
</html>  
and my wrapper.php:

Code: Select all

<?php
chdir('/home/content/myaccountname/html/blog/'); 
$_REQUEST['page'] = 'blog'; 
ob_start(); 
require('./index.php'); 
$blog_data = ob_get_contents(); 
chdir('/home/content/myaccountname/html/'); 
ob_end_clean(); 
?>
As I barely know what's really going on, please give any suggestions as complete rewrites of the above two code snippets. Also, if moving my serendipity installation into my web page home directory helps, or is easier, please advise.

Also, once the relative links are "fixed", I'm still unclear on whether clicking on a blog entry would result in another embedded page, or a standalone page.

Thank you in advance!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Another embedding query

Post by garvinhicking »

Hi!

Sadly you cannot use serendipity cross-domain - so you need to either stick with www.mysite.com/blog/ or blog.mysite.com/

Getting both to work is impossible because of exactly the problems you mentioned, as the HTTP path differs from "/" to "/blog/" and thus makes any relative links fail.

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/
Choco
Posts: 2
Joined: Wed May 23, 2007 12:19 pm

Moved Serendipity; works but one path error

Post by Choco »

Garvin thanks that works.
My website front page loads with welcome.php (.htaccess has to be set to that), and within it, it embeds the Serendipity homepage which is now blog.php. (1) I renamed index.php to blog.php, then 2) In admin, set Paths->Index file to blog.php)

Because Serenedipity's home folder is now the same as my website home folder, it all works. Of course wrapper.php is also here.

How I moved:
Relative to my web folder, Serendipity was previously in /blog.
I moved all the files to /, then went into admin and changed "Full Path" to remove off the "/blog":
i.e. it went from
Full path before: /home/content/myaccountname/html/blog/
to Full path after:
Full path before: /home/content/myaccountname/html/

________________________________________________
Now here's the current minor problem:

Moving Bug:
Now everything about relative paths works (image references, clicks to blog entries, etc.), except for one error.

At the bottom of the page there's a link for "next page":
(Page 1 of 3, totaling 34 entries) » next page

The relative link here is erroneous, and points to:
http://www.mysite.com/blog.php?/blog/archives/P2.html
instead of
http://www.mysite.com/blog.php?/archives/P2.html

This is the only bad relative link; everything else is good.
In Permalinks, the "Path to archives" is set to: archives

_________________
UPDATE
If I change the name of blog.php to blogtest.php
then the erroneous "next page" link is:
http://www.mysite.com/blog.php?/blogtes ... es/P2.html

When the blog.php is actually embedded in my website welcome.php,
then the erroneous "next page" link is:
http://www.mysite.com/blog.php?/welcome/P2.html

_________________
UPDATE 2
Nevermind. The problem spontaneously resolved itself once I changed the .htaccess to point to my welcome.php. Previously, I was just testing while the .htaccess remained pointing to my original website page welcome.html.
Post Reply