Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts

    How do I parse this code?

    I need to edit the following code between the <tt> tag.

    PHP Code:
    $_GetCode_='Your HTML code to get votes is:<BR><tt>&lt;A HREF="%%URLcode%%" TARGET="_BLANK"&gt;<BR>&lt;IMG SRC="%%URLvote%%" BORDER="0"&gt;&lt;/A&gt;</tt>'
    This is the code I'd like to replace it with -

    <a href="%%URLvote%%" target="MyWindow" onClick="w=650;h=480;posx = (screen.availWidth/2)-(w/2);posy = (screen.availHeight/2)-(h/2);win = window.open(this.href,this. target,'location=0,toolbar=0,resizable=1,scrollbars=1,width='+w+',height='+h+',left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy); win.focus(); return false;"><IMG SRC="%%URLvote%%" BORDER="0"></a>
    Please note after the $_GetCode_= is a ' . This is causing problems with the javascripting that I wish to add. Is there a solution? I have tried replacing them with \ ' but that did'nt seem to work. Unless I did it wrong!

  2. #2
    Senior Coder
    Join Date
    Jun 2002
    frankfurt, german banana republic
    Thanked 0 Times in 0 Posts
    $_GetCode_ = '<a href="%%URLvote%%" target="MyWindow" onClick="w=650;h=480;posx = (screen.availWidth/2)-(w/2);posy = (screen.availHeight/2)-(h/2);win = window.open(this.href,this.  target,\\'location=0,toolbar=0,resizable=1,scrollbars=1,width=\\'+w+\\',height=\\'+h+\\',left=\\'+posx+\\',top=\\'+posy+\\',screenX=\\'+posx+\\',screenY=\\'+posy); win.focus(); return false;"><IMG SRC="%%URLvote%%" BORDER="0"></a>';
    echo $_GetCode_;
    works for me. Watch out, this forum eats backslashes and inserts occasional line breaks/space that shouldn't be there. But you get the idea, I just did an replace of all single quotes to escape them with the backslash. It really does work.

    If it's still not working for you, then there must be another cause for the errors you get.
    Last edited by mordred; 10-04-2002 at 03:19 PM.


Posting Permissions

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