Author Topic: Unique Templates for Select Directories  (Read 3135 times)

0 Members and 1 Guest are viewing this topic.

Offline Dino

  • album.pl Donor
  • I Spend Too Much Time Here
  • *****
  • Posts: 250
  • Karma: +5/-0
  • That's actually my childhood cookie jar!
    • Dino's Bulletin Board
Unique Templates for Select Directories
« on: November 01, 2002, 13:25:16 »
Mike,

It would be REALLY splendid if one could set different templates for different directories.

Just like one can set different sort parameters per directory by placing a sort cfg file into that directory, it would be AWESOME if one could do something similar to the template of that directory.

Just an idea.
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

"He who seeks the truth must doubt everything."Aristotle
"Extraordinary claims require extraordinary proof."Sagan

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Unique Templates for Select Directories
« Reply #1 on: November 03, 2002, 05:29:32 »
You can!

It's the beauty of local configs... Just drop an album.cfg in your directory that contains something like this:

Code: [Select]
# Path and filename to all templates. See !readme.html for template format information. This path should be absolute.
template_dir=C:/inetpub/wwwroot/AlternateTemplates


That'll define a new directory to load all templates from. Or you can define a new template one at a time:

Code: [Select]
# Filename of the album template file. This file is used as a template to display albums, and must be located in the "template_dir" directory, as defined above. See !readme.html for file format information.
album_template=alt_album.tml

# Filename of the photo template file. This file is used as a template to display photos, and must be located in the "template_dir" directory, as defined above. See !readme.html for file format information. (Note: The default is now to use album.tml, but you can use a different album and photo template if you want.)
photo_template=alt_album.tml

# Filename of the upload template file. This file is used as a template to display the upload form, and must be located in the "template_dir" directory, as defined above. See !readme.html for file format information.
upload_template=alt_album_upload.tml

# Filename of the upload rating template file. This file is used as a template to display the rating form, and must be located in the "template_dir" directory, as defined above. See !readme.html for file format information.
rating_template=alt_album_rating.tml

# Filename of the login screen template file. This file is used as a template to display the login form, and must be located in the "template_dir" directory, as defined above. See !readme.html for file format information.
login_template=alt_album_login.tml

# Filename of the recent uploads screen template file. This file is used as a template to display the recent uploads to your album, and must be located in the "template_dir" directory, as defined above. See !readme.html for file format information.
recent_template=alt_album_recent.tml


So if you just wanted a new header, just define a new album_template and leave the rest the same... Or you could define a new "photo_template" for a specific album, if you wanted to view photos in a unique way there...

You can also do things like defining per album style sheets. Check out my directory in the sample album.

Offline Dino

  • album.pl Donor
  • I Spend Too Much Time Here
  • *****
  • Posts: 250
  • Karma: +5/-0
  • That's actually my childhood cookie jar!
    • Dino's Bulletin Board
Re: Unique Templates for Select Directories
« Reply #2 on: November 11, 2002, 11:19:40 »
Damn, dude! You rule!

I love the way you can setup different cfg files into different directories! I thought this only worked for sorting, but now this!? Did you think this out, or is this just a by-product of luck? You rule.

While we're on the same topic, is it possible to drop in a cfg file for admin rights for certain directories? For example, I'd like my users to be able to administer their own albums (add/delete/revise subdirs, etc). Is that also possible with a unique cfg file?
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

"He who seeks the truth must doubt everything."Aristotle
"Extraordinary claims require extraordinary proof."Sagan

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Unique Templates for Select Directories
« Reply #3 on: November 11, 2002, 19:40:25 »
Indeed you can. In fact, here's a list of some of the tings a local config can do for you:

Quote
     * Each album to have a custom "look & feel" including style sheets, templates, icons, photos per page, colums, thumbnail properties and sort options
     * Permitted file types (one album can be used to view only photos, another for documents, etc)
     * Features such as ratings, slideshows, jhead or ImageMagic integration can be turned on or off on a per album basis
     * Each album can point to it's own album_strings.txt file, allowing customization of all text
     * Local administrators can now administer the photos in their specific album(s), regardless of who uploaded them
     * Albums can be individually password protected, or use a different authentication mechanism (UBB for one, YaBB for another; or use multiple flat file databases, one for each album)
     * And I'm sure there's more that I'm just not thinking of!


