Weather template and template-switching bug

Skinning and designing Serendipity (CSS, HTML, Smarty)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Your screenshot shows that no language files of the weather template could be included/found...maybe you're missing files?! Or the UTF-8 subdir?

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/
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Post by Hokey »

Hi Garvin.

This is very crazy. When I install a new template by spartacus then I can see the normal input mask for "about", "contact", colors and so on. It all seems pretty well.

But after clicking the save-button, all (and it doesn't matter which template I choose) looks like in the screenshot before. I can use "smallbiz" - it looks good - save - it looks like the screenshot. I can choose "weather_template" - it looks good (without language-problems) - save - and it looks like in the screenshot.

That S9y couldn't find some language files is possible, because i deleted the whole "weather_template" folder to fall back to the default-template. But this sadly didn't work (although it worked before!).
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Post by Hokey »

Is it possible to "talk" to the template-switcher via code in the adressbar of the browser? Maybe I could switch back to a working template so that my blog is reachable again. (So bad that I can't reach the backups of my provider today. Had never problems with my provider, just today...)

UPDATE
Pooh, I was able to use a backup! All seems to be okay now.
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Hi all,
I'm back at a machine I can work from.

Hokey, when you say "All seems to be okay now." does that mean the weather template is working for you? Or does that mean you got back to the place you started?

YellowLed, I can't see anyway the line that is a problem would be a problem.
*sigh* Any chance you could troubleshoot it and see if $old_include is being set correctly, and that PATH_SEPARATOR is a valid static? Echoing them should be enough.

I guess there could be a setting that prevents the template from either setting the directory path, or from reading the current directory name, but I don't have any idea what setting it would be.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

mgroeninger wrote:I'm back at a machine I can work from.
Good to have you back safe and sound :)
mgroeninger wrote:Any chance you could troubleshoot it and see if $old_include is being set correctly, and that PATH_SEPARATOR is a valid static? Echoing them should be enough.
Let's see ...

echo($old_include):

Code: Select all

.:/usr/share/php:/usr/share/pear:/var/www/serendipity/bundled-libs/:/var/www/serendipity/bundled-libs/Smarty/libs/:/var/www/serendipity/:
echo($PATH_SEPERATOR): (nothing)

I'm not sure if this is correct, but "echo(PATH_SEPERATOR);" says "PATH_SEPERATOR", so I'm guessing I need the $ (I really don't know much PHP, so please correct me if something's wrong).

YL
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Ahh, that might be a problem...

Something like:

Code: Select all

echo(PATH_SEPARATOR);
should echo a colon, if I am using the right variable. So I don't think I am (or it is not defined in the language files). And you shouldn't need the dollar sign in front because it is a defined static (not really a variable).

Can you add this to the top of the config.inc.php file:

Code: Select all

@define('PATH_SEPERATOR',':');
And then add the troublesome line back in?

Hopefully that is enough to fix it!
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

mgroeninger wrote:Can you add this to the top of the config.inc.php file:

Code: Select all

@define('PATH_SEPERATOR',':');
And then add the troublesome line back in?

Hopefully that is enough to fix it!
Nope, didn't do the trick, sorry. I do get a blank page for the blog, no output code whatsoever, and plus, "Configure Plugins" gives me a blank page, too.

YL
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Post by Hokey »

Hi Matt!
mgroeninger wrote:Hi all,
Hokey, when you say "All seems to be okay now." does that mean the weather template is working for you? Or does that mean you got back to the place you started?
That meant that I had a working backup with my smallbiz-template. ;-) My blog was working again. I just got the weather-template working by deleting all lines from line 146 on to the end of the config.inc.php.
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Ok, folks, sorry for absence. I've had a whole slew of stuff come up that is sucking my time away from s9y, but I want to get this template taken care of and released, so I am trying to focus on this.

Is there any chance I could have FTP access to either (or both) of your servers and few hours of downtime to play with them? Basically, I'd just ask you to set the default template to the weather template, then I would log in and fiddle with the config.inc.php and try to figure out exactly where the problems are.

If that isn't possible, here is what I would like ask you to to try:
YellowLed: Can you try to change the line

Code: Select all

$new_include = $old_include . dirname(__FILE__)."/lib".PATH_SEPARATOR ; 
to these and let me know what happens:

1.

Code: Select all

$new_include = $old_include; 
2.

Code: Select all

$new_include = dirname(__FILE__)."/lib".PATH_SEPARATOR ; 
3.

Code: Select all

