2013-05-06 26 views
0

美好的一天傢伙,我試圖學習codeigniter,並且在iframe中顯示php文件時遇到了麻煩。這是我的代碼。它返回 「404頁找不到」在iframe中使用codeigniter顯示php文件

這裏是我的觀點:

<iframe class="tabContent" name="myIframe" src="<?php echo site_url('pages/view_about');?  >" marginheight="8" marginwidth="8"></iframe> 

那麼這裏是我的控制器:

function view_about(){ 

    $this->load->view('pages/about'); 
} 

,這裏是我的文件夾是如何安排

應用程序 - >則須─ > pages-> about.php

application-> contollers-> pages.php

我只是想補充,我在上面貼了我的觀點是位於

代碼應用程序 - >則須─>模板 - > footer.php

的iframe實際上是一個部分我頁腳感謝

+0

嘗試將URL插入到broser中,它將probaby不起作用。檢查哪些URL輸出到Iframe – 2013-05-06 05:51:56

+0

在控制器中發佈pages.php的內容.. – 2013-05-06 05:52:55

+0

我試圖在瀏覽器http://localhost/projectname/index.php/about中插入此URL並顯示about.php – 2013-05-06 06:01:17

回答

0

PHP結束標記具有

之間的空間試試這個..

<iframe class="tabContent" name="myIframe" src="<?php echo site_url('pages/view_about'); ?>" marginheight="8" marginwidth="8"></iframe> 
+0

我試過但仍然沒有工作 – 2013-05-06 06:55:52

+0

你能粘貼源代碼嗎? – 2013-05-06 07:05:30

+0

@ pic-a如果這個鏈接「http:// localhost/projectname/index.php/about」在瀏覽器中工作,你必須使用'<?php echo site_url('about'); ?'' – 2013-05-06 07:08:26

0

嗨,你可以請嘗試下面的代碼希望它會爲你工作。

<a href="/pages/page" target="targetFrame">Page 1</a> 
<iframe id="targetFrame" src="" width="100%" height="100%" scrolling="NO" frameborder="0" ></iframe> 
+0

我試過這個但不工作,我改變了頁面/頁面的位置我的檔案,但仍然沒有工作 – 2013-05-06 06:57:03