Using Template Editor with Coranto 1.3x

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Using Template Editor with Coranto 1.3x

Postby Dale Ray » Mon Jan 16, 2006 2:12 am

If you are testing the latest version of Coranto and want to use the Template Editor addon change all occurrences [EDIT: in cra_tmpl.pl] (five in all) of:

admin_path

to:

tmpl_path

This will point the editor at the correct folder that holds the template files in the new directory structure.
Dale Ray
User avatar
Dale Ray
 
Posts: 1004
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby YushDon » Thu Mar 23, 2006 3:21 am

It's not immediately obvious to a newbie but in which file can the admin_path be found?

Actually, I have just found the answer!

I have found this admin_path mentioned in several other files in the add-ons I have installed. What do we do with those? Do we also change them to tmpl_path?

For instance in the root coranto folder i.e. http://www.mywebsite.com/cgi-bin/coranto, I have found

cradmin.pl
two instances of admin_path

crcore.pl
two instances

crlib.pl
9 instances

crsetup.pl
4 instances

In the /addons folder I have found

cra_tmpl.pl
5 instances

csql_updatedb.cgi
1 instance

cra_multipart.pl
2

cra_crsql.pl
1 instance
YushDon
 
Posts: 88
Joined: Mon Jan 22, 2007 11:33 pm
Location: London

Postby Lawrence » Thu Mar 23, 2006 3:55 am

I would NOT edit any of those other ones unless told so. Some of those are main core files that may cause your Coranto install to cease functioning properly :)
Stuff I'm working on:
- nothing

Addons:
http://sourceforge.net/projects/lw-craddons/
Lawrence
 
Posts: 1524
Joined: Sun Sep 16, 2001 4:24 am

Postby YushDon » Thu Mar 23, 2006 4:30 am

Much thanks Lawrence. I'm going to assume that Dale was referring to the cra_tmpl.pl file as it's the only one with 5 instances of admin_path like he mentioned.
YushDon
 
Posts: 88
Joined: Mon Jan 22, 2007 11:33 pm
Location: London

Postby Dale Ray » Thu Mar 23, 2006 4:58 am

YushDon wrote:Much thanks Lawrence. I'm going to assume that Dale was referring to the cra_tmpl.pl file as it's the only one with 5 instances of admin_path like he mentioned.


Sorry I didn't make it clear. You only need to edit the cra.tmpl.pl file. Basically you are pointing the template editor to the directory where the addons are placed in the 1.31.x series.
Dale Ray
User avatar
Dale Ray
 
Posts: 1004
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby YushDon » Thu Mar 23, 2006 8:18 am

No probs, Dale. Thanks to you I've now got the template editor working fine. I've also discovered some really cool stuff on your site!
YushDon
 
Posts: 88
Joined: Mon Jan 22, 2007 11:33 pm
Location: London

Postby Parahead » Sat Mar 25, 2006 3:26 pm

For anyone interested, there is a solution that would make the template editor work in both a Coranto 1.24 and 1.31.x environment... This is a general idea that can be applied to other addons that needs updating to handle the folder structure as well, but the exact solution described below is of course particular for the Template Editor.

First, inside cra_tmpl.pl you should find and change all occurrences (five in all) of
Code: Select all
$CConfig{admin_path}
to
Code: Select all
$templatePath

Then find the lines that looks like this in cra_tmpl.pl:
Code: Select all
$in{fn} = undef if $in{new} or $in{newfn};
if ($in{save} and exists $in{tmpl}) {
Just in between these lines you should insert a new line, so it looks like this afterwards:
Code: Select all
$in{fn} = undef if $in{new} or $in{newfn};
my $templatePath = $CConfig{tmpl_path} || $CConfig{admin_path};
if ($in{save} and exists $in{tmpl}) {

Basically this makes the addon use the new template path variable if it can be found, otherwise revert back to the old admin path.
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby YushDon » Sun Mar 26, 2006 10:49 am

For anyone interested, there is a solution that would make the template editor work in both a Coranto 1.24 and 1.31.x environment...

Does this imply that if I wanted to I could create a new templates folder in the root of my Coranto 1.24 directory, put my templates in it, implement the code outlined above and the Template Editor should still work?
YushDon
 
Posts: 88
Joined: Mon Jan 22, 2007 11:33 pm
Location: London

Postby Parahead » Sun Mar 26, 2006 1:53 pm

YushDon wrote:
For anyone interested, there is a solution that would make the template editor work in both a Coranto 1.24 and 1.31.x environment...
Does this imply that if I wanted to I could create a new templates folder in the root of my Coranto 1.24 directory, put my templates in it, implement the code outlined above and the Template Editor should still work?
No. The previous fix made the addon not working with 1.24, eg. it was dedicated to be used in a Coranto 1.31.x setup after the code change. This solution handles both scenarios, which means that if the addon is enabled in a Coranto 1.24 setup it works with the old folder structure and if enabled in a Coranto 1.31.x setup it works with the new one. You can *not* create a subfolder in a 1.24 setup and think it will work though, since the variable is not present there anyway...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby YushDon » Sun Mar 26, 2006 3:17 pm

Cool. I understand you now. Thanks.
YushDon
 
Posts: 88
Joined: Mon Jan 22, 2007 11:33 pm
Location: London


Return to Addon Release and Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron