Help with debug

Discussion in 'PHP' started by WordpressSEO, Aug 9, 2011.

  1. #1
    part of a larger function, echo.

    function doOpen(url)
    {
    var popURL = "about:blank"
    var popID = "'ad_'" + Math.floor(89999999*Math.random()+10000000);
    var pxLeft = 0;
    var pxTop = 0;
    pxLeft = (GetWindowLeft() + (GetWindowWidth() / 2) - (PopWidth / 2));
    pxTop = (GetWindowTop() + (GetWindowHeight() / 2) - (PopHeight / 2));
    
    if ( puShown == true )
    {
    return true;
    }
    Code (markup):

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /filepath.php on line 61
     
    WordpressSEO, Aug 9, 2011 IP
  2. echipvina

    echipvina Active Member

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    
    function doOpen(url){var popURL = "about:blank";var popID = "'ad_'" + Math.floor(89999999*Math.random()+10000000);var pxLeft = 0;var pxTop = 0;pxLeft = (GetWindowLeft() + (GetWindowWidth() / 2) - (PopWidth / 2));pxTop = (GetWindowTop() + (GetWindowHeight() / 2) - (PopHeight / 2));if ( puShown == true ){return true;
    
    PHP:
     
    echipvina, Aug 9, 2011 IP
  3. Thorlax402

    Thorlax402 Member

    Messages:
    194
    Likes Received:
    2
    Best Answers:
    5
    Trophy Points:
    40
    #3
    If you didn't catch it, echipvina was trying to point out that you forgot a semicolon after:

    var popURL = "about:blank"
    Code (markup):
     
    Thorlax402, Aug 9, 2011 IP
  4. WordpressSEO

    WordpressSEO Peon

    Messages:
    74
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If your saying that it should read like this
    
    function doOpen(url)
    {
    var popURL = "about:blank";
    var popID = "'ad_'" + Math.floor(89999999*Math.random()+10000000);
    var pxLeft = 0;
    var pxTop = 0;
    pxLeft = (GetWindowLeft() + (GetWindowWidth() / 2) - (PopWidth / 2));
    pxTop = (GetWindowTop() + (GetWindowHeight() / 2) - (PopHeight / 2));
    
    if ( puShown == true )
    {
    return true;
    }
    
    Code (markup):
    i had tried that already. brings up same error. same line.
     
    WordpressSEO, Aug 9, 2011 IP
  5. Amator

    Amator Well-Known Member

    Messages:
    1,424
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #5
    The code you write is javascript. if you put that between <?php and ?> it will not work.
    You will need to put the javascript between the tags <script language="javascript"> and </script>
    and if you want to add javascript between <?php and ?> you will need to echo it.
     
    Last edited: Aug 9, 2011
    Amator, Aug 9, 2011 IP
  6. WordpressSEO

    WordpressSEO Peon

    Messages:
    74
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes, possible.

    I tried changing <script> to <script type=\"text/javascript\"> (it is already within a <script> </script> inside the larger php file that encompasses it but also tried changing script to the line above is what I am trying to say)

    It is part of a *.php file that I am wanting to upload to wordpress which is why its included also in larger <?php
     
    WordpressSEO, Aug 9, 2011 IP
  7. WordpressSEO

    WordpressSEO Peon

    Messages:
    74
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ANd its echoed before a previous function.
    
    function StartsLikeThis(){
        
        echo "
        <script type=\"text/javascript\">
    
    Code (markup):
     
    WordpressSEO, Aug 9, 2011 IP
  8. Amator

    Amator Well-Known Member

    Messages:
    1,424
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #8
    It is unpossible to check for us if we not have the code.
     
    Amator, Aug 9, 2011 IP
  9. ausrixy

    ausrixy Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #9
    change this
    var popURL = "about:blank"
    to this
    var popURL = "about:blank";
     
    ausrixy, Aug 10, 2011 IP
  10. Thorlax402

    Thorlax402 Member

    Messages:
    194
    Likes Received:
    2
    Best Answers:
    5
    Trophy Points:
    40
    #10
    Please read the comments before posting. I've just read three of your comments in the last minute that were all deemed useless because your responses were wrong or repeats.
     
    Thorlax402, Aug 10, 2011 IP