Site Update

© 2005-2014 by Denis Sureau – Mozilla 1.1 Licence

https://www.scriptol.com/



Overview and Legal


Site update - formerly named updater - was a part of the webtools package, but now is improved and distributed standalone.
It if free and open-source under the Mozilla 1.1 licence.

Purpose


This tool copies a part (a menu for example) of a web page or any other html file, into all others in the site or the directory.
They are other methods to share a menu, as iframes, for example, but I was not satisfied with them.


Command and options


siteupd [options] sourcefile
siteupd [options] sourcefile dirlocation
siteupd [options] sourcefile @targetlist

Options

#n digit or letter of the starting marker.
The default starting marker is <!--XSTARTX--> the digit or letter replace the second X.
Example: #1 <!--XSTART1-->
The ending marker remains <!--XENDX-->

-i Insert only.
In this case, markers are not used, the whole sourcefile is inserted at top of each target file.

 

Other arguments

Sourcefile:

The file where the text to insert or replace is taken. With the -i option, the whole file is inserted, otherwise the part of text enclosed between starting and ending markers is inserted of replaced between same markers in target files.

Dirlocation:
The directory where files are taken. If not mentionned, the current directory is used. Thus, you have to move to a directory, and type:
siteupd sourcefile

@targetlist:
In this case, targetlist is a simple text file holding a list of files to update.

How markers are used


For the program to know which part of text to copy, and where to copy it, markers are used.
The default markers are these:

<!--XSTARTX-->
<!--XENDX-->


They enclose the text to copy, and they mark the location to copy it on other pages.
Once these markers inserted, just launch the script and the text if copied.


You can use several set of markers by changing the ending X letter by any other letter or a digit:*

 

<!--XSTART1-->
<!--XENDX-->

In this example, the digit 1 replaces the letter X and you have to pass this number to the program at run.

 

Using Site Update


Web pages are recognized by the extension: htm, html, php, php3, php4, php5, xhtml, dhtml, asp...
You can add or remove extension in the source and compile it with the freeScriptol compiler.
You can run the program inside the directory were the file to change are stored. You you can send the command from the siteupd directory. In this case you have to add the path of the model file, and the directory of the files to change.

You have to pass the letter or the digit for the part to update. By default, the X letter is user.

Alternatively, you can also use of list of files to change, stored inside a text file, built by the "makelist" program that is included.

siteupd source #n [directory | @list]

n is a letter: 0..9, A..Z, a..z, etc.

Copy a part of the source into all web pages in the directory:

siteupd c:\mysite\index.html c:\mysite

Same command, with a letter as argument, for the <!--XSTART1--> marker.

siteupd c:\mysite\index.html c:\mysite #1

Copy a part of the source into all web pages in the list file:

siteupd source @list


Siteupd.ini


This configuration file allows to:

 

Examples

The two markers are used to delimit the main menu of a html page. But other pages have a different Xml-related menu that is delimited by a second set of markers, I update the pages with two commands:

  1. siteupd index.php
    This propagates any changes inside the marked part of the index.php file, into all pages that hold same markers.

  2. spdate xml.html #1
    This propagates the changes from the XML menu into all XML-related pages that hold the markers (note the 1 in place of the X).