ardit Posted June 22, 2003 Posted June 22, 2003 Hi there, I want to place a picture with a link on the right coulmn in Albanian for the Albanian version of my site and the same for the english version. I know how to place a picture but there aren't two files of the two columns - so the same picture is displayed in the two version. I could have a picture with the two laguages on it but if I want to have 3-4 buttons this would take a lot of space and would not be attractive for the visitors. Ardi
Wizzud Posted June 23, 2003 Posted June 23, 2003 Put the relevant image(s) in the appropriate includes/languages/EachLanguage/images/buttons/ folder, then use the tep_image_button() function, supplying just the image name (which should be the same for all languages). This will display the image according to the language currently in use. Regards, Wizzud "It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
ardit Posted June 23, 2003 Author Posted June 23, 2003 Wizzud how would I use the function? Sorry, I've redisgned OsC but have only taken code off, never added anything but a simple image (ref. first post). Could you please give me an example...Do I put the image name inside the () in the tep_image_button() function. Also how would I add a code so that when users click on it a simple popup would be opened. Thank you for your help, Ardi
Wizzud Posted June 24, 2003 Posted June 24, 2003 OK. It sounds like you are ... how do I put this tactfully? ... just starting to gain experience with php, etc? My first advice will always be to "look through any code you have". For example, what I did on reading your request about a pop-up was to find something in osCommerce that provided a pop-up: such as clicking to emlarge a thumbnail of a product. This leads us to product_info.php! Its not necessary to understand in detail what every single statement does, but just to get an idea of the flow so that you lift code out and use it for yourself. So using product_info.php as a guide .. A javascript function will produce the pop-up for you, which goes inside the <head></head> tags for your page ... <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=noresizabl e=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=15 0') } //--></script> Obviously there are all sorts of parameters to play with there, particularly the last 6, but worry about that later when you've got it working. I'll assume that your image will be in a table cell; I'll give it a name of yourimage.gif; in osCommerce, the url used in product_info.php points to popup_image.php - since I don't know what you are going to put in the popup I'm going to use the filename your_popup_image.php as the url... <td> .... <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link("your_popup_image.php") . '')">' . tep_image_button("yourimage.gif","Alt text for your image") . '</a>'; ?>'); .... </td> The function tep_image_button() can be found in includes/functions/html_output.php where you can see that it takes up to 3 arguments - image name, alt text, and any other parameters that you want to supply to the html <img> tag. The only argument you have to supply is the first one, the url, so the call to the function could be just tep_image_button("yourimage.gif"). Regards, Wizzud "It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
ardit Posted July 18, 2003 Author Posted July 18, 2003 Wizz I can't make it to work this is what plugged into my right column after the whole code that there was there: <head> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=noresizabl e=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=15 0') } //--></script> </head> <td> <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link("korabi.com/exit/english.htm") . '')">' . tep_image_button("opinion.jpg","Duam Opinionin Tuaj - Klik!") . '</a>'; ?>'); </script> </td> The catalog folder is in korabi.com/catalog. My popup .htm page is in korabi.com/exit. And I placed the images with the same name in the includes/languages/EachLanguage/images/buttons/ folder. In your code you had "...." I took that off because it was being displayed also the second javascript piece of code didn't have a </script> at the end. There is no error or anything like that just nothing is displayed. YES my knowladge of php, html or any other language is close to zero. I struggle for weeks just to get smth like this worked out, sorry for not pointing out on the first post. Thank you for your time Ardi
Wizzud Posted July 23, 2003 Posted July 23, 2003 For anyone else who reads this solution, Ardit pointed out a missing piece of code in the Javascript, which I will rectify here just in case it causes a problem for anybody else. The code extract <td> .... <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link("your_popup_image.php") . '')">' . tep_image_button("yourimage.gif","Alt text for your image") . '</a>'; ?>'); .... </td> should read <td> .... <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link("your_popup_image.php") . '')">' . tep_image_button("yourimage.gif","Alt text for your image") . '</a>'; ?>'); //--></script> .... </td> Also, please be aware that the four dots notation is to indicate that there may be other code involved about which I am unaware. Regards, Wizzud "It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
Recommended Posts
Archived
This topic is now archived and is closed to further replies.