Creating link that opens in a re-sized window

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Creating link that opens in a re-sized window

Post by nigma »

I have a page that I am working on, its a form, but it doesn't take up the whole page. So it looks real corny when it takes up 1/4 of a page and the rest is just background. Is there an easy way in php/html/javascript to make a link open in a window that resizes based on content?
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

Hi nigma,

Unfortunately there's no easy way to resize a window based on text and form elements. You'll have to guess the window size and use the JavaScript window.open () function accordingly.

Can I suggest to design nice images that'll go around your form and "dress up" the rest of the page?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

What about an easy way to assign the window size(using php)?

I dont have a prob doing it in javascript but since I am trying to learn php thought it would be more productive if I used that.
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

Hi again,

AFAIK PHP doesn't have any way to correctly guess the width and height that text and form components will take.

Also PHP doesn't affect window size in any way because all PHP parsing is done before the users even receives the page on his/her browser.

The only way that PHP could remotely assign a wdith and height is that if you create a pop-up to show an image, PHP can get the correct w/h using getimagesize() and then could "pass" those values to JavaScript in a way similar to this:

Code: Select all

print "
<SCRIPT>
window.open = ("file", "name", "height=$height,width=$width");
</SCRIPT>
";
PHP isn't actually passing anything to JavaScript it's just writing the JavaScript code and adding the appropriate value at the appropriate place.

EDIT: Corrected the function name get_image_size() to getimagesize()
Last edited by puckeye on Mon Jan 27, 2003 5:28 pm, edited 1 time in total.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Thank for the help.
Post Reply