Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Images to column_right


Pij

Recommended Posts

Add you code like this

 <tr>
<td><?php echo '<a href="' . tep_href_link 'somefile.php', '', 'NONSSL') . '">' .  '<img border="0" src="images/someimage.jpg" alt="some text" width="154" height="122"> ' . '</a>'; ?>
</td>
</tr>

if you place it in the php code, you have to add ?> before it and <?php after it. You will, of course, need to change the attribute values also.

 

BTW, don't make the same mistake as on the link you supplied. The page is too wide causing scrolling. This is most likely due to too large an image.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I've been wanting to do the same and searching here or in the KBase gave me nothing. So I followed your instructions and got the following parse error.

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in c:\easyphp1-7\www\samplestore\includes\boxes\manufacturers.php on line 68

 

when I included this code in Manufacturers.php

 

 

?>
<tr>
<td><?php echo '<a href="' . tep_href_link 'index.php', '', 'NONSSL') . '">' .  '<img border="0" src="images/dom01.png" alt="some text" width="154" height="122"> ' . '</a>'; ?>
</td>
</tr>
?php>

 

The code was inserted right at the end in the file and it looks like this

 

<!-- manufacturers_eof //-->
<?php
 }
?>
?>

<tr>
<td><?php echo '<a href="' . tep_href_link 'index.php', '', 'NONSSL') . '">' .  '<img border="0" src="images/dom01.png" alt="some text" width="154" height="122"> ' . '</a>'; ?>
</td>
</tr>
?php>

 

Thanks

Link to comment
Share on other sites

<Groan> I can't beleive I made that mistake. I said

add ?> before it and <?php after it
but it should be
add <?php before it and ?> after it
I'm sorry for the confusion.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks for your time Jack. No matter what I did I kept getting a parse error so I went another way. In the manufaturers.php (for example) I added the following:

 

<!-- Inserted image jcs 10.Oct.2004  //-->
<tr><td align="center">
<a title="some text here" target="_blank" href="index.php"><img src="images/dom01.png" width="120" height="120" border="0"></a></td></tr>
<!-- End of Remark:  //-->

 

So that the code now lookks like this:

 

  $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
?>

<!-- Inserted image jcs 10.Oct.2004  //-->
<tr><td align="center">
<a title="some text here" target="_blank" href="index.php"><img src="images/dom01.png" width="120" height="120" border="0"></a></td></tr>
<!-- End of Remark:  //-->


<!-- manufacturers //-->

 

It has of course taken a lot of trial and error as to where to place the code since I am not a php coder.

 

Two questions come up which perhaps better belong on another Forum altogether. But I am sure will be usefull here for those wanting to do the same as me.

 

Q1 Just exactly when are the tags <?php and ?> used and where

Q2 What should one look to place or insert code - is the next line after a semi-colon correct positioning?

Link to comment
Share on other sites

Those tags denote a section of php code. They are used anywhere where php code is to be inserted. For example, in normal html, if you wanted to use a table to display Hello, you could do this:

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

Now, if you wanted to use php to insert Hello, you would do this:

<table>
<tr>
<td> <?php echo 'Hello'; ?> </td>
</tr>

In this case, if you wanted to insert more html, you would do it just like you normally would - after the above table.

 

If you have a block of php code already enclosed with those tags, and you want to insert html in it, then you have to break the code into pieces. So given some php code like

<?php
echo 'Hello';
echo 'Goodby';
?>

To put a table in there you would do this:

<?php
echo 'Hello';
?>
<table>
<tr>
<td>Html code</td>
</tr></table>
<?php
echo 'Goodby';
?>

 

HTH,

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks again for your time Jack. I guess I can be a little dense at times.

 

This code is from information.php It has 4 links.

 

  $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 

I would like to insert a image (or more) between the links with the following sample code but it's not working. If I insert the code at the end of the file everything works but - not between the links. I've tried starting with <?php and ending with ?> and, vice versa but I'm doing something wrong.

 

<tr><td align="center">
<a title="Wheel gauge" target="_blank" href="http://www.myrods.com/dm_enter/index.htm"><img src="http://www.myrods.com/advertising/advert4.gif" width="120" height="60" border="0"></a></td></tr>

Link to comment
Share on other sites

You need to use the functions for OSC. The easiest way is just to copy what is already done in that code. So try this, untested, change:

  

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                       '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                       '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
                                       '<a title="Wheel gauge" target="_blank" href="' . tep_href_link 'http://www.myrods.com/dm_enter/index.htm"><', '', 'NONSSL') . '">' .  '<img src="http://www.myrods.com/advertising/advert4.gif" width="120" height="60" border="0"> ' . '</a><br>'.
                                       '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');
</td>

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...