Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
nicotine
New Member
New Member



Joined: Dec 11, 2005
Posts: 4

PostPosted: Wed Dec 28, 2005 11:39 pm Reply with quote

Hi All,

So if you have ever used Emporuim you know that the link inside the product description opens a whole new window 'target=\"_blank\". Well I am trying to get it to open in a popup window with my window size settings...I am trying to accomplish this using javascript but have yet to succeed so I figured I would try to see if any one had an idea of how to do this. I will paste the function main section of the file product.emporiumbasic.php and what I have modified.
Code:
Crap! no html allowed!!

Quote:
http://pastebin.com/482540

So it opens the popup fine with the dimensions and specifications I have set but it does not use the correct url...this I imagine is because it is now 'outside' the function main and does not know what $cartconfig and $mediainfo is refering to. any help would be appreciated.

-nicotine
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Thu Dec 29, 2005 9:13 am Reply with quote

nicotine, you need to pass the URL into the function call to openpopup. Maybe something like:

echo "<a href=\"j avascript:openpopup('".$URL."')\">

where you have previously set the variable $URL appropriately.

Please note that I added a space in "javascript".

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
nicotine







PostPosted: Thu Dec 29, 2005 11:18 pm Reply with quote

montego, Thanks a bunch man, I ended up doing it differan than what I originaly had posted...same idea differant route.
Code:
$URL = "".$cartconfig->value("mediaFolder")."$mediaInfo[urlLocal]";

                                        echo "<s.cript>\n";
                                        echo "function launch(){\n";
                                        echo "url=\"".$cartconfig->value("mediaFolder")."$mediaInfo[urlLocal]\"\n";
                                        echo "window.open(url,\"Image\",\"width=200,height=200,top=20,left=30,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no\")\n";
                                        echo "}\n";
                                        echo "</s.cript>\n";
                                        echo "<a .href=\"j.avascript:launch('".$URL."')\"><NOBR>$mediaInfo[mediaName]</NOBR></a>";

Thanks again for you pointer Smile
 
montego







PostPosted: Fri Dec 30, 2005 12:20 am Reply with quote

nicotine, well, you hardcoded the url= string within your launch() function, so no need to pass a variable to it in the bottom line. However, this kind of defeats the purpose of using a javascript function. My vote would be to change it as such to make it more generic and be able to use the launch() function elsewhere if needed:

Code:



$URL = "".$cartconfig->value("mediaFolder")."$mediaInfo[urlLocal]";
                                        echo "<s.cript>\n";
                                        echo "function launch(url){\n";
                                        echo "window.open(url,\"Image\",\"width=200,height=200,top=20,left=30,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no\")\n";
                                        echo "}\n";
                                        echo "</s.cript>\n";
                                        echo "<a .href=\"j.avascript:launch('".$URL."')\"><NOBR>$mediaInfo[mediaName]</NOBR></a>";


Now use this function over and over and just pass it a different URL when you need to do a pop-up window. You could even make some of the window sizing parameters variable driven as well.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©