PDA

View Full Version : Category Comments


cambler
Apr-12-2005, 05:02 PM
Okay, so I've taken the really slick javascript replacement code posted in another thread and used it so that my layout knows when it's on a category page.

That is, my front page shows the categories, and when you click on one, you see the galleries in that category - we all know how that works. What I did was sniff the "cheerphoto's [whatever] galleries" and replace it with some other text specific to my site (see http://cheerphoto.smugmug.com if you're curious).

My text essentially tells my customers that they can select a team to see pictures. What I'd REALLY like, though, would be to be able to have customizable text here on a PER CATEGORY basis. Each of my categories is a cheerleading competition. I'd much rather be able to have text, per category, with some information on that competition.

Possible?

winnjewett
Apr-12-2005, 07:02 PM
What I'd REALLY like, though, would be to be able to have customizable text here on a PER CATEGORY basis. Each of my categories is a cheerleading competition. I'd much rather be able to have text, per category, with some information on that competition.

Possible?
I have also requested this feature in the past. I think the response was along the "we'll look into it, but there are more important things to take care of for now"

-w

Nikolai
Apr-12-2005, 08:40 PM
(see http://cheerphoto.smugmug.com (http://cheerphoto.smugmug.com/) if you're curious).

I went to check you site and saw this on your main page:

Competition Galleriespage/friendsandfamily.mg?FFID=25630&Type=Family&add=1">family ? )

I'm using IE6+/XP SP2, all the latest updates.

HTH

cambler
Apr-12-2005, 09:13 PM
I went to check you site and saw this on your main page:

Competition Galleriespage/friendsandfamily.mg?FFID=25630&Type=Family&add=1">family ? )

I'm using IE6+/XP SP2, all the latest updates.

HTH
Hmmm... then it looks like the javascript code posted in another thread here doesn't work as advertised!

Where did you see this? Front page, gallery, or...?

rainforest1155
Apr-13-2005, 02:46 AM
Hmmm... then it looks like the javascript code posted in another thread here doesn't work as advertised!

Where did you see this? Front page, gallery, or...?I can confirm this. It happens to occur on the front page. Somehow your code interferes with the friends&family feature. It looks like this:



http://rainforest1155.smugmug.com/photos/19583436-L.gif

Sebastian

devbobo
Apr-13-2005, 03:40 AM
Hmmm... then it looks like the javascript code posted in another thread here doesn't work as advertised!

Where did you see this? Front page, gallery, or..
As the author of the piece of code, there seems to be a small bug in the original posting, that only effects the front page.

I hacked it up pretty quickly, but had to do a fair bit of debugging to get working on both IE and Firefox, but must missed this. I actually found this problem yesterday, but didn't realise that someone was actually using the code.

However, with the modification of my code you removed some important information...the '<' are important and should be left in.

Try this code, it should work for you...

<script for="window" event="onload">
try
{
var sName = "cheerphoto";

var re1 = new RegExp(sName + "'s home<", "g");

document.body.innerHTML = document.body.innerHTML.replace(re1, "CheerPhoto<");

var re2 = new RegExp(sName + "'s[ ]+[^\f\n\r\t\v]+home<", "g");

document.body.innerHTML = document.body.innerHTML.replace(re2, "Competition Galleries<");

var re3 = new RegExp(sName + "'s gallery categories<", "g");

document.body.innerHTML = document.body.innerHTML.replace(re3, "Each gallery represents a competition. Within each gallery are separate sections for each team, to make it easier to find the photos you want.<");

var re4 = new RegExp(sName + "'s[ ]+[^\f\n\r\t\v]+galleries<", "g");

document.body.innerHTML = document.body.innerHTML.replace(re4, "Select a team below to see photos from this competition. All photos are cropped for 8x10 prints unless marked otherwise.<");
}
catch(e)
{
}
</script>

Cheers,

David

cambler
Apr-13-2005, 06:29 AM
Thanks, David, I'll make that change.

Can you 'splain to me the meaning of the "<" in the regex? I confess that while I'm a 20-year veteran developer, regular expressions are something I've never really gotten into :D

devbobo
Apr-13-2005, 01:43 PM
Thanks, David, I'll make that change.

Can you 'splain to me the meaning of the "<" in the regex? I confess that while I'm a 20-year veteran developer, regular expressions are something I've never really gotten into :D It matches the first character of the html closing element as below...

<strong>cheerphoto's gallery categories</strong>

I do this to attempt to prevent what was happening on the front page.

This command [^\f\n\r\t\v]+ matches all characters including space, so with out the '<' on the end, it ended up matching something I didn't intend it to.

Regular expressions are awesomely powerful, but can be dangerous..and produce unexpected results at times, if not used carefully http://dgrin.com/images/smilies/icon10.gif

Cheers,

David