Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

can anybody help with this code...


Guest

Recommended Posts

<img src="<?php echo tep_image_submit('head.gif'); ?>" border=0 usemap="#abc">

 

point out the mistakes please...

it's wrong i know... it cant work

thanks so much

Link to comment
Share on other sites

what are you trying ot do? just display a picutre on a page or?

 

if you want to display a picture, just use:

 

<img src="images/head.gif" border="0">

 

where head.gif is in your /images dir.

It's easier to remember, then to forget

Link to comment
Share on other sites

thanks for your reply, but i want to use "map" on the image

also i want the image occur according to its language

so i tried to use "tep_image_submit"...

unfortunately i don't know how to work out the codes correctly

Link to comment
Share on other sites

Have a look at /includes/functions/html_output.php.

Search down for the tep_image and tep_image_submit functions. You will find that they output all the necessary html for you, ie. from the <img tag or <input tag onwards, respectively. so you shouldn't have you own <img tag.

Regards, Wizzud

"It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."

Link to comment
Share on other sites

Hi jace.

 

I would suggest you made an alternative construction like this:

 

If languages_id = xx {

 <img src="images/head_xx.gif')" border=0 usemap="#abc"> 

} else {

 <img src="images/head_yy.gif')" border=0 usemap="#abc"> 

}

If your'e using several languages you can replace else with elseif.

HTH

Best Regards

olby

Link to comment
Share on other sites

thanks soooooooooooooo much~

but i still have a problem...

 

Parse error: parse error, unexpected T_STRING, expecting '(' in /home2/ppp/public_html/shop/includes/header.php on line 51

 

how can i fix this one?

thanks for help

Link to comment
Share on other sites

Hi jace

 

The parse error is php's way of telling you, that you've made a typo :)

It's expecting a ) in the code.

 

My previous code was just an example, not runable.

Post your code here, if you don't succeed.

Best Regards

olby

Link to comment
Share on other sites

thanks for your time, here is my code:

 

<table border="0" width="820" cellspacing="0" cellpadding="0">

<tr><td valign="middle" valign=bottom>

<?php

if languages_id = en {

<img src="images/head_e.gif')" border=0 usemap="#abc">

} else {

<img src="images/head_c.gif')" border=0 usemap="#abc">

}

?>

</td></tr></table>

<map name=abc>

<area shape=rect coords=455,8,561,31 href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>">

<area shape=rect coords=565,8,671,31 href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL'); ?>">

<area shape=rect coords=675,8,781,31 href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'); ?>">

</map>

<table border="0" width="820" cellspacing="0" cellpadding="2">

<tr class="headerNavigation">

<td valign=middle class="headerNavigation"> <?php echo $breadcrumb->trail(' » '); ?></td>

<td valign=top align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  <?php } ?>

<?php

if (!is_object($lng)) {

include(DIR_WS_CLASSES . 'language.php');

$lng = new language;

}

if (getenv('HTTPS') == 'on') $connection = 'SSL';

else $connection = 'NONSSL';

$languages_string = '';

reset($lng->catalog_languages);

while (list($key, $value) = each($lng->catalog_languages)) {

$languages_string .= '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $connection) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>'; }

echo $languages_string; ?>  

</td></tr>

</table>

Link to comment
Share on other sites

<?php

if languages_id = en {  

 <img src="images/head_e.gif')" border=0 usemap="#abc">  

} else {  

 <img src="images/head_c.gif')" border=0 usemap="#abc">  

}  

?>

Uuups - sorry.

I thought you knew some basic coding syntax - but I can see that you don't :?

This might be to complicated for you then, but try this code out.

The above code should look like this:

<?php

if (languages_id == 1) { 

// language_id is numeric taken from the database - default english=1

echo  '<img src="images/head_e.gif" border=0 usemap="#abc">';

} else { 

echo '<img src="images/head_c.gif" border=0 usemap="#abc">';

} 

?>

Best Regards

olby

Link to comment
Share on other sites

Use the tep_image_button function.

 

tep_image_button has 3 possible parameters: image name, alt text, and additional parameters

 

For example,

$html_code = tep_image_button('head.gif', 'A picture of a Head', 'map="#abc"');

will return

<img src=".../catalog/includes/languages/english/images/buttons/head.gif" border="0" alt="A picture of a Head" title="A picture of a Head" width="100" height="40" map="#abc">

in the $html_code variable. (Obviously I've used arbitrary values for width and height)

 

This means that your language-specific images all have the same name, and go in the folder(s) indicated by the HTML above.

Regards, Wizzud

"It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...