I think it's one of the more powerful features of album.pl, and was pretty happy when I got it working.

Cheers
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Dino

  • album.pl Donor
  • I Spend Too Much Time Here
  • *****
  • Posts: 250
  • Karma: +5/-0
  • That's actually my childhood cookie jar!
    • Dino's Bulletin Board
Re: Unique Templates for Select Directories
« Reply #4 on: November 11, 2002, 21:48:42 »
I would defintely add this feature list to the Tips N Tricks. This is amazing news! I once thought I was using 100% of album.pl. Then I discovered ACDCee and FTP. I then realized I was only using 40% of its functionality.

Now, I discover that each directory can have its own cfg file, which changes EVERYTHING I've ever known about album.pl. Now I realize I've only been using 10% of its functionality.

Album.pl amazes me at least a few times per month!

Mike?! Gosh darn it! You *RULE*!
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

"He who seeks the truth must doubt everything."Aristotle
"Extraordinary claims require extraordinary proof."Sagan

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Unique Templates for Select Directories
« Reply #5 on: November 12, 2002, 05:30:58 »
Well I think you've discovered most of the "surprises" in album.pl. This is all just because the documentation is so far behind the code base anyway.  ;D

I like writing my programs to be flexible and extensible. The reward is that users *always* figure out a cool way to use your stuff that you never thought of. :D
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Dino

  • album.pl Donor
  • I Spend Too Much Time Here
  • *****
  • Posts: 250
  • Karma: +5/-0
  • That's actually my childhood cookie jar!
    • Dino's Bulletin Board
Re: Unique Templates for Select Directories
« Reply #6 on: November 12, 2002, 15:17:26 »
Here's different templates in use today:

My Personal Album (default template, customized of course):
http://dinofilias.com/cgi-bin/album/album.pl

My SVE Archives Album (different template since I use this for work):
http://dinofilias.com/cgi-bin/album/album.pl?album=11sve

And, here's some pics from the 2002 SEMA Show, if anybody cares:
http://dinofilias.com/cgi-bin/album/album.pl?album=11sve/2002sema/zzshowinfo

Custom templates via unique cfg files is AWESOME! I can't wait to turn on the personal folder option that will allow members to only upload into their own albums. I am going to create a custom cfg file for each directory (giving that user admin rights to their folder), in order to give users more control of their directories (i.e. create subdirs, move, etc.).... which leads me to more questions:

1) If I create different cfg files for each user directory, and they try to move a pic, will it only let them move pics within their own directories? I'm sure I'll answer my own question soon enough.

2) If there is a cfg file within a user directory, and they now have admin rights to that directory, what happens when they create a new directory? Will they have admin rights to that, or will I have to place the cfg file in the directory they created? I'm sure this is unchartered territory.

"He who seeks the truth must doubt everything."Aristotle
"Extraordinary claims require extraordinary proof."Sagan

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Unique Templates for Select Directories
« Reply #7 on: November 13, 2002, 06:27:22 »
Hey Dino,

Once again, nice work. :)

As for the local config questions, it may not be as "cool" as you thought. A local config will apply to the album it sits in, but will not always apply for "global" things like the upload screen. So while you can have a allow_uploads=0 item in a local config, that'll mean that if the user clicks on upload from that album, they'll be told that uploads are not allowed. But if they click on upload from any other album, they can still upload into the "blocked" album. (You could add a no_upload.txt file, but this is just an example.)

Note: This is in the latest version. In older versions (possibly the version you're running) even that won't work!

It still needs some tinkering to be completely effective for these "global" types of overrides.

And to answer your 2nd question, if a new album is created, it immediately falls under the global config, not the config of it's parent album. Not sure if that makes sense or not, but there are pros and cons to both methods...

Cheers