embedding in phpwcms

Having trouble installing serendipity?
Post Reply
Zym0tiC
Regular
Posts: 6
Joined: Thu Sep 01, 2005 2:16 am

embedding in phpwcms

Post by Zym0tiC »

He people, I'm trying to embed s9y into phpwcms but I don't get anything further. I tried several ways, with iframe, wrapper.php, etc ,etc.

I prefer to do it the wrapper way but there are some problems the url for my blog is http://www.shinebox.nl/index.php?weblog so how do I use this in the wrapper.php ??

Code: Select all

<?php
$_REQUEST['page'] = 'blog';
// Let serendipity generate our content:
ob_start();
require 'index.php';
$blog_data = ob_get_contents();
ob_end_clean();

// Now we include our normal content building file.
// This one has to make use of your $blog_data variable to print
// the content where appropriate!
require 'content.php';
?>
wrapper from wikki.

s9y is installed in http://www.shinebox.nl/weblog, the mainsite in http://www.shinebox.nl

My biggest problem is howto change this line "$_REQUEST['page'] = 'blog';"

This is what I think, but doesn't works:

Code: Select all

<?php
$_REQUEST[''] = 'webblog';
// Let serendipity generate our content:
ob_start();
require 'index.php';
$blog_data = ob_get_contents();
ob_end_clean();

// Now we include our normal content building file.
// This one has to make use of your $blog_data variable to print
// the content where appropriate!
require '../index.php';
?>
I changed the indexfile to wrapper.php.

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

Re: embedding in phpwcms

Post by garvinhicking »

The wrapper.php file from serendipity is basically used to get all the s9y contents and put the contents from it in a variable.

The problem is that Serendipity still relies on the URL format so that it can properly detect it. As you have put Serendipity into the "weblog" subdirectory, Serendipity can only show a page if the URL is like this:

http://www.shinebox.nl/weblog/wrapper.p ... entry.html

So you need to configure Serendipity with all its paths to point to /weblog/.

Also the wrapper.php files is necessary to be included in the Serendipity directory! That means you need to put your wrapper.php in /weblog/wrapper.php, and not /wrapper.php. Also you need to set the Serendipity Indexfile to "wrapper.php" only.

When I call the URL http://www.shinebox.nl/weblog/wrapper.php I only get a 404, so that means you have not put the file there.

What you can do to make the weblog appear within your "http://www.shinebox.nl/index.php?weblog" file is to edit your main index.php file. I don't know phpwcms, but that files needs to do this PHP code to include serendipity:

Code: Select all

<?php
if ($_SERVER['REQUEST_URI'] == 'index.php?weblog') {
  chdir('weblog');
  $blog_startpage = true;
  include_once('wrapper.php');
  chdir('..');
}

// Here is more of phpwcms code

echo "Blog: " . $blog_data;
Your wrapper.php file then needs to see if the framework called s9y, or if s9y needs to call the framework:

Code: Select all

<?php
// Let serendipity generate our content:
ob_start();
require 'index.php';
$blog_data = ob_get_contents();
ob_end_clean();

// Now we include our normal content building file.
// This one has to make use of your $blog_data variable to print
// the content where appropriate!
if ($blog_startpage) {
  return; // The framework has called us!
} else {
  chdir('..');
  include 'index.php'; // Include the phpwcms framework! It needs to put $blog_data somewhere!
}
?>
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/
Zym0tiC
Regular
Posts: 6
Joined: Thu Sep 01, 2005 2:16 am

Post by Zym0tiC »

He Garvin, I followed exactly what you did and I think that I almost there.

I created the wrapper.php file as u mentioned. I placed the file in weblog/
After that I setup s9y to use wrapper.php as the indexfile. When I open http://www.shinebox.nl/weblog/wrapper.php in my browser I see my site with s9y embedded but without the css. I think this problem will be solved if I know where to place the following code in the index.php file:

Code: Select all

	if ($_SERVER['REQUEST_URI'] == 'index.php?weblog') {
  chdir('weblog');
  $blog_startpage = true;
  include_once('wrapper.php');
  chdir('..');
}

echo "Blog: " . $blog_data; 
I tried several places but i think I don't get the right one.... :(

I hope you can help me if I post the index.php file...

http://www.shinebox.nl/misc/indexphp.txt
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

I'm sorry, that index.php file is way too hard to read without knowledge of PHPWCMS. Please ask those guys where you can put a PHP include to show content, only the developers of phpwcms can help you there.

And yes, the issue with missing CSS will be solved as soon as you put that snippet in the right part of index.php :)

Please post the solution here if you get it!

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/
Zym0tiC
Regular
Posts: 6
Joined: Thu Sep 01, 2005 2:16 am

Post by Zym0tiC »

Ok i opened a topic in the phpwcms forums, as soon as i got the info I will post it here.

Thanx so far :)
Zym0tiC
Regular
Posts: 6
Joined: Thu Sep 01, 2005 2:16 am

Post by Zym0tiC »

I just found out that I can include php code into a document with the [PHP] [/PHP] tags.

So I tried to put the following into http://www.shinebox.nl/index.php?weblog page:

Code: Select all

 
  chdir('weblog'); 
  $blog_startpage = true; 
  include_once('wrapper.php'); 
  chdir('..'); 

echo "Blog: " . $blog_data;
without the if statement as you can see.

After that I opened the weblog but I get the following error:

Fatal error: Call to a member function on a non-object in /home/virtual/site155/fst/var/www/html/weblog/include/genpage.inc.php on line 16

I looked into the file but the code on that line looks important....

I hope this is a step to the right direction to get s9y running into phpwcms
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Actually that is not a right step - if you evaluate code with PHP-Tags I am quite sure that it does not execute in the global variable scope.

The index.php of Serendipity needs to be run in global scope and not within any function or so.

At least you must have "global $serendipity" defined, otherwise Serendipity cannot access its own Framework. If your php include snippet is called inside a function (like it seems it is now), this must use that global statement. Try to put it in your PHP code and see if it helps.

HOWEVER you might face various errors and problems if Serendipity is not executed globally. You have to try this.

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/
Zym0tiC
Regular
Posts: 6
Joined: Thu Sep 01, 2005 2:16 am

Post by Zym0tiC »

as you can see it works now, but as soon as i click a link the whole site looks like plain text, i still got the css problem. why doesn't it works on all the other pages?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

How does your wrapper.php look like right now? It does not seem to include the "index.php" of your site.

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/
Zym0tiC
Regular
Posts: 6
Joined: Thu Sep 01, 2005 2:16 am

Post by Zym0tiC »

my wrapper.php atm (placed in weblog/ )

Code: Select all

<?php
// Let serendipity generate our content:
ob_start();
require 'index.php';
$blog_data = ob_get_contents();
ob_end_clean();

// Now we include our normal content building file.
// This one has to make use of your $blog_data variable to print
// the content where appropriate!
if ($blog_startpage) {
  return; // The framework has called us!
} else {
  chdir('..');
  include 'index.php'; // Include the phpwcms framework! It needs to put $blog_data somewhere!
}
?>
Weird, the phpwcms code has been placed under the s9y code :shock:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

It seems that phpWCMS does not properly output the $blog_data variable! This variable containts the whole s9y output - it needs to be used by phpwcms at the proper place...

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