-2

谁能帮我将 Html 转换为 PHP

我想在我的 woocommerce 网站上添加一个 paypal 按钮,但我遇到了一些错误。

这是我的 html 格式的代码

<a class="paypal_checkout_button" href="websitelinkhere"><img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" width="145" height="42" style="width: 145px; height: 42px; padding-top: 30px; padding-left:20px; " border="0" align="top" alt="Check out with PayPal"></a>

基本上我正在使用主题-theretailer.getbowtied.com/demo 主页顶部的购物车下拉菜单我试图将按钮添加到其中但无法显示任何帮助都会很棒

编辑*

这是我试图将代码添加到的页面

 <div class="gbtr_minicart_wrapper">
 <div class="gbtr_minicart">

<?php echo '<a class="paypal_checkout_button" href="websitelinkhere"><img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" width="145" height="42" style="width: 145px; height: 42px; padding-top: 30px; padding-left:20px; " border="0" align="top" alt="Check out with PayPal"></a>';?>

<?php                                    
echo '<ul class="cart_list">';                                        
if (sizeof($woocommerce->cart->cart_contents)>0) : foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) :

 $_product = $cart_item['data'];                                            
 if ($_product->exists() && $cart_item['quantity']>0) :                                            
      echo '<li class="cart_list_product">';                                                
      echo '<a class="cart_list_product_img" href="'.get_permalink($cart_item['product_id']).'">' . $_product->get_image().'</a>';                                                    
      echo '<div class="cart_list_product_title">';
      $gbtr_product_title = $_product->get_title();
      //$gbtr_short_product_title = (strlen($gbtr_product_title) > 28) ? substr($gbtr_product_title, 0, 25) . '...' : $gbtr_product_title;
      echo '<a href="'.get_permalink($cart_item['product_id']).'">' . apply_filters('woocommerce_cart_widget_product_title', $gbtr_product_title, $_product) . '</a>';
       echo '<div class="cart_list_product_quantity">'.__('Quantity:', 'theretailer').' '.$cart_item['quantity'].'</div>';
       echo '</div>';
       echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">&times;</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'woocommerce') ), $cart_item_key );
       echo '<div class="cart_list_product_price">'.woocommerce_price($_product->get_price()).'</div>';
       echo '<div class="clr"></div>';                                                
       echo '</li>';                                         
       endif;                                        
      endforeach;
?>

<div class="minicart_total_checkout">                                        
<?php _e('Cart subtotal', 'theretailer'); ?><span>
<?php echo $woocommerce->cart->get_cart_total(); ?></span>                                   
</div>


<a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" class="button gbtr_minicart_cart_but"><?php _e('View Shopping Bag', 'theretailer'); ?></a>   
<a href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>" class="button gbtr_minicart_checkout_but"><?php _e('Proceed to Checkout', 'theretailer'); ?></a>

  <?php                                        
  else: echo '<li class="empty">'.__('No products in the cart.','woocommerce').'</li>'; endif;                                    
   echo '</ul>';                                    
   ?>                                                                        

   </div>
   </div>

   </div>

  <a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" class="gbtr_little_shopping_bag_wrapper_mobiles"><span><?php echo $woocommerce->cart->cart_contents_count; ?></span></a>

   </div>

我想把它放在按钮下面

我正在寻找它进入按钮下的 gbtr_minicart 部分

4

2 回答 2

4

干得好

//some php code
?>
    <a class="paypal_checkout_button" href="websitelinkhere"><img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" width="145" height="42" style="width: 145px; height: 42px; padding-top: 30px; padding-left:20px; " border="0" align="top" alt="Check out with PayPal"></a>
<?php
//php code again
于 2013-07-31T15:41:26.153 回答
0
<?php 
  echo '<a class="paypal_checkout_button" href="websitelinkhere"><img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" width="145" height="42" style="width: 145px; height: 42px; padding-top: 30px; padding-left:20px; " border="0" align="top" alt="Check out with PayPal"></a>';

?>
于 2013-07-31T15:42:07.470 回答