Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HELP - I can't integrate Java with OSC


videobus

Recommended Posts

I want to use a text popup window when a mouse is passed over an image. I integrated the overLib java library which works fine, but I have only one problem remaining. I'm trying to find a way to pass a php variable to the java code, but I can't figure out how.

 

This test line works fine...

 

<?php

echo ('<A HREF="java script:void(0);" onMouseOver="overlib([b]'This is the text I want to display'[/b], 
HAUTO, VAUTO, WIDTH, 500, FGCOLOR, \'#ffffcc\',BGCOLOR, \'#990000\',BORDER, 2,FOLLOWMOUSE, 
CAPTION,\'Thunderball\')" onMouseOut="nd()">Display Caption </A>');

?>

 

but I can't figure out the actual code to insert the text...

 

<?php

$display_text = 'This is the text I want to display';


echo ('<A HREF="java script:void(0);" onMouseOver="overlib(\'[b]$display_text[/b]\', 
HAUTO, VAUTO, WIDTH, 500, FGCOLOR, \'#ffffcc\',BGCOLOR, \'#990000\',BORDER, 2,
FOLLOWMOUSE, CAPTION,\'Thunderball\')" onMouseOut="nd()">caption </A>');

?>

 

 

This code displays the word $display_text instead of the actual text. How can I make it work?

 

Please help. I'm out of ideas.

Link to comment
Share on other sites

For a start - it's Javascript - not Java. The two are very different, believe me ;-)

 

You print PHP variables using the echo statement. You can read this into your javascript like so:

 

overlib(\'<?php echo $display_text; ?>\',

Link to comment
Share on other sites

Problem #1:

Now that plain HTML is working thanks to jasonabc, I have tried to integrate the overLib function inside php code as below:

 

    
   $description = $products['products_description'];
   $name   = $products['products_name'];

   $info_box_contents[$row] = array('align'  => 'center',
        'params' => 'class="ImageText" width="20%" valign="top"',
        'text'   => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) .  '
"java script:void(0);" onMouseOver="overlib(\'[b]$description[/b]\', HAUTO, VAUTO, WIDTH, 500, FGCOLOR, \'#ffffcc\',BGCOLOR, \'#990000\',BORDER, 2,FOLLOWMOUSE, CAPTION,\'[b]$name[/b]\')" onMouseOut="nd()">
       ' . tep_image(DIR_WS_IMAGES . $products['products_image'], '', HOME_PAGE_IMAGE_WIDTH, HOME_PAGE_IMAGE_HEIGHT, 'hspace="0" vspace="5"')
         . '<br><font color=#cc0033>' . $products['products_name']. '</font><br><br></a>');

 

Unfortunately, I'm back to square 1 because all I get in the pop-up is the text of the two items, $description and $name, not the contents of them.

 

Again, I don't have any clue as to what to do.

 

 

Problem #2:

 

The straight HTML version of overLib has a few strange behavior problems. After much experimenting, I found that if the text contains a cr/lf or it contains an ' it will not display anything. I have to allow any standard ascii character that's in the product description.

Any solutions?

Link to comment
Share on other sites

  • 1 month later...

Hi Videobus.

 

Did you manage to get it to work?

 

If so, how about posting the source codes for the rest of us to use?

 

If you dont want to post them, would you tell us which files you changed, and what you changed in them?

 

thanx in advance

Timo Jensen

Link to comment
Share on other sites

I want to use a text popup window when a mouse is passed over an image. I integrated the overLib java library which works fine, but I have only one problem remaining. I'm trying to find a way to pass a php variable to the java code, but I can't figure out how.

 

This test line works fine...

 

<?php

echo ('<A HREF="java script:void(0);" onMouseOver="overlib([b]'This is the text I want to display'[/b], 
HAUTO, VAUTO, WIDTH, 500, FGCOLOR, \'#ffffcc\',BGCOLOR, \'#990000\',BORDER, 2,FOLLOWMOUSE, 
CAPTION,\'Thunderball\')" onMouseOut="nd()">Display Caption </A>');

?>

 

but I can't figure out the actual code to insert the text...

 

<?php

$display_text = 'This is the text I want to display';
echo ('<A HREF="java script:void(0);" onMouseOver="overlib(\'[b]$display_text[/b]\', 
HAUTO, VAUTO, WIDTH, 500, FGCOLOR, \'#ffffcc\',BGCOLOR, \'#990000\',BORDER, 2,
FOLLOWMOUSE, CAPTION,\'Thunderball\')" onMouseOut="nd()">caption </A>');

?>

This code displays the word $display_text instead of the actual text. How can I make it work?

 

Please help. I'm out of ideas.

 

 

$display_text has these ' symbols around it and pulling the actual phrase $display_text. Why not remove $display_text with the actual text you want displayed? Or remove these ' symbols?

Link to comment
Share on other sites

I tried everything I could find to get the java APPLETS to work, and then work with params. All without the Click to activate.

I finally got it.. I will activate Applets, flash, swf, ect.. with no Click. AND

you can integrate params in your javscript that the java applets-ect will pickup.

I just uploaded the contrib today.. all it took was a few extra lines to get it working..Read thru and you can see how I pass the params.

It worked for me and all the sites I currently develop/maintain.. So let me know if you have any questions and if it works for you.

 

Here is the link.

http://www.oscommerce.com/community/contributions,5110

It's not a beer gut, it's padding for my rock hard abs!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...