Home
About
Agents
CGIs
Mac
Macros
Misc
Stories
Suites
Websites
Outline
Frontier
Scripting

Conditional Images

I've decided to try something new. When an interesting question comes up on the Frontier-newbies list or the Frontier-webmaster list, and if the question can be answered by building a small site, I'm going to build the site on my machine and put it up on a fat page for other people to see.

Todd's site

To kick it off, Todd Breiholz, todd.breiholz@jh-kvi.com, says: 'I have a #template for my site that is defined as two columns of an HTML table. Column 1 contains general site info that appears on all pages, column 2 is the bodytext. Each page has a #title directive, with the #title of the homepage being "Home". I have an image that I only want to display on my Home page at the top of column 1.'

Excellent! The site that's embedded in this page works exactly this way.

After loading the site into your database, build the default page. You should see a turkey at the top of column one. Then build the "otherPage". You should not see the turkey.

This is accomplished with a script that's defined at the top of the template called homePageImage. Here's what the code in that script does:


if html.data.adrPageTable^.title == "Home"

	return (html.data.standardMacros.imageRef ("turkey"))

else

	return ("")

By calling this as a macro at the top of column one, we get the behavior Todd is asking for. If it's the home page the graphic appears, otherwise it doesn't.

So you can see what the pages should look like I've rendered them to betty.userland.com. Here's the home page, and here's the other page.

Discuss on the Frontier-newbies list.

Dave Winer
2/25/98


This is a fat web page containing websites.toddSite. More info on fat pages here.

© copyright 1997-98 UserLand Software. This page was originally posted on 2/25/98; 6:41:09 AM and it was last built on 9/11/98; 9:23:47 AM. Webmaster: dave@userland.com.