awilson3rd Posted April 21, 2005 Posted April 21, 2005 I would like to be able to add a html link just beneath the drop down box in the currency box to link to an external currency converter popup. I just want the link to say 'currency convert' the box code at the moment is as follows, can anyone tell me how to add the link (I dont know what the html will be yet) Thanks in advance for any advise. <?php /* $Id: currencies.php,v 1.16 2003/02/12 20:27:31 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ if (isset($currencies) && is_object($currencies)) { ?> <!-- currencies //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES); new infoBoxHeading($info_box_contents, false, false); reset($currencies->currencies); $currencies_array = array(); while (list($key, $value) = each($currencies->currencies)) { $currencies_array[] = array('id' => $key, 'text' => $value['title']); } $hidden_get_variables = ''; reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $hidden_get_variables .= tep_draw_hidden_field($key, $value); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()); new infoBox($info_box_contents); ?> </td> </tr> <!-- currencies_eof //--> <?php } ?>
wheeloftime Posted April 22, 2005 Posted April 22, 2005 I would like to be able to add a html link just beneath the drop down box in the currency box to link to an external currency converter popup. I just want the link to say 'currency convert' the box code at the moment is as follows, can anyone tell me how to add the link (I dont know what the html will be yet) Thanks in advance for any advise. <?php /* $Id: currencies.php,v 1.16 2003/02/12 20:27:31 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ if (isset($currencies) && is_object($currencies)) { ?> <!-- currencies //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES); new infoBoxHeading($info_box_contents, false, false); reset($currencies->currencies); $currencies_array = array(); while (list($key, $value) = each($currencies->currencies)) { $currencies_array[] = array('id' => $key, 'text' => $value['title']); } $hidden_get_variables = ''; reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $hidden_get_variables .= tep_draw_hidden_field($key, $value); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()); new infoBox($info_box_contents); ?> </td> </tr> <!-- currencies_eof //--> <?php } ?> <{POST_SNAPBACK}> You can change text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()); to something like text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()) . '<br><br><a href="' . tep_href_link('your new file.htm') . '">' . 'Currency Converter' . '</a><br>'; If you need it multilanguage you will have to create a define for the 'Currency Converter' textual part. HTH
awilson3rd Posted April 22, 2005 Author Posted April 22, 2005 Thanks for the reply. I have changed the code and the page loaded with no errors but now I don't see any drop-down list or 'currency converter' link. All I see in the currencies box are the letters AA Any ideas? (code as it is now) <?php /* $Id: currencies.php,v 1.16 2003/02/12 20:27:31 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ if (isset($currencies) && is_object($currencies)) { ?> <!-- currencies //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES); new infoBoxHeading($info_box_contents, false, false); reset($currencies->currencies); $currencies_array = array(); while (list($key, $value) = each($currencies->currencies)) { $currencies_array[] = array('id' => $key, 'text' => $value['title']); } $hidden_get_variables = ''; reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $hidden_get_variables .= tep_draw_hidden_field($key, $value); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()) . '<br><br><a href="' . tep_href_link('your new file.htm') . '">' . 'Currency Converter' . '</a><br>'; new infoBox($info_box_contents); ?> </td> </tr> <!-- currencies_eof //--> <?php } ?>
wheeloftime Posted April 22, 2005 Posted April 22, 2005 Thanks for the reply. I have changed the code and the page loaded with no errors but now I don't see any drop-down list or 'currency converter' link. All I see in the currencies box are the letters AA Any ideas? (code as it is now) <?php /* $Id: currencies.php,v 1.16 2003/02/12 20:27:31 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ if (isset($currencies) && is_object($currencies)) { ?> <!-- currencies //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES); new infoBoxHeading($info_box_contents, false, false); reset($currencies->currencies); $currencies_array = array(); while (list($key, $value) = each($currencies->currencies)) { $currencies_array[] = array('id' => $key, 'text' => $value['title']); } $hidden_get_variables = ''; reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $hidden_get_variables .= tep_draw_hidden_field($key, $value); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()) . '<br><br><a href="' . tep_href_link('your new file.htm') . '">' . 'Currency Converter' . '</a><br>'; new infoBox($info_box_contents); ?> </td> </tr> <!-- currencies_eof //--> <?php } ?> <{POST_SNAPBACK}> I think so yes. I see I copied the last part after the closing ')'. It should be like this: 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id() . '<br><br><a href="' . tep_href_link('your new file.htm') . '">' . 'Currency Converter' . '</a><br>');
awilson3rd Posted April 22, 2005 Author Posted April 22, 2005 I think so yes. I see I copied the last part after the closing ')'.It should be like this: 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id() . '<br><br><a href="' . tep_href_link('your new file.htm') . '">' . 'Currency Converter' . '</a><br>'); <{POST_SNAPBACK}> That worked! Thanks very much for your help Andrew
wheeloftime Posted April 22, 2005 Posted April 22, 2005 That worked! Thanks very much for your help Andrew <{POST_SNAPBACK}> No problem.
awilson3rd Posted April 22, 2005 Author Posted April 22, 2005 That worked! Thanks very much for your help Andrew <{POST_SNAPBACK}> The code worked but whenI added an external html link it didnt. For example if I add http://www.xe.com/ucc/ it tries to load that page within my own website, http://www.mysite.com/catalog/http://www.xe.com/ucc/ My knowledge of php and html is limited and I don't know how to get around this. Thanks Andrew
awilson3rd Posted April 22, 2005 Author Posted April 22, 2005 The code worked but whenI added an external html link it didnt. For example if I add http://www.xe.com/ucc/ it tries to load that page within my own website, http://www.mysite.com/catalog/http://www.xe.com/ucc/ My knowledge of php and html is limited and I don't know how to get around this. Thanks Andrew <{POST_SNAPBACK}> Sorted it, thanks for your help. Removed the tep_href_link and just added a href="http://www.xe.com/ucc/">Currency Converter</a> Thanks Andrew
wheeloftime Posted April 22, 2005 Posted April 22, 2005 The code worked but whenI added an external html link it didnt. For example if I add http://www.xe.com/ucc/ it tries to load that page within my own website, http://www.mysite.com/catalog/http://www.xe.com/ucc/ My knowledge of php and html is limited and I don't know how to get around this. Thanks Andrew <{POST_SNAPBACK}> I had to take a look in tep_href_link and if I see correct it always adds the path to the catalog directory while looking for the called file there. So it's not really suitable for this kind of external links I guess and it's better to make it a normal HTML call (you don't session id's anyway in this external page). I'll add a "TARGET=_blank" tag so it will open in a new window. 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id() . '<br><br><a href="http://www.xe.com/ucc/" TARGET=_blank>Currency Converter</a><br>'); I hope I didn't miss anything in this.
wheeloftime Posted April 22, 2005 Posted April 22, 2005 Sorted it, thanks for your help. Removed the tep_href_link and just added a href="http://www.xe.com/ucc/">Currency Converter</a> Thanks Andrew <{POST_SNAPBACK}> cross posting :D Glad to see you solved it yourself already !
awilson3rd Posted April 22, 2005 Author Posted April 22, 2005 cross posting :D Glad to see you solved it yourself already ! <{POST_SNAPBACK}> I am learning :D Many mistakes along the way but I am gradually getting there. Thanks again Andrew
Recommended Posts
Archived
This topic is now archived and is closed to further replies.