$new_include = dirname(__FILE__).PATH_SEPARATOR ; 
4.

Code: Select all

$new_include = $old_include .PATH_SEPARATOR ; 
Could you also re-enable to the and remove the block that follows it:

Code: Select all

    if (function_exists('set_include_path')) {
        $use_include = @set_include_path($new_include);
    } else {
        $use_include = @ini_set('include_path', $new_include); 
    }
and see what that does?

Hokey: Is there anyway you could start at the bottom of the file and re-add lines until it stop working? That would help me find which line (or block) of code is causing you problems. Most of the code I would expect to break is at the top of the if statement, so I am hoping you can narrow it down a bit.

Thanks for your guys' patience! Hope things are well!
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

mgroeninger wrote:Is there any chance I could have FTP access to either (or both) of your servers and few hours of downtime to play with them?
Impossible, I'm sorry. This machine we're talking about is not really a server, it's just my desktop machine at home, which doesn't even have a permanent net connection.
mgroeninger wrote:If that isn't possible, here is what I would like ask you to to try:
Will do :) However, this might take some time. Right now, I'm at my girlfriend's, so I don't have access to the machine in question. If I survive the windows installation I'm about to do now, I'll probably be pretty beat. Pray for me, guys :wink:

YL
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

:D Good luck!
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

mgroeninger wrote::D Good luck!
Thanks. I haven't done this in quite some time, but I'm pretty sure it takes a little more than just luck :wink:

Right now, I'm stuck with backups, i.e. backing up her music collection to CDs. It's a dirty job, but someone's gotta do it ... :roll:

YL
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

@yellowled, be careful, this is like brain surgery, one slip of the knife...

And you're right, you're going to be absolutely exhausted after that, I'm not a religious man so praying won't help you, how about your put yourself into a jedi trance and let the force guide you.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

carl_galloway wrote:And you're right, you're going to be absolutely exhausted after that, I'm not a religious man so praying won't help you, how about your put yourself into a jedi trance and let the force guide you.
Yeah, that's what happened after backing up mylady's music collection to 18(!) CDs (yes, one reason for doing all this is that the machine got a DVD-RW installed :)) and I started installing and configuring the infamous OS from Redmond ... it's a little like Luke starting his light sabre training in the Millenium Falcon with those hovering droids - and after that, I felt like him when Han cut him out of that taun-taun on Hoth :wink:

So I'm back at my home machine, let's get started:

1.

Code: Select all

$new_include = $old_include;
This actually gives me a working template.

2.

Code: Select all

$new_include = dirname(__FILE__)."/lib".PATH_SEPARATOR ;
Blank index page, no output code, blank page for plugin config.

3.

Code: Select all

$new_include = dirname(__FILE__).PATH_SEPARATOR ;
Output:
Warning: Smarty::require_once(Smarty/libs/internals/core.is_secure.php) [function.Smarty-require-once]: failed to open stream: No such file or directory in /var/www/serendipity/bundled-libs/Smarty/libs/Smarty.class.php on line 1594

Fatal error: Smarty::require_once() [function.require]: Failed opening required 'Smarty/libs/internals/core.is_secure.php' (include_path='/var/www/serendipity/templates/weather_template:') in /var/www/serendipity/bundled-libs/Smarty/libs/Smarty.class.php on line 1594
4.

Code: Select all

$new_include = $old_include .PATH_SEPARATOR ;
Like 1., working template. (However, the weather info doesn't work in any of the working examples, but that shouldn't bother you, I probably misconfigured something there.)

If I use the original line and remove the following block, I also get the working template like in 1. and 4.

Hope that's been of any help ...

YL
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Actually, that is a pretty big help... It at least tells me we're not having some kind of funky php version/function problem.

Can you make sure that the folder "/var/www/serendipity/templates/weather_template/lib" exists and is readable by the webserver?

That folder contains two PEAR modules which are needed for the template to get/cache weather info (and that may explain why the template isn't actually working).

The template uses the same trick as s9y core to set the php include path so that local PEAR modules are used. Since the first line change works for you, and leaving the line but removing the code to actually change the include path works for you, it means the problem would be somewhere in what the new include path is actually being set to.

Could you try removing the code block:

Code: Select all

    if (function_exists('set_include_path')) {
        $use_include = @set_include_path($new_include);
    } else {
        $use_include = @ini_set('include_path', $new_include);
    }
again and adding this instead (after the line that sets $new_include of course):

Code: Select all

echo $new_include;
That should print the path variable the template is trying to set the path to, which might tell us what is going on.
Post Reply