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
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Mar 22, 2004 9:55 pm
can't seem to get this to work :S
Code: Select all
<?php ?>
<a href="javascript:window.open("picture.php?<? echo "type=$type&picture=$picture&title=$title"; ?>", "Picture Viewer","toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no");> <img src=" <? echo "portfolio/$type/$picture"; ?>" width="450" height="410" border="1"></a>
<? ?>
Is it a missing quote? what what what
lol ty.. sorry for this nub question just its making me so mad
Last edited by
John Cartwright on Mon Mar 22, 2004 9:59 pm, edited 3 times in total.
bawla
Forum Contributor
Posts: 116 Joined: Fri Mar 19, 2004 9:15 am
Post
by bawla » Mon Mar 22, 2004 9:58 pm
for one thing you don't have a semicolin[;] at the end of your lines
Last edited by
bawla on Mon Mar 22, 2004 10:00 pm, edited 2 times in total.
andre_c
Forum Contributor
Posts: 412 Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah
Post
by andre_c » Mon Mar 22, 2004 9:58 pm
you have to add a semicolon
Code: Select all
<? echo "type=$type&picture=$picture&title=$title"; ?> //here
<? echo "portfolio/$type/$picture"; ?> // and here
Edited: Damn, I'm not quick enough
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Mar 22, 2004 10:00 pm
When I run the code and I check the link of the image it is only returning this:
javascript:window.open(
andre_c
Forum Contributor
Posts: 412 Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah
Post
by andre_c » Mon Mar 22, 2004 10:01 pm
Does it work now???
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Mar 22, 2004 10:02 pm
no......... jus said it only returns
javascript:window.open(
bawla
Forum Contributor
Posts: 116 Joined: Fri Mar 19, 2004 9:15 am
Post
by bawla » Mon Mar 22, 2004 10:03 pm
from wut i know of javascript
Code: Select all
<a href="javascript:window.open("picture.php?<? echo "type=$type&picture=$picture&title=$title"; ?>", "Picture Viewer","toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no");> has to be one line, please correct me if im wrong
andre_c
Forum Contributor
Posts: 412 Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah
Post
by andre_c » Mon Mar 22, 2004 10:04 pm
instead of doing
try doing
.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Mar 22, 2004 10:05 pm
bawla wrote: from wut i know of javascript
Code: Select all
<a href="javascript:window.open("picture.php?<? echo "type=$type&picture=$picture&title=$title"; ?>", "Picture Viewer","toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no");> has to be one line, please correct me if im wrong
It is 1 line... this textbox is just not large enough...
Andre: That isn't working either :S
andre_c
Forum Contributor
Posts: 412 Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah
Post
by andre_c » Mon Mar 22, 2004 10:10 pm
Are you getting a php error, or a javascript error?
bawla
Forum Contributor
Posts: 116 Joined: Fri Mar 19, 2004 9:15 am
Post
by bawla » Mon Mar 22, 2004 10:11 pm
i should have thought before i posted
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Mar 22, 2004 10:11 pm
andre_c wrote: Are you getting a php error, or a javascript error?
java..when the link is clicked
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Mon Mar 22, 2004 10:12 pm
How about seperating each 'section' of that line into it's own variable and then echo the variables?
eg.
Code: Select all
<?php
$var1 = "<a href="";
$var2 = $varable_from_someplace;
$var3 = "" target="_top">clickme!</a>";
$display = $var1 . $var2 . $var3;
echo $display;
?>
It makes things a bit more simple, not to mention organized.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Mar 22, 2004 10:15 pm
I don't think that would work.... from my experience I have never been able to input/output javascrjpt inside php.. I also had to escape it.. I wish it were as simple as setting the target to a new window :S
andre_c
Forum Contributor
Posts: 412 Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah
Post
by andre_c » Mon Mar 22, 2004 10:18 pm
what does the error say? I would recommend trying one of these browser if you have one: Netscape, firefox, opera, or any that has a javascript console. That way you can get much more details on the errors.
... and sami is right, you can write javascript from php. I do it all the time. (you can't write php using javascript though, just making sure you know
)
Last edited by
andre_c on Mon Mar 22, 2004 10:21 pm, edited 1 time in total.