popup windows from within a php script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joker7

    #1

    popup windows from within a php script


    Hi,

    This is still giving me a big problem !!


    Maybe if I post the original code here it may be of more help as the above
    will/is not working.


    $link = "<a
    href=\"newsgrou ps.php?renew=0& mid=".$message_ info->tp_message_id. "&sign=".$s
    ign."\">";


    I wish for the above link to open in a pop-up window,as you may know this
    has
    been giving me a problem :((

    Regards
    Chris







  • chotiwallah@web.de

    #2
    Re: popup windows from within a php script


    Joker7 wrote:[color=blue]
    > Hi,
    >
    > This is still giving me a big problem !!
    >
    >
    > Maybe if I post the original code here it may be of more help as the[/color]
    above[color=blue]
    > will/is not working.
    >
    >
    > $link = "<a
    >[/color]
    href=\"newsgrou ps.php?renew=0& mid=".$message_ info->tp_message_id. "&sign=".$s[color=blue]
    > ign."\">";
    >
    >
    > I wish for the above link to open in a pop-up window,as you may know[/color]
    this[color=blue]
    > has
    > been giving me a problem :((
    >
    > Regards
    > Chris[/color]

    php runs server side and can therefore not open any browser windows,
    cause this must be done client side.

    you can, however, have php transmit a javascript to the browser and
    have that open the pop up.

    code somthing like this:

    <?php

    print '<script type="text/javascript">';
    print 'window.open("L INK","NAME","AT TRIBS")\;';
    print '</script>';

    ?>

    micha

    Comment

    • Joker7

      #3
      Re: popup windows from within a php script


      <chotiwallah@we b.de> wrote in message
      news:1106817255 .704181.44200@z 14g2000cwz.goog legroups.com...
      : php runs server side and can therefore not open any browser windows,
      : cause this must be done client side.
      :
      : you can, however, have php transmit a javascript to the browser and
      : have that open the pop up.
      :
      : code somthing like this:
      :
      : <?php
      :
      : print '<script type="text/javascript">';
      : print 'window.open("L INK","NAME","AT TRIBS")\;';
      : print '</script>';
      :
      : ?>
      :
      : micha
      :
      I can't see how that would work with

      $link =
      "<ahref=\"newsg roups.php?renew =0&mid=".$messa ge_info->tp_message_id. "&sign="
      ..$sign."\">";


      I wish for the above link to open in a pop-up window your code would write
      html for a pop-up but,for the life of me I can't see how it helps with my
      problem.


      Thanks
      Chris


      Comment

      • micha

        #4
        Re: popup windows from within a php script


        Joker7 wrote:[color=blue]
        > <chotiwallah@we b.de> wrote in message
        > news:1106817255 .704181.44200@z 14g2000cwz.goog legroups.com...
        > : php runs server side and can therefore not open any browser[/color]
        windows,[color=blue]
        > : cause this must be done client side.
        > :
        > : you can, however, have php transmit a javascript to the browser and
        > : have that open the pop up.
        > :
        > : code somthing like this:
        > :
        > : <?php
        > :
        > : print '<script type="text/javascript">';
        > : print 'window.open("L INK","NAME","AT TRIBS")\;';
        > : print '</script>';
        > :
        > : ?>
        > :
        > : micha
        > :
        > I can't see how that would work with
        >
        > $link =
        >[/color]
        "<ahref=\"newsg roups.php?renew =0&mid=".$messa ge_info->tp_message_id. "&sign="[color=blue]
        > .$sign."\">";
        >
        >
        > I wish for the above link to open in a pop-up window your code would[/color]
        write[color=blue]
        > html for a pop-up but,for the life of me I can't see how it helps[/color]
        with my[color=blue]
        > problem.
        >
        >
        > Thanks
        > Chris[/color]
        well, i didn't understand your problem then. care to elaborate?

        micha

        Comment

        • Joker7

          #5
          Re: popup windows from within a php script


          "micha" <chotiwallah@we b.de> wrote in message
          news:1107030531 .312221.188460@ z14g2000cwz.goo glegroups.com.. .
          :
          : > :
          : > : <?php
          : > :
          : > : print '<script type="text/javascript">';
          : > : print
          'window.open("L INK","NAME","AT TRIBS")\;';
          : > : print '</script>';
          : > :
          : > : ?>
          : > :
          :: > $link =
          : >
          :
          "<ahref=\"newsg roups.php?renew =0&mid=".$messa ge_in
          fo->tp_message_id. "&sign="
          : > .$sign."\">";
          : >
          : >
          : > I wish for the above link to open in a pop-up
          window your code would
          : write
          : > html for a pop-up but,for the life of me I
          can't see how it helps
          : with my
          : > problem.
          : >
          : >
          : > Thanks
          : > Chris
          : well, i didn't understand your problem then.
          care to elaborate?
          :
          : micha
          :
          Hi Micha,

          You are right I'm not explaining my self properly
          :(

          Using this PHP code that come from a much larger
          script :
          $link =
          "<ahref=\"news. php?renew=0&mid =".$message_inf o->tp
          _message_id."&s ign=".$sign."\" >";

          instead of calling a new page as it is now I wish
          to open a frameless window.I will show you what I
          have been playing with but just can't get it to
          work, it may give you an idea.


          $link =
          "<ahref='news.p hp?renew=0&mid= $message_info->tp_me
          ssage_id&sign=$ sign onClick=\"javas cript:
          window.open('ht tp://news.php?renew= 0&mid=$messag e_
          info->tp_message_id& sign=$
          sign','newwindo w', 'width=250, height=285,
          top=200, left=300, screenX=200, screenY=300,
          scrollbars=no, resizable=no'); return false;\"
          target=_self>";

          Thanks
          Chris


          Comment

          • Richard Cornford

            #6
            Re: popup windows from within a php script

            Joker7 wrote:
            <snip>[color=blue]
            > You are right I'm not explaining my self properly
            > :([/color]

            No you are not. Posting PHP code to a javascript group will not
            encourage people to help you. Javascript (client-side javascript anyway)
            is executed on the client and it's source code it the _output_ of your
            PHP script. Attempting to debug javascript by looking at the PHP that
            generates it is too indirect to be a worthwhile activity. Generally,
            debugging dynamically generated javascript source code starts with
            looking at the source code that arrives at the browser, to confirm that
            the PHP is generating the code expected (complete, well formed and
            valid//syntactically correct) and to determine what the client-side code
            is actually being asked to do.

            Indeed talking about opening a pop-up from a PHP script suggests a
            fundamental misconception about the relationship between client-side and
            server-side scripting.
            [color=blue]
            > Using this PHP code that come from a much larger
            > script :
            > $link =
            > "<ahref=\"news. php?renew=0&mid =".$message_inf o->tp[/color]
            ^
            A space character would be expected in that location.
            [color=blue]
            > _message_id."&s ign=".$sign."\" >";
            >
            > instead of calling a new page as it is now I wish
            > to open a frameless window.[/color]

            How are you defining a "frameless window"?
            [color=blue]
            > I will show you what I
            > have been playing with but just can't get it to
            > work, it may give you an idea.
            >
            > $link =
            > "<ahref='news.p hp?renew=0&mid= $message_info->tp_me[/color]
            ^
            A space character would be expected in that location.
            [color=blue]
            > ssage_id&sign=$ sign onClick=\"javas cript:[/color]
            ^
            An apparent opening single quote character before the URL is not matched
            by a corresponding closing quote.
            [color=blue]
            > window.open('ht tp://news.php?renew= 0&mid=$messag e_[/color]

            Writing the same URL as is being written into the HREF into the first
            argument to the - window.open - call is wasteful as the onclick handler
            can refer to whatever URL is specified in the link's HREF with -
            this.href - (the same is true of - this.target - in the second argument
            for the TARGET attribute, but they do not correspond in this instance).
            [color=blue]
            > info->tp_message_id& sign=$
            > sign','newwindo w', 'width=250, height=285,
            > top=200, left=300, screenX=200, screenY=300,[/color]
            ^ ^ ^
            The features list that is the optional third argument to - window.open -
            is specified as a comma separated list, not a comma-space separated
            list.
            [color=blue]
            > scrollbars=no, resizable=no'); return false;\"
            > target=_self>";[/color]

            There should be no expectation of this code 'working', and looking at
            the output form the PHP should have highlighted at least some of the
            reasons for that.

            Richard.


            Comment

            • Joker7

              #7
              Re: popup windows from within a php script


              "Richard Cornford" <Richard@litote s.demon.co.uk>
              wrote in message
              news:ctj93q$lqi $1$8302bc10@new s.demon.co.uk.. .
              <Big Snip>

              Every one seem to know I'm doing it wrong but
              unable to say how to make it work ,but never
              mind - I suspect I will stumble on the answer in
              my ignorance's .

              Chris


              Comment

              • micha

                #8
                Re: popup windows from within a php script

                i think i still don't understand your problem, but i'll try anyway.

                you have a php script that turns out

                $link =
                "<ahref=\"news. php?renew=0&mid =".$message_inf o->tp
                _message_id."&s ign=".$sign."\" >";

                this means you have a variable $link that contains a string which is
                basically a link in html.

                so far so good.

                so what do you want to do with that link?? about the only possible
                action that comes to my mind is printing it to the browser window, so
                your visitors can click it.

                in case you want to automatically open the url contained in that link,
                you're all wrong.

                use only the filename and a location header (works only if no other
                output has been sent so far) or aforesaid javascript solution.

                micha

                Comment

                Working...