====== Converting ====== All files which need to be edited with Instant Update's code editor will have to be converted to IU format. Conversion process is very easy because everything you need to do is to: * [[#make_.php_files|rename all files]] and change their extension to .php * [[#add_header|add custom header]] to each file * [[#add_footer|add custom footer]] to each file * [[#chmod_files|chmod files]] to 777 ^ :!: Notes ^ | Windows and Linux/Unix users can automatically convert websites using our [[install:iuconvert|IUConvert]] tool. | | Properly configured servers may [[converting_auto_prepend|avoid conversion process]]. | ===== Make .php files ===== Instant Update is written in PHP, which is server side language, and most of web servers are configured to process PHP language only in files which have .php extension. If you have .html pages on your website we suggest you to rename all those files and change their extension to .php. We know that sometimes this is impossible because it would break all your links and that is not an option on very big web sites, so we have a couple of [[tricks]] you could try, but note that those [[tricks]] apply only to Apache web server. ===== Add header ===== Instant Update header might seem complex to understand, and that's why we introduced [[install:iuconvert|IUConvert]] application for those which can't or simply don't want to understand following: Instant Update header should be placed one line below **
** HTML tag in your page. Note that sometimes this won't be just **** tag, it can be **** tag, place Instant Update header at the very beginning of file. Instant Update header consist of four lines, but first line is opening PHP tag (****) so it's actually two line code, but second line is always same and only first line of actual PHP code changes. Here you can see how ordinary Instant Update header looks like:
This is ordinary header which works in all files which are in your website root (usually named htdocs/ or public_html/), but when your pages are in subdirectory, this line must be changed. Let's analyze this line: It calls function named define() which defines constant with name **BASE_PATH** and value **./** - If we know that / separates folders in Unix/Linux/Web environment, then we have only **.** (single dot) as **BASE_PATH**, and if we have some knowledge about operating systems we should know that **.** (single dot) refers to the __current directory__ while **..** (double dot) refers to the __parent directory__.
Now, because most of our files are in the same level as **manage/** folder, we need to define **BASE_PATH** as **.** (and append **/** (slash) at the end of it), but if we have file which is in subfolder, we should define **BASE_PATH** as **..** (and append **/** (slash) at the end of it). For two or more subdirectories we need to have as many double dots as there are subfolders in the tree, all of them divided with **/** (slash), and with **/** (slash) at the end. Confusing? Let's take a look at the following directory tree, it should be easier to understand from tree:
* manage/
* subfolder/
* another_folder/
* file.php //(BASE_PATH is ../../)//
* contact.php //(BASE_PATH is ../)//
* index.php //(BASE_PATH is ./)//
Here we can see that //index.php// is in the same level as **manage/** folder so **BASE_PATH** in that file should be defined as reference to current directory (single dot) with slash at the end, so it is **./**\\
File //contact.php// is one level below **manage/** folder (in one subfolder) so **BASE_PATH** in that file should be defined as reference to parent directory (double dot) with slash at the end, so it is **../**\\
Finally, file //file.php// is two levels below **manage/** folder (in two subfolders) so **BASE_PATH** in that file should be defined as reference to parent directory of it's parent directory (two double dots (..) divided with slash (/)) with slash at the end, so it is **../../**
Following this logic, you can create **BASE_PATH** for each directory depth on your website. If you don't want to bother understanding this and you are Microsoft Windows or Linux/Unix user, you can simply use [[iuconvert|IUConvert]] to convert your pages.
^ :!: Note ^
| If you want to learn more about files, directories (folders) and file systems in general, we suggest you to visit [[http://en.wikipedia.org/wiki/Category:Computer_file_systems|Wikipedia]]. |
===== Add footer =====
To add Instant Update footer to your pages just open your files and search for **** HTML tag. When you find it, add following code **one line above** it:
If you can't find **** HTML tag, just place above code to the very end of your file. Note that whole code needs to be written in one line, as displayed above.
===== CHMOD files =====
All files which are going to be edited with Instant Update's code editor should be writable (have [[install:configuration#chmod|CHMOD]] 777) so Instant Update's editor can save changes you make. You can (and should) [[install:configuration#chmod|chmod]] all these files back to 644 once you complete your website and have no need to edit files anymore. Note that you will be able to edit texts on your website (with Instant Update's WYSIWYG editor) even if files are not writable (have [[install:configuration#chmod|CHMOD]] 644).