Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Bug in Template Globals

Quote Reply
Bug in Template Globals
In Links SQL 2.1.0-Beta2 save changes in template globals don't work,

because of use of $GLOBALS instead of $globals in Links::Tools::global_editor[/code]
Quote Reply
Re: [svalera] Bug in Template Globals In reply to
Hi,

Thanks, we'll fix that up!

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Bug in Template Globals In reply to
Can you post the corrected version of the perl code for Links::Tools::global_editor here? I tried to correct it , but I made a mess...Crazy
Quote Reply
Re: [svalera] Bug in Template Globals In reply to
Hi Svalera,

So ... what is the solution?..... Did you work it out?

Which areas need to be changed?

This is causing me some 'major' headaches.

Thanks,

Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Bug in Template Globals In reply to
Hi,
You must change in Links/Tools.pm in global_editor sub


$GLOBALS = {};
foreach my $code ($IN->param()) {
next unless ($code =~ /^save-(.*)/);
my $key = $1;
next if ($IN->param("del-$key"));
my $var = $IN->param($code);
$var =~ s/\r?\n/\n/g; # Remove windows linefeeds.
$GLOBALS->{$key} = $var;
}
if ($IN->param('new') and $IN->param('new-val')) {
my $var = $IN->param('new-val');
$var =~ s/\r?\n/\n/g;
$GLOBALS->{$IN->param('new')} = $var;


in

# $GLOBALS = {};
foreach my $code ($IN->param()) {
next unless ($code =~ /^save-(.*)/);
my $key = $1;
next if ($IN->param("del-$key"));
my $var = $IN->param($code);
$var =~ s/\r?\n/\n/g; # Remove windows linefeeds.
# $GLOBALS->{$key} = $var;
$globals->{$key} = $var;
}
if ($IN->param('new') and $IN->param('new-val')) {
my $var = $IN->param('new-val');
$var =~ s/\r?\n/\n/g;
# $GLOBALS->{$IN->param('new')} = $var;
$globals->{$IN->param('new')} = $var;
Quote Reply
Re: [svalera] Bug in Template Globals In reply to
Thanks very much ...

Works like a charm Sly

Regards,

Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [svalera] Bug in Template Globals In reply to
Oops!!

Look like I spoke to early.Pirate When you add/modify globals you do get the correct indication that changes have been saved BUT when you go into that area again all the changes have been lost (and it reverts back to the GT defaults).

It appears as though your fix doesn't make any changes you make to the globals 'stick'!Frown

Regards,

Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Bug in Template Globals In reply to
Hi,
Sorry, but on my side it works :)

Try to see, if after save globals, changes appears in globals.txt and when globals.txt became default
Quote Reply
Re: [svalera] Bug in Template Globals In reply to
For me it works also fine!

Michael

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [svalera] Bug in Template Globals In reply to
Works for me too now!

There was a problem with global.txt on the server and it just needed a chmod - for some reason!

Thanks again,

Clint
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Alex] Bug in Template Globals In reply to
I found out that globals.txt and languages.txt should not be within the directory /templates/default/local.

In this case it´s not possible to save changings with the template-globals-editor in admin section.

Michael



--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Michael Skaide] Bug in Template Globals In reply to
The various globals.txt and language.txt files should be in the main template directory. the local subdirectory is for the addition of templates that are site-specific and are not overwritten by the new install/update.

I'm not sure how this translates into the site layout, but my files are in the main directory.

I would imagine that these files _really_ should be loaded from the local directory, and when Links is installed, the local directory should not be empty, but should include these two files.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Bug in Template Globals In reply to
Problem is that user copy the complete templates-directory into /local don´t thinking about globals.txt and languages.txt

Later when they try to edit globals and languages by admin section, the files will not be updated.

Should be mentioned at the right place.

Michael

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Michael Skaide] Bug in Template Globals In reply to
This is a bug in 2.1 beta, any changes you make to globals/language should get saved to admin/templates/default/local, so that when you upgrade your changes will be preserved.

This will be fixed in the final. In the meantime, just make sure to backup your template directory before upgrading.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Michael Skaide] Bug in Template Globals In reply to
The "locals" directory is for templates you add, or modify.

You modify the Globals via the admin interface (you really shouldn't edit that file directly), and that will put the globals file in the right place.

Alex should really add a "language editor", and that will solve that problem.

The _only_ files that should be in local are files you've changed .... leave the others alone, in the parent directory.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Alex] Bug in Template Globals In reply to
If I take globals.txt out of default/local, and only have it in /default, All my globals dissapear. If I only have the globals.txt in default/local, I can't add or edit them. I am confused. Crazy


Last edited by:

Evoir: Jan 3, 2002, 11:44 PM
Quote Reply
Re: [Alex] Bug in Template Globals In reply to
Please ignore my last post, I would delete it if I could Tongue

Alex:

Is there a fix for this? I have NOTHING at all in my /local directory. Everything is in the default directory, all my templates, the globals.txt and I can't edit my globals at all. This is really frustrating, to say the least. Can you post a fix for us?

Quote Reply
Re: [Evoir] Bug in Template Globals In reply to
See the 5th posting in this thread.

If you change the code in tools.pm it should work for you.

Michael

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Michael Skaide] Bug in Template Globals In reply to
Michael,

I did see and try what is in the fifth post... a week ago. It didn't work for me. here's what I did:

I found the following in TOOLS.pm:

$GLOBALS = {};
foreach my $code ($IN->param()) {
next unless ($code =~ /^save-(.*)/);
my $key = $1;
next if ($IN->param("del-$key"));
my $var = $IN->param($code);
$var =~ s/\r?\n/\n/g; # Remove windows linefeeds.
$GLOBALS->{$key} = $var;
}
if ($IN->param('new') and $IN->param('new-val')) {
my $var = $IN->param('new-val');
$var =~ s/\r?\n/\n/g;
$GLOBALS->{$IN->param('new')} = $var;


and replaced it with:

# $GLOBALS = {};
foreach my $code ($IN->param()) {
next unless ($code =~ /^save-(.*)/);
my $key = $1;
next if ($IN->param("del-$key"));
my $var = $IN->param($code);
$var =~ s/\r?\n/\n/g; # Remove windows linefeeds.
# $GLOBALS->{$key} = $var;
$globals->{$key} = $var;
}
if ($IN->param('new') and $IN->param('new-val')) {
my $var = $IN->param('new-val');
$var =~ s/\r?\n/\n/g;
# $GLOBALS->{$IN->param('new')} = $var;
$globals->{$IN->param('new')} = $var;

Is this what I was supposed to do? I still have
nothing at all in my /local directory.

I still cannot edit my gloabls. Crazy

Quote Reply
Re: [Evoir] Bug in Template Globals In reply to
Ok, I have it!

1. copy globals.txt to /local

2. make a changing at admin template_globals and save it

3. delete globals.txt at /local

4. went back to admin template_globals, make your changings again

Now they are saved!

Michael

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Michael Skaide] Bug in Template Globals In reply to
This does indeed allolw you to make changes -- once. Then, you have to go back into the directory and copy globals.txt over to /local again, go to globals and save, delete copy of globals.txt in /local and then save your template globals again.

Alex, please help me stop the madness. Can you post a fix for this problem? Please please please?
Quote Reply
Re: [Evoir] Bug in Template Globals In reply to
Evoir,

No, this was exactly what I did. After that all work with template_globals at admin was saved without any other action.

Michael

--
Michael Skaide

http://www.cycle24.de