2013-07-31 61 views
-2

誰能幫我將HTML轉換到PHP將HTML轉換到PHP

我想一個PayPal按鈕添加到我的woocommerce網站,但我遇到了一些錯誤。

這裏是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購物車下拉菜單在主頁IM的頂部嘗試添加該按鈕成,但不能讓它的顯示 任何幫助將是驚人的

編輯*

這頁我嘗試添加代碼,

<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部分下的按鈕

+3

'回聲' Check out with PayPal''? – brbcoding

+0

有什麼樣的問題?你有任何使用PHP的經驗? – 19greg96

+3

你能解釋一下你想用這個做什麼?你不能真正將HTML轉換爲PHP,你可以回顯它等。你可以顯示更多的頁面,你正在使用它?在PHP的頁面的其餘部分? – Fredd

回答

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 
+0

出於某種原因,我不能讓它顯示 –

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>'; 

?>