Jump to content
TNG Community
wessel

creating a new template ?

Recommended Posts

wessel

I want to create a modified template reusing template15, but naming it template 40 (to be safe for future updates).

I copied template15 to template40. Template40 does appear in the change template dialogue in the admin screen, but somehow I cannot select this new template and the entry boxes for the string variables are missing in the admin window.

Share this post


Link to post
Share on other sites
tngrlkrz

Starting with TNG12, the templateconfig.php files are not in the templates folder but instead have been loaded into TNG's database tables. If you have been doing upgrades instead of fresh install, you already had a template15 templateconfig.php file.  Either way, to be safe, and to be able to edit the database templateconfig data easily, you can make use of a mod created for that purpose, which also can serve as a  backup of your template configuration data.

You can create a new template with these steps:

  • download and install Template_Manager from the TNG Wiki.       (this mod needed to  save templateconfig data to templateconfig.php for editing)
  • in admin:setup:template setttings: Templates Installed, select template15 and SAVE. (this creates templateconfig.php in template15 folder)
  • copy the template15 folder and subfolders to new  template40  
  • edit topmenu.php in /template40 and find/replace all instances of 't15_' with 't40_'.           (variables need to point to t40)
  • edit templateconfig.php in /template40 and find/replace all instances of 't15_' with 't40_'            (more variables)
  • in admin:setup:template settings  'Templates Available' select template 40, and 'Load'.     (loads templateconfig.php data into TNG database.)

You should then be able to select and 'SAVE' template 40.  You can now edit the template settings normally as you would other templates.  If you make changes, it would be good to select in the first option of 'Templates Installed'  select template '40', and SAVE which ensures templateconfig.php for template 40 saved.

To be safe, you should always have access to a current backup before creating new templates.

Share this post


Link to post
Share on other sites
tngrlkrz

So Wessel,  checking to see if you ever tried what I posted to create a new template?

Share this post


Link to post
Share on other sites
JLH

Hi tngrlkrz,

Not sure if it is okay to answer this topic or if I should open a new one.

First in templateconfig.php, I guess you meant replacing  '15_' with '40_'  (not  't15_' with 't40_').

I tried what you posted to create a new template. Starting from template 1, I created template 100 and starting from template 5, I created template 55. My problem is that in both cases I get this type of message when I go to the home page:

[03-Oct-2022 06:52:39 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function tng_header() in /home/internet/HALF/www/templates/template55/index.php:9
Stack trace:
#0 {main}
  thrown in /home/internet/HALF/www/templates/template55/index.php on line 9

It says that tng_header() is undefined, although genlib.php seems to be called.

All I changed in the template is the text of the main title in the setup page of the template.

Can you help ? Thanks.

Jean-Luc

Share this post


Link to post
Share on other sites
JLH

Hi again,

I found the solution for my template 55. I had to replace the 't5_' with 't55_' in index.php too and it works fine now.

I guess that the same kind of solution will work for my template 100 too.

Best regards,

Jean-Luc

Share this post


Link to post
Share on other sites
John Paul
47 minutes ago, JLH said:

Hi again,

I found the solution for my template 55. I had to replace the 't5_' with 't55_' in index.php too and it works fine now.

I guess that the same kind of solution will work for my template 100 too.

Best regards,

Jean-Luc

don't forget to do footer.php also.  That;a what I had to do for my remaking template21 -> template31

 

Share this post


Link to post
Share on other sites
JLH

Thank you, John Paul.

Jean-Luc

Share this post


Link to post
Share on other sites
KevyNC

@tngrlkrz 

Thank you explaining above this was very helpful and was a solution for what I was looking for. 

Quote

Starting with TNG12, the templateconfig.php files are not in the templates folder but instead have been loaded into TNG's database tables. If you have been doing upgrades instead of fresh install, you already had a template15 templateconfig.php file.  Either way, to be safe, and to be able to edit the database templateconfig data easily, you can make use of a mod created for that purpose, which also can serve as a  backup of your template configuration data.

You can create a new template with these steps:

  • download and install Template_Manager from the TNG Wiki.       (this mod needed to  save templateconfig data to templateconfig.php for editing)
  • in admin:setup:template setttings: Templates Installed, select template15 and SAVE. (this creates templateconfig.php in template15 folder)
  • copy the template15 folder and subfolders to new  template40  
  • edit topmenu.php in /template40 and find/replace all instances of 't15_' with 't40_'.           (variables need to point to t40)
  • edit templateconfig.php in /template40 and find/replace all instances of 't15_' with 't40_'            (more variables)
  • in admin:setup:template settings  'Templates Available' select template 40, and 'Load'.     (loads templateconfig.php data into TNG database.)

You should then be able to select and 'SAVE' template 40.  You can now edit the template settings normally as you would other templates.  If you make changes, it would be good to select in the first option of 'Templates Installed'  select template '40', and SAVE which ensures templateconfig.php for template 40 saved.

To be safe, you should always have access to a current backup before creating new templates.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×