0
votes

Good day guys, I'm trying to learn codeigniter and I'm having a trouble displaying a php file in an iframe. Here's my code. It returns "404 Page not found"

here's my view:

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

then here's my controller:

  function view_about(){

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

here's how my folders are arranged

application->views->pages->about.php

application->contollers->pages.php

I would just like to add, the code I pasted above for my view is located in

application->views->templates->footer.php

the iframe is actually a part of my footer thanks

2
Try inserting the URL to the broser, it'll probaby don't work as well. Check what URL is outputed to the Iframeeric.itzhak
post the contents of pages.php in the controller..Prasath Albert
I tried inserting this url in the browser localhost/projectname/index.php/about and it displayed the about.phppic-a
So index.php/about is not index.php/pages/view_about.Aurel

2 Answers

0
votes

php ending tag has space between

try this..

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

Hi can you please try below code hope it will work for you.

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