PDA

View Full Version : [RELEASE vB2.0RC1] Copy Templateset



Hotte
Tue 24th Apr '01, 5:16pm
When using other Templates than the default (ie german templates) than it is usefull to copy this set to a new one before altering them.

File to edit: ./admin/template.php

Around line 235 add the following Code before


// ###################### Start Modify #######################
if ($action=="modify") {




// ###################### Start copyset #######################
if ($action=="copyset") {
$oldset=$DB_site->query_first("SELECT * from templateset where templatesetid=$templateset");
$DB_site->query("INSERT INTO templateset (templatesetid,title) VALUES (NULL,'Copy of ".$oldset[title]."')");
$newset=$DB_site->insert_id();
$sets=$DB_site->query("SELECT * from template where templatesetid=$templateset and title != 'options'");
while($set=$DB_site->fetch_array($sets)){
$DB_site->query("INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,$newset,'".addslashes($set[title])."','".addslashes($set[template])."')");
}

echo "<p>copied!</p>";

$action="modify";
}


In action modify around line 357 add



makelinkcode("copy","template.php?s=$session[sessionhash]&action=copyset&templateset=$templateset[templatesetid]").


between



makelinkcode("collapse groups","template.php?s=$session[sessionhash]&action=modify&expandset=$templateset[templatesetid]").
"<ul>\n";

Mas*Mind
Tue 24th Apr '01, 6:02pm
Nice one! Was planning on making this one myself, but won't bother anymore ;)

Another extra cp-feature I had in mind was 'add template to all template sets' which will add your new template to all sets in one click

And I'm working on a template compare utitility which will check two the same template of two different template sets against eachother and lists the differences of the $var variables.

But first I've to release the vbextern hack :D

conan
Tue 24th Apr '01, 9:25pm
Thanks man that's a great hack, would this work for RC2?

Hotte
Wed 25th Apr '01, 2:04am
Originally posted by conan
Thanks man that's a great hack, would this work for RC2?
Donīt know
But the chance, that it does, looks great. Donīt think, this part of the skript has changed.

SteveK
Sun 29th Apr '01, 5:25pm
Yes, this works in RC2. It will also work if you have Kier's alternate template admin hack installed. For this, simply add the code in step 2 of this mod to the ktemplate.php file instead - around line 140 in between:


makelinkcode("add new template","template.php?s=$session[sessionhash]&action=add&templatesetid=$templateset[templatesetid]").

and


"<ul>\n";

Remi
Fri 11th May '01, 6:06pm
That is not working in RC3

Any help SteveK :o

Thanks :rolleyes:

SteveK
Fri 11th May '01, 9:49pm
I'll test once I update to RC3 and let you know what I find out.

SteveK
Sun 13th May '01, 8:19pm
I didn't have any problem. You didn't, by chance, change:

if ($action=="copyset") {
to:

if ($HTTP_POST_VARS['action']=="copyset") {
did you? If so, try changing it back.

Remi
Sun 13th May '01, 8:49pm
Thanks SteveK

It is working now ;)

wajones
Mon 14th May '01, 10:35am
Hotte or whom ever likes a challenge...

This is a very useful hack for me, love it... Now :D would you be so kind as to create another. Enabling one to make a copy of individual templates. Like a drop down box that would list the template set's then a copy to button or what ever it takes. Sort of like the drop down that move's the template to another set.

JoshFink
Wed 25th Jul '01, 1:17pm
WaJones, just saw this good idea.. Any takers :)

Thanks,

Josh

Pie'oh'pah
Mon 13th Aug '01, 8:22pm
Thanx a bunch for this. i was lookin 4 it with the search function here and sooooo glad i found it :D:D

-Pie