Hello
I am pretty new to php and web development. Have many years programming in other langs.
here is my question. How can I get the following to work correctly.
<?php
$str_MyNewPic='/home/mudgeste/public_html/photo_Gallery/public/images/'.$photo->division.'/'.$photo->month.'_'.$photo->year.'/'$photo->filename.'/';
?>
<a onclick="window.open(<?php echo $str_MyNewPic; ?>, 'mywindow', 'width=800', 'height=200')" href="#">
<img src="<?php echo 'http://www.mudgesteve.com/photo_Gallery ... ->filename; ?>" />
<?php echo $str_MyNewPic; ?>
</a>
I am trying to open a very large picture in its own window.
currently '$str_MyNewPic' holds the path to the picture.
I thought the onclick="window.open(what page to view, name for the new window, width of it, height of it)" href="#"
Please help
Beginner question about onclick=window.open
Moderator: General Moderators
-
mudge.steve
- Forum Newbie
- Posts: 10
- Joined: Thu Apr 22, 2010 3:28 pm
Re: Beginner question about onclick=window.open
What you have now is
What you need is
See the differences? There are two.
Code: Select all
<a onclick="window.open($str_MyNewPic, 'mywindow', 'width=800', 'height=200')" href="#">Code: Select all
<a onclick="window.open('$str_MyNewPic', 'mywindow', 'width=800,height=200')" href="#">-
mudge.steve
- Forum Newbie
- Posts: 10
- Joined: Thu Apr 22, 2010 3:28 pm
Re: Beginner question about onclick=window.open
'$str_MyNewPic' and 'width=xxx,height=xxx'
I think are the differances..
Thanks fo ryour help i will try it straight away!
I think are the differances..
Thanks fo ryour help i will try it straight away!
-
mudge.steve
- Forum Newbie
- Posts: 10
- Joined: Thu Apr 22, 2010 3:28 pm
Re: Beginner question about onclick=window.open
Hello, Now I get a parse error for the following line:
<?php
$str_MyNewPic='/home/mudgeste/public_html/photo_Gallery/public/images/'.$photo->division.'/'.$photo->month.'_'.$photo->year.'/'$photo->filename.'/';
?>
<?php
$str_MyNewPic='/home/mudgeste/public_html/photo_Gallery/public/images/'.$photo->division.'/'.$photo->month.'_'.$photo->year.'/'$photo->filename.'/';
?>
-
mudge.steve
- Forum Newbie
- Posts: 10
- Joined: Thu Apr 22, 2010 3:28 pm
Re: Beginner question about onclick=window.open
Hello
I saw the '.' missing, Replaced same and get this error from server
Not Found
The requested URL /photo_Gallery/public/admin/$str_MyNewPic was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
any ideas?
this var was set as a path to my picture. Should it be a http:// syntax?
I saw the '.' missing, Replaced same and get this error from server
Not Found
The requested URL /photo_Gallery/public/admin/$str_MyNewPic was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
any ideas?
this var was set as a path to my picture. Should it be a http:// syntax?
-
mudge.steve
- Forum Newbie
- Posts: 10
- Joined: Thu Apr 22, 2010 3:28 pm
Re: Beginner question about onclick=window.open
Something like this maybe:
$str_MyNewPic = 'http://www.mudgesteve.com/photo_Gallery ... ->filename.';'

$str_MyNewPic = 'http://www.mudgesteve.com/photo_Gallery ... ->filename.';'
Re: Beginner question about onclick=window.open
I was afraid that would happen...
You weren't supposed to copy and paste the code I gave you. The $str_MyNewPic was a placeholder for the whole <?php echo... ?> you had. You still need that.
You weren't supposed to copy and paste the code I gave you. The $str_MyNewPic was a placeholder for the whole <?php echo... ?> you had. You still need that.