SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Catfish and cookies?

    Love the Catfish advertisement system on sitepoint and would love to implement it myself. Since there hasn't been a Part III written yet, does anyone in the sp community know how to control it's display via cookies? (For instance, show it only once per X days.) Also, I'd love to have multiple catfish ads, but are called dependent on which page the viewer is on at the time (can I simply duplicate the #catfish css and call #catish2 for the next ad?)

    Sorry if that doesn't quite make sense - a little tequila tonight with friends and trying to rewrite some html isn't working as planned.

  2. #2
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bump ^

    Using catfish with cookies? Can anyone direct me on how to set-up a cookie for a one time catfish pop-up?
    Last edited by Del321; Mar 4, 2006 at 18:59.

  3. #3
    SitePoint Enthusiast ganny512's Avatar
    Join Date
    Aug 2005
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone manage to do this?

    I'm building a site with this feature too

  4. #4
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would like to know this too.

    I am trying to manipulate this cookie code into the destroycatfish function can anyone help?

    Code:
    <script>
    
    //Post-it only once per browser session? (0=no, 1=yes)
    //Specifying 0 will cause postit to display every time page is loaded
    var once_per_browser=1
    
    ///No need to edit beyond here///
    
    var ns4=document.layers
    var ie4=document.all
    var ns6=document.getElementById&&!document.all
    
    if (ns4)
    crossobj=document.layers.catfish
    else if (ie4||ns6)
    crossobj=ns6? document.getElementById("catfish") : document.all.catfish
    
    
    function closeit(){
    if (ie4||ns6)
    crossobj.style.visibility="hidden"
    else if (ns4)
    crossobj.visibility="hide"
    }
    
    function get_cookie(Name) {
      var search = Name + "="
      var returnvalue = "";
      if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search)
        if (offset != -1) { // if cookie exists
          offset += search.length
          // set index of beginning of value
          end = document.cookie.indexOf(";", offset);
          // set index of end of cookie value
          if (end == -1)
             end = document.cookie.length;
          returnvalue=unescape(document.cookie.substring(offset, end))
          }
       }
      return returnvalue;
    }
    
    function showornot(){
    if (get_cookie('postdisplay')==''){
    showit()
    document.cookie="postdisplay=yes"
    }
    }
    
    function showit(){
    if (ie4||ns6)
    crossobj.style.visibility="visible"
    else if (ns4)
    crossobj.visibility="show"
    }
    
    if (once_per_browser)
    showornot()
    else
    showit()
    
    </script>

  5. #5
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok guys,

    I dug up this : http://ianpurton.com/how-to-create-j...ing-promotions - this guy has recoded the catfish script and included a show-once cookie feature.

    I have successfully got this to work in firefox but not IE7. As I receive an ie has aborted the operation which I think is related to the DOM being asked to excute before it's ready. I increased the start time to 10000ms instead of 2000ms and firefox is coping well now. However the error message is still present on IE7 even with the timings up at 30000ms, I found this article: http://clientside.cnet.com/code-snip...ation-aborted/ but don't really understand it all 100% is there anything else I can do? Any sort of IE hack which will prepare the DOM before my site loads?

    I spose it all depends on how fast your net connection is or the speed at which your site loads. Mine is pretty graphics heavy so does take 4-5 seconds even on a cable line so I guess this is what is causing the misloading?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •