0
Welcome Guest! Login
0 items Join Now

SOLVED How to add an image to a page using a php file?

  • SOLVED How to add an image to a page using a php file?

    Posted 17 years 10 months ago
    • I have been trying for hours to add an image to my cart page, but with no luck. I cannot seem to figure outthe syntax needed for it. I found an example of an image being inserted in a bit of the code, and tried to use that as an example to follow, but it always seems to break my page and give me an error. The is already a varialbe being used to place text in the spot that I want to image to go, so finding the location that the code is needed was easy. This is an example of what I tried.

      There is this code:
      echo '<h2>'. $VM_LANG->_PHPSHOP_CART_TITLE .'</h2>
      which places the text "Cart" onto the top of the page. What I am trying to do is replace that text with an image we have created. I found another place in the code where they have placed an image on the page with this code:
      echo '
                <table style="background: url('. IMAGEURL .'ps_image/checkout'. $step_count.'_'.$highlighted_step .'.png) right; background-repeat: no-repeat; height:85px;text-align:center;" border="0" cellspacing="0" cellpadding="0">
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <tr>';
      so I tried replacing that first code with:
      echo '
                <table style="background: url('. IMAGEURL .'ps_image/cart-phone-oder.jpg) right; background-repeat: no-repeat; height:85px;text-align:center;" border="0" cellspacing="0" cellpadding="0">
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <tr>';
      But all I get is a broken page with an error on it.

      So does anyone know how I should write the code in order to place the cart-phone-order.jpg file I have created onto the top of the page replacing the Cart text?

      Thank you,
      David Henderson
    • Last Edit: 17 years 10 months ago by William E Dooley.
  • Re: SOLVED How to add an image to a page using a php file?

    Posted 17 years 10 months ago
    • Ok, once again, I just needed to write it out as a question to figure it out:) This one is solved:) I put in the code:
      * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
      *
      * http://virtuemart.net
      */
      mm_showMyFileName( __FILE__ );
       
      $manufacturer_id = mosGetParam( $_REQUEST, 'manufacturer_id');
       
      $mainframe->setPageTitle( $VM_LANG->_PHPSHOP_CART_TITLE );
      $mainframe->appendPathWay( $VM_LANG->_PHPSHOP_CART_TITLE );
       
      $continue_link = '';
      if( !empty( $category_id)) {
      &nbsp; &nbsp; $continue_link = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse&category_id='.$category_id );
      }
      elseif( empty( $category_id) && !empty($product_id)) {
      &nbsp; &nbsp; $db->query( 'SELECT `category_id` FROM `#__{vm}_product_category_xref` WHERE `product_id`='.intval($product_id) );
      &nbsp; &nbsp; $db->next_record();
      &nbsp; &nbsp; $category_id = $db->f('category_id');
      &nbsp; &nbsp; $continue_link = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse&category_id='.$category_id );
      }
      elseif( !empty( $manufacturer_id )) {
      &nbsp; &nbsp; $continue_link = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse&manufacturer_id='.$manufacturer_id );
      }
       
      $show_basket = true;
       
      echo '<div style="text-align: center">
      <img src="components/com_virtuemart/shop_image/ps_image/cart-phone-order.jpg" style="margin: 5px" />
      </div>
      <!-- Cart Begins here -->
      ';

      and BAM, we had an image:)
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: SOLVED How to add an image to a page using a php file?

    Posted 17 years 10 months ago
    • hey William, any chance you can post or PM a link? :)
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
  • Re: SOLVED How to add an image to a page using a php file?

    Posted 17 years 9 months ago
    • Of the picture on the cart page? Yea, it's on the cleanmywater.com site. Just click on an item,hit add to cart..and look at the top of the cart page:) There's an image up there telling them they can call if they don't want to buy online:)

Time to create page: 0.069 seconds