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:
| |
|---|
| |
| |
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.
Instant Update header might seem complex to understand, but currently this is the only way to integrate script:
Instant Update header should be placed at the very beginning of your page, before anything else.
Instant Update header consist of four lines, but first line is opening PHP tag (<?php) and last line is closing 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 CODE HAS BEEN DEPRECATED, PLEASE TAKE A LOOK AT FOLLOWING SECTION TO GET PROPER CODE!
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:
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 to convert your pages.
| |
|---|
| If you want to learn more about files, directories (folders) and file systems in general, we suggest you to visit Wikipedia. |
While above will work, it will almost always result in an invalid XHTML web pages (which is _NOT_ something BAD, but some people prefer their documents to be valid). To avoid invalidity, in version 3.1 we have introduced optional advanced header.
First of all you need to tell IU that you'll be calling meta and body functions manually, by adding following above “include” line:
define('IU_MANUAL_METABODY', true);
After this, IU engine will load, but it won't display anything to logged in users. To manually call meta functions, add this above </head> tag in your web page:
<?php WriteMeta(); ?>
…and to call body functions, insert this below <body> tag of your web page:
<?php WriteBody(); ?>
So, your web page should now look like this:
<?php define('BASE_PATH','./'); define('IU_MANUAL_METABODY', true); include BASE_PATH . 'manage/functions.php'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Webpage title</title> <!-- any references to JavaScript or CSS goes here --> <?php WriteMeta(); ?> </head> <body> <?php WriteBody(); ?> <!-- Your static web page contents (web page design, etc...) goes here --> <?php WriteFooter(); ?> </body> </html>
All files which are going to be edited with Instant Update's code editor should be writable (have CHMOD 777) so Instant Update's editor can save changes you make. You can (and should) 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 CHMOD 644).