problems embedding s9y

Found a bug? Tell us!!
Post Reply
thereza
Regular
Posts: 6
Joined: Mon Apr 10, 2006 9:04 am

problems embedding s9y

Post by thereza »

I've followed the docs, but something is not working. For examle, the following code works as expected :

<?php
ob_start();
echo test;
$o1 = ob_get_contents();
ob_end_clean();

echo $o1;
echo $o1;
?>

however

<?php
ob_start();
chdir("/home/content/c/j/j/cjjarvis/html/serendipity/");
require("/home/content/c/j/j/cjjarvis/html/serendipity/index.php");
chdir("/home/content/c/j/j/cjjarvis/html/");
$o1 = ob_get_contents();
ob_end_clean();

echo $o1;
echo $o1;
?>

does not produce any output. if you remove the final ob_end_clean(), you will see three copies of the output.

any thoughts?

thnx,
reza

p.s. this is hosted on godaddy.com -- not sure what version of what they run.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: problems embedding s9y

Post by garvinhicking »

Which output is produced if you omit the ob_end_clean()?

It is strange that if you omit it, you get output, but not with the "ob_get_contents()" call...

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/
thereza
Regular
Posts: 6
Joined: Mon Apr 10, 2006 9:04 am

Post by thereza »

if I require the index.php file, and omit ob_end_clean(), I will see three copies of the expected unformatted output from s9y. It's as if the ob_end_clean() will just dissable any output from being generated at all. I'm running the latest beta version of s9y.

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

Re: problems embedding s9y

Post by garvinhicking »

Hi!

Hm, I've never experienced that. Which PHP version is godaddy running?

Maybe you can play with the ob_get_clean() command: http://de.php.net/manual/en/function.ob-get-clean.php

If the output does happen, but if just ob_get_contents() does not return anything, this sounds like a bug 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/
thereza
Regular
Posts: 6
Joined: Mon Apr 10, 2006 9:04 am

Post by thereza »

I looked at the ob_*() commands in the docs, and ran a couple test programs - it seems to be behaving properly except when i try to use it in conjunction with s9y. I looked at the index.php file, and it heavily relies on the ob_start, require_once, ob_get_contents, ob_end_clean structures throughout. So I'm assuming it works, but something migh be unhappy with it.

It could be a php bug, not sure. I ran the phpinfo command, you can see the full output here : http://www.chloejarvis.com/test2.php -- but the short answer is 4.3.11

Is there any way to enable php debugging?

Thnx again,
reza
thereza
Regular
Posts: 6
Joined: Mon Apr 10, 2006 9:04 am

woops

Post by thereza »

didn't notice the new command. tried this

<?php
ob_start();
chdir("/home/content/c/j/j/cjjarvis/html/serendipity/");
require("/home/content/c/j/j/cjjarvis/html/serendipity/index.php");
chdir("/home/content/c/j/j/cjjarvis/html/");
$o1 = ob_get_clean();
echo $o1;
?>

same results -- nothing..

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

Re: woops

Post by garvinhicking »

Hi!

I've just tested this on my host, but your exact script works here flawlessly!

Can you test it on a local server maybe? On a host different than godaddy...

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/
thereza
Regular
Posts: 6
Joined: Mon Apr 10, 2006 9:04 am

Anger

Post by thereza »

:?

yes, it works fine on my server. i wonder what's up with godaddy's hosting that's breaking it. they're running fastcgi which might have something to do with it...

what are my options for making this work? can i modify index.php to output a variable rather than printing stuff out itself? perhaps i'll try that... though any suggestions would be welcome!

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

Re: Anger

Post by garvinhicking »

Hi!

Sadly I know next to nothing about godaddy, but it just seems like an issue with their servers. Maybe you could contact their support and tell them about the issues?

Without output bufffering, you cannot really get this to work, I'm sorry. You would then need to go and use the Smarty Framework to implement your current site into the smarty template?!

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/
thereza
Regular
Posts: 6
Joined: Mon Apr 10, 2006 9:04 am

i got it to work...

Post by thereza »

well, after a bunch of mucking around, i got it to work by doing the ouput buffer calls right before and after the smarty stuff...

ob_start();
$serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath'));
$stuff = ob_get_contents();
ob_end_clean()

towards the very end of the index.php file. I renamed it r_index.php, created my own index.php with my html in it, did a require of r_index.php and simply used $stuff in it... that worked just fine. dont know why it fails when the ob_start / ob_end_clean are not direclty surrounding the ->display call.

I was also very dissapointed with the plain vanilla html generated by the embedded mode of s9y, so i tried a number of different themes till i came across idea, which seemed non-evil enough. i modified the .css for it, and it looks pretty good.

the only outstanding thing that i would like to do is to be able to modify my r_index.php to output $stuff_left $stuff_middle and $stuff_right so I can populate different parts of my html with the different components, but that's not urgent right now.

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

Re: i got it to work...

Post by garvinhicking »

Hi!

Ah, of course. I always forget about the easy options of just messing with the Serendipity files! I'm sorry, I was just completely blank about this possibility. :)

Actually, once the s9y framework is initialized, you can use the s9y functions inside your PHP framework and use that to emit the sidebars with a code like this:

Code: Select all

$stuff_left =& serendipity_plugin_api::generate_plugins('left');
$stuff_right =& serendipity_plugin_api::generate_plugins('right');
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