Options

Category Comments

camblercambler Registered Users Posts: 277 Major grins
edited April 13, 2005 in SmugMug Support
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?

Comments

  • Options
    winnjewettwinnjewett Registered Users Posts: 329 Major grins
    edited April 12, 2005
    cambler wrote:
    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
  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited April 13, 2005
    Is it a bug?
    cambler wrote:
    (see 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
    "May the f/stop be with you!"
  • Options
    camblercambler Registered Users Posts: 277 Major grins
    edited April 13, 2005
    Nikolai wrote:
    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...?
  • Options
    rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited April 13, 2005
    cambler wrote:
    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:



    19583436-L.gif

    Sebastian
    Sebastian
    SmugMug Support Hero
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 13, 2005
    cambler wrote:
    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
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    camblercambler Registered Users Posts: 277 Major grins
    edited April 13, 2005
    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
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 13, 2005
    cambler wrote:
    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 icon10.gif

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.