#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Canada
    Posts
    368
    Rep Power
    12

    adding counter javascript info to pl file...absolute perl newbie..


    I simply want to add my counter "file identificaiton script" to my yabb.pl (yet another bulletin board) script.

    How do I escape out of perl to add this:

    <!-- START WEB TRAFFIC ANALYSIS SCRIPT - STATZ -->
    <script language="JavaScript">
    blah blah blah
    </script>
    <!-- END WEB TRAFFIC ANALYSIS SCRIPT - STATZ -->

    I can, right?
    cheers.
    mr_fitz
    __________
    Don't worry, I haven't given up my day job.
  2. #2
  3. An Ominous Coward
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2002
    Posts
    4,425
    Rep Power
    0
    What do you mean "escape out of perl"? You can use the POD syntax to keep perl from parsing the lines as part of the program (perldoc perlpod), or, you can comment it out.
  4. #3
  5. Mobbing Gangster
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Sep 2001
    Location
    "Best City" 2002 and 2003- Melbourne, Australia
    Posts
    4,912
    Rep Power
    32
    You don't 'escape' out of perl as it is not html embedded in the first place (well, it's not in your case). You're probably asking how to print block of data in perl. If so use heredoc:
    print <<html;
    my javascript here
    html
    And you know I mean that.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Canada
    Posts
    368
    Rep Power
    12

    perl fine now, javascript not executing


    Thanks,
    Though the perl file is unaffected, my javascript does not seem to be executing.
    Is this the way it should look? (starting at the top of yabb.pl)(there is not a perl code tag I see...using php...):
    PHP Code:
     #!/usr/bin/perl

    <<html;
            <
    script language="JavaScript">            
                var 
    image "pixel.gif";            
                var 
    web "mywebsite.com";            
                var 
    from escape(document.referrer);    
                var 
    page "yabb.pl";
                var 
    query location.search;
                var 
    colorDepth window.screen.colorDepth;            
                var 
    res window.screen.width "," window.screen.height;            
                var 
    maxres window.screen.availWidth "," window.screen.availHeight;            
                if (
    navigator.javaEnabled() == 1){ var javaa "Enabled";} else {var javaa "Disabled";}            

                
    document.write("<img src='path_to_hit.php?referer=" from "&request=" page "&website=" web "&query=" query "&cDepth=" colorDepth "&resol=" res "&maxresol=" maxres "&java=" javaa "&img=" image "' align='middle' style='display:none'>");     
            
    </script>
    html


    ##################################
    # YaBB.pl                                                                     #
    ##################################


    ### Version Info ###
    $YaBBversion = '1 Gold - SP 1.1';
    $YaBBplver = '1 Gold - SP 1.1';

    if( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
        $yyIIS = 1;
        $0 =~ m~(.*)(\\|/)~;
        $yypath = $1;
        $yypath =~ s~\\~/~g;
        chdir($yypath);
        push(@INC,$yypath);

    This method still allows the javascript to execute, correct?
    Is there a particular place that the javascript has to be placed?

    Problem is that what I know about both these languages (javascript, perl) you could write on a piece of confetti - I know some php and even that is limited.

    Your patience is appreciated.
    Last edited by mr_fitz; December 4th, 2002 at 09:05 AM.
    mr_fitz
    __________
    Don't worry, I haven't given up my day job.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    210
    Rep Power
    13
    what you want to do is find where yabb is printing out the html header stuff, then sneak your javascript in with it...

    print <<END_OF_JAVA;

    // java here , dont forget the print statement above!

    END_OF_JAVA

    If yabb uses templates for its HTML, then its even easier...just find the header template, and paste the code into it like any other HTML doc

    laters
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Canada
    Posts
    368
    Rep Power
    12

    thanks...


    yes, there is a template and I just "slipped" it in between </title>
    and </head>

    works fine for IE Explorer...now off the the javascript forum for spectulation why the traffic script doesn't work at all through NS4.x

    Traffic "program" I am using: http://www.andrewkimball.com/ (statz)

    If you have a thought on this latter point, please share.

    Here is the javascript forum post to keep things connected...
    javascript web traffic script not working NS4.x
    Last edited by mr_fitz; December 5th, 2002 at 05:57 PM.
    mr_fitz
    __________
    Don't worry, I haven't given up my day job.

IMN logo majestic logo threadwatch logo seochat tools logo