Tutorial‎ > ‎

Config

Configuration file

Well, config file... Many parameters may need to be defined to assemble your site. Location of your source and target directories, which template to use for which file extension, definition of entities and macros and so on. Passing it all through a web form may be inappropriate (too many url arguments to store in bookmarks). So the decision was made to collect all the necessary parameters in an XML config file. Now when running osb.php you just have to provide a path to your config file which stores all the needed information.

Hopefully most of these parameters have good default values and don't need to be reassigned. This is the list of what really needs to be provided:

site title
the name under which your site is assembled (also available in &.site-title; placeholder)
template
the site template file name
source folder
the folder containing your source files
target folder
the folder where the final site is assembled

Here is our config.xml file:

<site title="OSB Tools">
  <delimiter> ^ </delimiter>
  <template>base/template.html</template>
  <source>www</source>
  <target>/users/stas/sites/osbtools</target>

  <sitemap id="osb" url="http://osbtools.googlepages.com">osb-sm.xml</sitemap>

  <macro name="c" params="1">
    <![CDATA[<code>$1</code>]]>
  </macro>
</site>

It defines OSB Tools as site title, www as a source folder relative to config.xml, base/template.html as a template also relative to config.xml and /users/stas/sites/osbtools as our target folder for assembled site pages. The sitemap file osb-sm.xml will be generated in the target folder if osb id is provided when launching OSB. The macro definition at the end of a file is optional and will be discussed later in Using entities and macros.

After implementing all the techniques discussed above our complete development tree is as follows:

/users/stas/tpl/osbtools/
| + config.xml
|
+-base/
| + template.html
|
+-www/
  | _sections.xml
  | google.css
  | osb.css
  | flow1.png
  | menu-sample.png
  | osbtools-sitemap.xml
  | start.src
  | tutorial.src
  | reference.src
  | support.src
  + links.src

/users/stas/sites/osbtools/

For a full list of parameters in config file see the Config file tags in Commands Reference

Now is the time to meet entities and macros.

Comments