2013-05-17 46 views
0

您好我想添加一個由Shoretel Microsite生成的PHP代碼在我的Wordpress自定義頁面。添加PHP代碼到我的Wordpress頁面

<?php 
    $version = "all"; // "all" includes everything 
      // "products" includes only product information 

    $style = "2"; // "0" = Use your own Stylesheet 
      // "1" = Stylesheet with nav on the left 
      // "2" = Stylesheet with nav on the top 

    $logo = "us"; // "us" ShoreTel Authorized Reseller 
      // "eu" ShoreTel Authorised Partner 
?> 
<?php echo file_get_contents("http://micro.shoretel.com/www/?v=$version&s=$style&l=$logo&p=" . $_GET["p"]); ?> 

它工作之前,當我把它放在我的PHP文件。但現在當我添加代碼時,頁面將不會加載......那麼我如何添加此代碼呢?

有沒有適當的方法來做到這一點?


<div id="contentRight"> 

***i want to put the code here...*** 

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
    <div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> 
    <h2><?php the_title(); ?></h2> 
     <div id="content"> 
      <?php the_content(); ?> 

**有人告訴我使用,

wp_remote_get instead of file_get_contents 

但如何?

<?php wp_remote_get("http://micro.shoretel.com/www/?v=$version&s=$style&l=$logo&p=" . $_GET["p"], $args); ?> 

回答

1

改爲嘗試一個iframe。聽起來就像是在DIV內部回顯一個完整的頁面並打破了HTML。

例如:

<iframe src='<?php echo "http://micro.shoretel.com/www/?v=$version&s=$style&l=$logo&p=" . $_GET["p"] ?>' ></iframe> 
+0

是代碼是否正確?我不是很好用PHP ..但Dreamweaver突出代碼爲紅色.. –

+0

任何人? :(.... –

+0

嘗試上面的編輯 - 使用單引號周圍的src屬性值 – blotto

相關問題