At 08:00 AM 3/11/2002 +0100, Wolfgang Schneider wrote:
>Actually, I was thinking of some "normal server side pages"  ... :-)
>I've seen things people did with asp pages where I thought they sized
>pop windows or resized already open windows via the server side
>language, now I may simply be mistaken and be "dreaming" when in
>reality these effects were achieved by embedded javascript code ?

As far as I know, all client-side manipulations must be done via a script, 
whose support is entirely dependent on the user's browser.  JavaScript is 
of course the most prevalent.

>Now, my newbie question came about as I was wondering how I could at
>least fix it so that these links open the new "_study" window with
>the same size and look as the one which is opened via the javascript
>function ? then I thoght of my experience with those pages from
>another website and wondered if they did such things with asp ... and
>if it could be done with php as well ...

It's always a good idea to link some link to a target window even if you're 
using a javascript popup script.  That way, if the user isn't using 
javascript the window will pop open.  The way to do this and not have TWO 
windows pop up is something like the following:
<script language="JavaScript"><!--//
   var winPage;
   function popPage(id) {
     winPage = window.open('thepage.php?id='+id, 'winPage', '...params...');
     winPage.window.focus();
   }
//--></script>
...
<a href="thepage.php?id=<?php echo $id; ?>" target="_blank" 
onClick="popPage(<?php echo $id; ?>);return false;">link</a>

You see the return false; after the call to pop open the new window.  That 
way it gives a priority to using javascript to pop open the new window.  If 
the user has javascript turned on and it pops open the new window, then by 
returning false it ignores the href=".." part of the link.  If the user 
doesn't have javascript then the link will open manually via the href and 
target parts into another window.  If you didn't have the return false 
after the javascript, then the window would open twice: once by the 
javascript, once by the normal href= property.

That's how I do all my javascript window poppers, just to be safe.

So, returning to your question, I don't think it's possible at all to 
control where a new window opens, how big it is, and what properties 
are/aren't displayed via a normal <a href=..> link.  Only in JavaScript.

However, what you CAN do is dynamically generate these kinds of properties 
when the page is generated for each link, if, say, you wanted each popup to 
have a different size/etc for each individual link.  Something like this:

<script language="JavaScript"><!--//
   var winPage;
   function popPage(id, width, height) {
     winPage = window.open('thepage.php?id='+id, 'winPage', 
'width='+width',height='+height+',...');
     winPage.window.focus();
   }
//--></script>
<?php
   $query  = 'SELECT id, width, height, ... FROM MyTable';
   $result = mysql_query($query);
   while ($row = mysql_fetch_row($result)) {
     list($id, $width, $height) = $row;
     print "<a href=\"thepage.php?id=$id\" target=\"_blank\" 
onClick=\"popPage($id, $width, $height);return false;\">link</a>\n";
   }
?>

>Sorry for the confusion ... my concern also is how to still be able
>to somewhat "server side influence" the size and look of a window
>when people have turned their "javascript" off in the browser ... any
>ideas?

Earth bless you as well. :)

-Mike


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to