• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

HOWTO: Install all templates automatically

C

citrus

Guest
Here is a linux shell-script, which installs all available sitebuildertemplates automatically.

It parses the sourcecode of the SW-Soft template-download-page and installs all available templates.

Log on your machine, where the Sitebuilder is installed.
Create a file called templateinstaller.sh and fill it with the following code:

Code:
!#/bin/sh
# This works only on Debian!

touch source.txt
> source.txt

rm -rf index.html
wget http://www.swsoft.com/en/download/sitebuilder2/templates/

echo "Start downlading templates..."
cat index.html | grep zip |  awk '{ print $2 }' > source.txt
sed -i 's/href="//g' source.txt
sed -i 's/">ZIP//g' source.txt

mkdir tpl_zip

for DOWNLOAD in `cat source.txt`
 do
        echo ""
       wget $DOWNLOAD -P ./tpl_zip
 done

echo "Downloading finished..."

# Installing Themes

cd tpl_zip
ls *.zip > files.txt
sed -i 's/.zip//g' files.txt

mkdir files
for FILE in `cat files.txt`
 do
        unzip "$FILE".zip -d ./files/$FILE
 done

cd files

for DIR in `cat ../files.txt`
 do
        cd $DIR
        mv *.zip ../
        cd ../
 done

ls *.zip > templatelist.txt

sed -i 's/.zip//g' templatelist.txt

for TEMPLATE in `cat templatelist.txt`
 do
        unzip "$TEMPLATE".zip -d /usr/local/sitebuilder/htdocs/repository/templates/$TEMPLATE
 done

cd ../
cd ../

chown -R www-data:www-data /usr/local/sitebuilder/htdocs/repository/templates/*
# use apache:apache on Redhat Systems, or nobody:nobody on a cPanel machine (but my experiences on a cPanel system weren't good).
ls /usr/local/sitebuilder/htdocs/repository/templates/ > /usr/local/sitebuilder/htdocs/repository/templates/tmpl_inst

echo "Install complete!"
echo "you can delete the folder tpl_zip"
exit 0

Now do:

# chmod +x templateinstaller.sh
# ./templateinstaller.sh

It takes some minutes to finish.
After it's done you have to logon to the admininterface.

Hope that helps somebody.

citrus
 
A couple of errors...

chown: `www-data:www-data': invalid user

and none of the templates are added the admin section :(
 
Thanks.

Any reason why the templates do not show? What am I missing?
 
if the template directory is not owned by apache (the webuser) then the webclient can't access the direc tory and the templates don't show up.

run

chown -R apache:apache /usr/local/sitebuilder/htdocs/repository/templates/*

and see if they show up
 
Thanks, tried that - the three default ones show up fine - just none of the others :(

Thanks anway.
 
Originally posted by First Hosting
Thanks, tried that - the three default ones show up fine - just none of the others :(

Thanks anway.

do you run cpanel?
then it's nobody:nobody

what is in your /usr/local/sitebuilder/htdocs/repository/templates/ ? there should be a lot of folders.

You have to
# ls /usr/local/sitebuilder/htdocs/repository/templates/ > /usr/local/sitebuilder/htdocs/repository/templates/tmpl_inst
everytime you wan't to update your skins.
 
This might help some of you, so I thought I'd post it.

I just attempted to use this script for FreeBSD 5.3 and discovered that the version of sed on my machine doesn't like the '-i' flag without the name of a file extension to save a backup to.

I changed the sed lines as follows:

sed -i bak 's/href="//g' source.txt
sed -i bak 's/">ZIP//g' source.txt
sed -i bak 's/.zip//g' files.txt
sed -i bak 's/.zip//g' templatelist.txt

Also, FreeBSD requires the apache:apache perms, FYI.

Otherwise, it worked perfectly! Thanks!

(Note, modified to fix the sed lines)
 
Hmmm... just found a problem with this. While the script worked perfectly as far as I can see, none of the templates are showing up in their categories.

When I go into the sitebuilder interface and go to the templates section, all of the templates are listed, but their category is listed as 'none'.

Anybody know how to link the categories back up? I can see that they are in the xsl file for each template.

Any advice?
 
Back
Top