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

Links SQL templates

(Page 2 of 2)
> >
Quote Reply
Re: [ManuGermany] Links SQL templates In reply to
I just thought of a new idea on how to do this skinning.

Since the data is in /admin/Links/Config/Data.pm, then you copy that file into /admin/Links/Config/DataAlt.pm...manually modify the line which says which template to use.

In the cron job, first you call the initial nph-build, and then you cp /admin/Links/Config/Data.pm to /admin/Links/Config/DataBak.pm
Then cp /admin/Links/Config/DataAlt.pm to /admin/Links/Config/Data.pm.
Then you call nph-build again.
Then you cp /admin/Links/Config/DataBak.pm to /admin/Links/Config/Data.pm

BUT, you have to always remember if you ever change anything in the setup, you need to manually copy
/admin/Links/Config/Data.pm to /admin/Links/Config/DataAlt.pm and put in the alternate template line in there.

Do the Links pros here think that would work?
Quote Reply
Re: [dwh] Links SQL templates In reply to
I'm testing this out and it seems to be working. It's a little more complex though, because you also need to make a copy of your skinned directory in the /templates directory. Then you need to rename the templates/default dir to a temp dir, and rename the templates/yourskin dir to /default and then after building, reverse it.
Quote Reply
Re: [dwh] Links SQL templates In reply to
Hi. Are you running this statically?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links SQL templates In reply to
Yes, and the test worked. But first I did it the tough way until I realized/noticed that I can change which template gets built. No need to bother changing around the template directories.

Here are the steps (I will copy this to a new release thread. I don't know the procedures here so if a mod wants to help add the new thread to the resources section that would be great):

1. Make sure your 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!

Quote Reply
Re: [dwh] Links SQL templates In reply to
There is an easier way :)

Have a script, which has your default settings, and the new builds settings (i.e with a different template set), and then switch the config file, run a build, switch it back, and then redo the build (for the other site).

I do this on a couple of sites :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links SQL templates In reply to
That's exactly what this does.
Quote Reply
Re: [dwh] Links SQL templates In reply to
Yeah, a little easier though :) (about 50 lines of code I think). I'm sure your way works... just mine does too :)

Night.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links SQL templates In reply to
Oh, I see what you mean, your script does not physically change the filename.
Quote Reply
Re: [dwh] Links SQL templates In reply to
Yup :)

I would post it... but seeing as a client paid for my time to develop it, I'm not sure it would be very fair on them :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [dwh] Links SQL templates In reply to
Yup :)

I would post it... but seeing as a client paid for my time to develop it, I'm not sure it would be very fair on them :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
> >