Edit files guidelines

From TNG_Wiki
Jump to: navigation, search

Translated with www.DeepL.com/Translator (free version)

Editing TNG files


This text, intended for beginner users, describes how to edit TNG files in order to modify their content.

Warnings

1. Editing files with a .php or other extension of the TNG files can lead to a total blockage of your TNG application. Before editing any file, whatever it is, you should
to make a back-up copy of it. This copy will be used to replace the original that you have modified if something goes wrong with your modifications. 2. Any changes you may make are likely to be overwritten when TNG is updated. You should therefore take careful note of what you do if you need to do it again after an update. Ideally, you should write a mod (see below) in order to ensure that your changes are permanent.

Programmes

1. File modification requires the use of a simple text editor. Attention however: programs such as MSWord or Notepad for windows are not suitable for this kind of modifications. It is therefore advisable to download a good editor. I recommend using Notepad++, downloadable here .
In addition to being multi-coding (UTF8, ANSI,...) it allows the code to be clearly visualised thanks to a syntactic "colouriser".
When you are more experienced, you can add an ftp module to it which will make the necessary program described below unnecessary
. 2. Finally, to extract the files and put them back on the web server you should use an ftp program of your choice. For example, Filezilla, easy to use and reliable can be downloaded here .

Procedure

In view of the above recommendations, the procedure below will be presented using the recommended programs in Windows. (Filezilla and Notepad++)

Image
Before you start, in Filezilla, associate the file types you will open with notepad++.

To do this, open Filezilla, Edit Menu >> Settings >> File Edit>> + >> Associations by file type.
Enter the extension name and full path to your Notepad++.exe file like this:

"C:\Program Files\Notepad++\notepad++.exe"

for files with a php extension, or

"C:\Program Files\Notepad++\notepad++.exe"

for text files (txt).


Filezilla Assoc Notepad++


As an example, we will make a small modification in the file admin_generatethumbs.php.

1. Locate the file to be modified in your list of files on the server. Most of the TNG "program" files can be found in the root of your TNG site.
Other sub-directories also contain files necessary for the operation (class, css, js, ... directories).
2. Download it for editing: right click on the file and choose "View/Edit".
Notepad++ opens and your file is displayed.

Filezilla edit file


3. Make a backup copy: In Notepad++, Menu File >> Save a copy. Choose an easily accessible location for backup. For example, your desktop.

4. Go to line 24 and change the value of the variable $maxsizeallowed. The line looks like this

$maxsizeallowed = 1000; //KB

Change the value 1000 to 1100. The line looks like this

$maxsizeallowed = 1100; //KB

5. Save your work: File Menu >> Save.

The modification is finished. However the file is modified locally, on your PC, and not yet on the server.
There is one last step to do this.

6. Return to Filezilla. The program "sees" that one of its files has been modified

and asks if it should update its copy. Answer "Yes". It is done. Your modification is now
active on your web server. You can go back to Notepad++ and close the tab of the .file


Filezilla Save


Write a Mod

For this small modification, we are going to write a basic Mod allowing to perpetuate this modification.
Remark:'. These brief explanations cannot replace the reading of the articles dealing with Mods and their syntax. See below (in English)

1. Open a new file in Notepad++ (Menu >> File >> New) and enter the lines below :

%name:My Mod for Personal Convenience%

%version:V13.0.2.1%

%description: this is my little mod and it changes some lines in som files%

%target:admin_generatethumbs.php%

%location:%
$maxsizeallowed = 1000; //KB
%end:%

%replace:%
$maxsizeallowed = 1100; //KB
%end:%

2. When you are finished, save the file :
a. on your PC, where you can easily find it.
b. by giving it a recognisable name (ideally "My Mod for personal convenience" as in the %name: section of the file you have just written).
. c. by giving it an extension .cfg, indispensable for the file to be recognised as Mod.
The filename will therefore be My Mod for personal convenience.cfg.

3. Via Filezilla, transfer the new file thus saved to the mods directory of your site.

By going to your TNG program, Admin Menu >> Mod Manager, you will find your new Mod "My mod for personal convenience" as "Installed".

Mod Installed


Complete your knowledge

Related article with examples on Managing_Configuration_Files