Reply
Pop-Up in PHP
Old 06-03-2008, 11:37 AM Pop-Up in PHP
one7media's Avatar
Novice Talker

Posts: 8
Name: Preston
Sorry if this is uber newbie, but that's me:

I'm trying to insert a javascript pop-up. Here's the code I'm having trouble with:

Code:
echo "<td valign=\"center\">";
         echo "<div style='width:100%; height:100%; vertical-align: center;'>";
           echo "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">Recommend this page to your friend</a>" style=display: block;>";

             echo "<span>";
It's throwing this error:

Code:
Parse error:  syntax error, unexpected T_STRING, expecting ',' or ';' in /home/***/***/tomp.one7media/components/com_marketplace/topmenu.php on line 104
Line 104 being the echo "<a href=\

I appreciate any help!
one7media is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 06-03-2008, 11:46 AM Re: Pop-Up in PHP
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
You forgot to escape some quotes, these two:
)">Recommend this page to your friend</a>
My suggestion is when you're echoing HTML to use single quotes. I found it actually requires less coding in the end.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-03-2008, 11:57 AM Re: Pop-Up in PHP
one7media's Avatar
Novice Talker

Posts: 8
Name: Preston
I'm getting there. I removed "Recommend...." because the output is called from the language file.

Here's the problem:

It's not appearing as a link. Here's the block:

Code:
echo "<td valign=\"center\">";
         echo "<div style='width:100%; height:100%; vertical-align: center;'>";

           echo "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">" style=display: block;>";

             echo "<span>";
               echo "<img src=\"".$mosConfig_live_site."/components/com_marketplace/images/system/writead.gif\" border=\"0\" align=\"top\" >";
             echo "</span>";
             echo "&nbsp;&nbsp;&nbsp;";

             echo "<span>";
               echo JOO_TELL_FRIEND;
             echo "</span>";

           echo "</a>";
         echo "</div>";
       echo "</td>";
This is what the result is:



It should be a link to pop-up the tell a friend form and I don't know why the "1" is in front of the image.

I'm a total newb and I'm sure it's something stupid.
one7media is offline
Reply With Quote
View Public Profile
 
Old 06-03-2008, 12:29 PM Re: Pop-Up in PHP
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
First off, you need to fix this:
style=display: block;
Add quotes to it.
I'm no expert on javascript, but http://www.pageresource.com/jscript/jwinopen.htm does that help you at all? Also do you have a URL to test this with?
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-03-2008, 12:54 PM Re: Pop-Up in PHP
one7media's Avatar
Novice Talker

Posts: 8
Name: Preston
I get this error in Firebug:

Code:
unterminated string literal
newWindow('sendemail.php?'+document.location.href,'email',400,300,'') 'style=\di...
one7media is offline
Reply With Quote
View Public Profile
 
Old 06-04-2008, 12:29 AM Re: Pop-Up in PHP
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
Here's a serving of copy pasta for you, just use this code.
PHP Code:
echo '<td valign="center">';
    echo 
'<div style="width:100%; height:100%; vertical-align: center;">';
        echo 
'<a href="javascript:window.open(\'sendemail.php?\'+document.location.href,\'email\',400,300,\'\')"> style="display: block;>"';
            echo 
'<span>';//Why an empty span?
                
echo '<img src="'.$mosConfig_live_site.'/components/com_marketplace/images/system/writead.gif" border="0" align="top" >';
            echo 
'</span>';
            echo 
'&nbsp;&nbsp;&nbsp;';
            echo 
'<span>';//Why TWO empty spans?
                
echo JOO_TELL_FRIEND//Is this correct?
            
echo '</span>';
        echo 
'</a>';
    echo 
'</div>';
echo 
'</td>'
Why do you use the two empty spans, and what is the JOO_TELL_FRIEND thing? Also I'm no expert on javascript but your link would open a new window that if I'm not mistaken would be http://www.example.com/path/to/sendm...th/to/page.php
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-07-2008, 01:10 AM Re: Pop-Up in PHP
Novice Talker

Posts: 10
All you have to do is to scape the " inside the Php code:

Quote:
)">Recommend this page to your friend</a>"
Must be:

Quote:
)\">Recommend this page to your friend</a>\"
apolo13 is offline
Reply With Quote
View Public Profile
 
Old 06-07-2008, 04:32 AM Re: Pop-Up in PHP
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
Offending facebook ads… so?
Posts: 6,092
Name: Dan
Location: Swindon
^ This person has just done my biggest pet hate -.- .. that question has been answerd
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to Pop-Up in PHP
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.19218 seconds with 13 queries