Gossamer Forum
Home : Products : DBMan : Customization :

Multi External html_record Templates

Quote Reply
Multi External html_record Templates

I am running a product database and I have managed to hack a cart mod of my own to it, that is working fine. Although I am running one product database, each product category ideally has a different layout (html_record). I would like to have the option when adding a product to choose a layout for either the product/category it's in which ever is going to work. This template would ideally be held outside the normal .pl file so that it can be edited at any time without having access to the main .pl file.

I hope i've made my request clear enough...Blush
Quote Reply
Re: [RobR] Multi External html_record Templates In reply to
Below from user-friendly html.pl
# Notes on the "user-friendly html.pl":

# If you have more than one DBMan database on your site and you would like to have all
# the pages coordinate, you can cut the "HTML Globals" and "Page Layout" sections from
# each of your html.pl scripts and place the sections in a separate file. Name the file
# format.pl
# and upload it into the same directory as the other DBMan scripts. Set the permissions
# to 644 [-rw-r--r--]. Uncomment (that is, delete the # at the beginning of the line)
# the next line in each of your html.pl scripts.

# require $db_script_path . "/format.pl";

This would be how you would facilitate the .pl file(s) being outside of the main .pl file.

Then you just need a different sub for each layout, such as, product_with_photos or product_without_photos, and then some sort of a trigger to activate the correct sub, such as

if ($rec{'graphic'}) { &product_with_photos; };

Other than that you can have one sub, with "block" of code that are skipped based on some variable.

Good luck.
Quote Reply
Re: [joematt] Multi External html_record Templates In reply to
Great thanks

That's done the job...