Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[New Plugin (or rather feature)] SKIN your directory Statically

Quote Reply
[New Plugin (or rather feature)] SKIN your directory Statically
1. Make sure your default setup options are exactly how you want them and then backup your ConfigData.pm just in case anything goes wrong. In fact, a local copy of everything in your links install would be optimal.
cp /path/to/admin/Links/ConfigData.pm /path/to/admin/Links/ConfigData.pm.bak

2. Don't forget to have your extra template(s) set up first. And if there are any links pointing to hard paths, make sure to change them to the path you will be setting up below.

3. Click on "Setup". Then click on "Paths and URLS". Modify the "build_root_url" and "build_root_path" to the new path you want for your skin.
!MAKE SURE TO CHECK THE update_others Check box at the bottom and hit submit.

4. Click on "Build Options" then on "build_default_tpl" you need to change it to the template you will want to be skinning. Submit.

5. Issue this command (on Linux boxes) but change the template name and the path to what you need:

cp /path/to/admin/Links/ConfigData.pm /path/to/admin/Links/ConfigData.pm.templatename

Then in case there are any problems, you want another backup of the new ConfigData.pm.templatename so do this command too:

cp /path/to/admin/Links/ConfigData.pm.templatename /path/to/admin/Links/ConfigData.pm.templatename.bak

6. Create a file called LinksNightly.sh and put this code inside after you've changed the paths to match your system
(you'll have to modify these instructions if you're on a Windows system)

#!/bin/sh

##IMPORTANT NOTE...in case any of this
##dies in the middle of running,
##it can cause some loss of preferences.
##Therefore, copies of the two versions of
##ConfigData.pm are kept in ConfigData.pm.bak
##and ConfigData.pm.templatename.bak

#run normal verify and build process
/path/to/admin/nph-verify.cgi --check_all
/path/to/admin/nph-build.cgi --all


#Copy normal configuration data into a temp file. It will be returned later
cp /path/to/admin/Links/ConfigData.pm /path/to/admin/Links/ConfigData.pm.temporary

#Copy newtemplate configration into regular config file
cp /path/to/admin/Links/ConfigData.pm.templatename /path/to/admin/Links/ConfigData.pm

#Build newtemplate
/path/to/admin/nph-build.cgi --all

#Copy back temp file to normal configuration file.
cp /path/to/admin/Links/ConfigData.pm.temporary /path/to/admin/Links/ConfigData.pm

7. You can run that code manually every time you want to build. But much better is to put it into a cron job and run it every night. It will build both versions of your skins every night as well as verify all links in your database. (Using the same principle, you can build as many template skins as you want). Here's is how I would set up cron:
crontab -e
then it will allow you to add an entry (if you have any entries there already, do NOT erase them, simply add this to the bottom)
15 4 * * * /path/to/LinksNightly.sh

Then it will run every night at 4:15 am.

Good luck!

Last edited by:

dwh: Aug 12, 2004, 12:57 PM