Re: Random templating
by ikegami (Patriarch) on Oct 08, 2004 at 05:27 UTC
|
Of course! Keep track of the user's prefered template in a session/cookie, and feed the appropriate filename to your template engine based on this value. It's even simpler if your templates are only different in terms of CSS like at CSS Zen Garder, where you can simply return a different .css based on the session/cookie.
| [reply] |
Re: Random templating
by BigLug (Chaplain) on Oct 08, 2004 at 05:40 UTC
|
Sulfuric:
This is a bad idea™. You will disorient your visitors to the point where they won't be sure where they are. Consisancy is the most important thing in branding. Imagine if every MacDonalds had a random color/font for their 'M' .. you'd not be sure if it was McDonalds or not.
The only exeption I make to that rule is for websites-as-art which, as you've had other people create the look, is not what your site is. Art sites can change as often as they please because the site itself is a piece of art.
All that being said, here's the answer you're looking for:
If your site is CGI based then it's as simple as storing a cookie for however long you want them to get the same template. Read the cookie on each page load and return templates based on the cookie.
If your site is file based, then you want to store your two sites in directories like www.yoursite.com/site1/page.htm and www.yoursite.com/site2/page.htm. Then in apache (which I'll assume you're using) you need to do a mod_rewrite. It's not a two second job and its really not a perl question so I'll leave it at that. Take a look at the apache documentation for mod_rewrite for more information. You'll basically be rewriting www.yoursite.com/page.htm with one of the above links based on a cookie. (Remembering to have some fall back for non-cookie people ... like mod the day of the week).
Just remember that if your site is file based, you'll have to update files in both directories every time you make a change.
Once again though, let me reiterate that this is a bad idea™ and that your users will become confused. I once saw a site with multiple designs but I had to choose to change from the default so at least I knew I was at the same site I'd been at last time.
Cheers! Rick
If this is a root node: Before responding, please ensure your clue bit is set.
If this is a reply: This is a discussion group, not a helpdesk ... If the discussion happens to answer a question you've asked, that's incidental.
| [reply] |
Re: Random templating
by saskaqueer (Friar) on Oct 08, 2004 at 05:31 UTC
|
<rant>
I realize I am not helping you with the actual question you have posted, but I feel it is necessary to point out that multiple templates for one website is one of the most horrid things you can do to a user. I login to perlmonks expecting everything to look the way it did the last time I visited. You may think both templates are worthwhile, but having your pages look different on each separate visit to the site is a Bad Thing™. You will manage to do nothing more than confuse, frustrate, and irritate your users. Today's lesson: one website, one template.
</rant> | [reply] |
|
| [reply] |
|
Sorry, perhaps I should have specifically stated that multiple visual templates are horrible. Obviously, permitting different templates for uses such as WAP, text-only, etc. are a good thing. My concern is website designers who take it upon themselves to alternate their pages' templates for visual browsers (IE, Netscape, Opera, etc.).
| [reply] |
|
| [reply] |
|
| [reply] |
Re: Random templating
by dws (Chancellor) on Oct 08, 2004 at 06:21 UTC
|
Is it possible to create a CGI that'll load the moment index.html loads that will load one or the other template/web site?
If you're using Apache, you could use mod_rewrite to rewrite the URL to invoke a CGI, passing it index.html; then select templates at random.
| [reply] |
Re: Random templating
by tmoertel (Chaplain) on Oct 08, 2004 at 15:49 UTC
|
Dear sulfericacid,
Many people are warning you that randomly switching the
layout and look-and-feel of your site is likely to harm
your site's usability. However, only you are in a position
to make that call. Maybe you know something that we don't.
Maybe your site is all about art and exploration, or maybe
your users come to your site for an "experience" and not
to find information, do their jobs, or purchase a product.
In any case, it's your call to make.
What's particularly interesting about your situation is
that it provides a perfect opportunity for all of us to
learn something. Is the common wisdom – that swapping UIs
frequently is "bad" – applicable to your site?
Let's find out!
Let's design a simple experiment to measure the effect of
random UI swapping on your users:
- Partition your users into two equally sized groups: the
experimental group (those who will be subjected to random UI swapping
every time they log in) and the control group (those who won't). To
eliminate bias among the UIs, each user in the control group should be
randomly assigned one of the two new UIs, which then becomes that
user's UI for the duration of the study.
- Whenever users log in, determine which group they are in and
select their UIs accordingly.
- After a month or so, analyze your logs, site feedback, etc. to
determine if there is a significant difference in behavior between the
experimental and control groups. (For example, if common wisdom is
correct, we would expect that site usage among experimental-group
users to drop off w.r.t. control-group users.)
Sounds like fun, don't you think? When it comes to your site, care to prove the
experts wrong? (Or right?)
Cheers, Tom
Update: clarified wording.
| [reply] |
|
I agree the proof is in the pudding and benchmarking is crucial to having valid opinions but I've seen the pudding served to 10-20 million users a day all year and even minor changes like moving a linked heading lower or higher relative to other page blocks does change usage. This isn't really an experimental problem any more. What if someone moved your mousepad every morning? Oh, that's amusing.
As discussed, a pure design site or something might make constant change interesting or desirable, otherwise it's probably a vanity choice and not really in your users' good interests. And even the design sites that do this kind of thing stay strongly branded with a big headline/logo/etc. I can't think of a single site I've visited more than once in 10 years that does this though. On the other hand, letting users select a template or stylesheet is most definitely in their interest and good service. And if it's your site, it's your call.
The other problem with doing it via two different code bases instead of CSS or templates is you just locked yourself into a future course if you intend to keep users who do like the different systems happy. If you upgrade, redraft, change then your costs/time just doubled. If you can change one of the systems to run with the template of the other (the end product of HTML doesn't care what created it) you'll probably be happier as time goes by. Plus you're in an unusual and enviable position. You have two code bases done and running, and you could pick the better written of them.
| [reply] |
Re: Random templating
by dragonchild (Archbishop) on Oct 08, 2004 at 12:06 UTC
|
It sounds as if you don't want any static content at all. Use mod_redirect to redirect any URL with a /$ in it to /cgi-bin/main.cgi (or whatever) and you're good.
For the record, I don't think you should require your users to have a randomly-selected template. Providing different skins is a good thing, but the user should be in control of how s/he views your site. It's your information, but it's their eyes. Additionally, what if the user is color-blind? One time, they see a green and blue site (which is fine), then the next time they see a green and red site (which isn't fine). Uh-oh ...
Being right, does not endow the right to be rude; politeness costs nothing. Being unknowing, is not the same as being stupid. Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence. Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
| [reply] |
Re: Random templating
by schumi (Hermit) on Oct 09, 2004 at 18:56 UTC
|
Hello sulfericacid
You have so far read a lot about why using several different templates can be a bad or a good idea. I suppose you known what you're doing there, or give it a good thought now after having read all the above posts.
Having said that, off the top of my hat I'd recommend HTML::Template for the task. It takes a bit of fiddling to get your mind around how it does the more compliacted things like loops and such, but once you know the drill it's a blast. Entering this into Super Search should give you plenty of information as well. There's even a review of the module by defyance.
You can still use Cookies to keep track of the users' preferred template, or whatever mechanism takes your fancy.
Hope this helps!
--cs
There are nights when the wolves are silent and only the moon howls. - George Carlin
| [reply] |