""
Documentation daCode : daCode webmaster's guide
Chapitre 5. Customization

 

Sharing your themes

 

Creating an archive

Once your new theme is up and running, you may wish to share it with others. This is really simple: just define in the configuration file src/phplib/config.php3 the variable $this->create_tar_dir and set it to the name of a directory where PHP has access for writing; use your admin account on your daCode copy and click on "themes" in the administration box. Next page shows the list of themes already installed, and a click on a link produces an archive.

For exemple, if $this->create_tar_dir is set to "/tmp/" and the theme is called "print", the file /tmp/daCode-print-0.1.tar.gz has been created. The version number is read in the file src/phplib/themes/print/VERSION as explained below.

 

Content of the archive

Here is what the archive for the "print" theme may hold:


    daCode-print-0.1.1
      |-- html
      |   |-- images
      |   |   |-- image1.png
      |   |   |-- image2.png
      |   |   |-- logoprint.png
      |   |   |-- section
      |   |   |   |-- dacode.png
      |   |   |   |-- topic1.png
      |   |   |   `-- topic2.png
      |   |   `-- text-plain.png
      |   `-- print.css
      `-- templates
      |-- VERSION
      |-- admin.tmpl
      |-- basic.tmpl
      |-- board.tmpl
      |-- doc.tmpl
      |-- html.php3
      |-- myposts.tmpl
      |-- news.tmpl
      |-- newsindex.tmpl
      |-- newssection.tmpl
      |-- poll.tmpl
      |-- search.tmpl
      |-- submit.tmpl
      |-- submitcom.tmpl
      |-- submitpoll.tmpl
      |-- thread.tmpl
      |-- users.tmpl
      `-- webcam.tmpl
      
      
   


The file daCode-print-0.1/templates/VERSION is made of the three following lines:


    1
      print
      0.1
      
   


It's only the name of the theme, and the version number, the first line indicating the format used (right now, only 1 is recognized by daCode). This file is necessary to create or extract an archive with the daCode interface.

As you can see, it's easy to create an archive by hand, without using daCode. Put the templates in a subdirectory templates/, add a VERSION file there holding the name and version number of the theme, and put in html/ the files undersrc/htdocs/themes/print/.

 

Submiting a theme to a daCode site

This part is not yet implemented; add a page allowing the user to upload his/her archive. This archive will be put in $this->upload_tar_dir as defined in the configuration file.

You can also submit your theme directly to daCode's official site, if you wish.

 

Installing a new theme

When a surfer submits a new theme, or when you put an archive in the directory defined in the variable $this->upload_tar_dir of the configuration file, the administrator of the daCode (ypu!) site may install this new theme. To do that, just click on on the link "Themes" in the adminnistration box. The next page shows a list of the allready installed themes, and the list of archives longing to be installed. By clicking on an archive, you can see the list of files in the archive. Click on the filenmae to view the coontent of the file. After having verified the themes, you can choose to install the archive or delete it.

This procedure always installs the files in the right place, even if htdocs or phplib/ have been renamed or moved.

PHP must have wrtite access to src/htdocs/themes/ and src/phplib/themes/ to be able to extract the files. To avoid to give write access to thesse directories, set the variable $this->theme_subdir to a subdir which will be the only one to which PHP has write access. So, if $this->theme_subdir="contrib/", you must create the directories src/htdocs/themes/contrib and src/phplib/themes/contrib/ and give PHP write access on them.

The "print" theme will then be unpacked in the src/htdocs/themes/contrib/print/ and src/phplib/themes/contrib/print/directories.

To make this new theme available, you have to add it to $this->listofthemes, as we explained above.