Welcome Guest, Not a member yet? Register   Sign In
Problem with controllers, views and sub-folders[SOLVED]
#1

[eluser]Cadu de Castro Alves[/eluser]
Hello people.

I'm beginner using CI. My app's template structure is based on Wordpress template one. I've 3 files: header.php, sidebar.php and footer.php.

When I need to create a view file, I just include these files. But, I'd like to organize each module view in sub-folders like the example below:

Code:
> module_1
  > index_view.php
  > insert_view.php

> module_2
  > index_view.php
  > insert_view.php

When I call the modules, I got this error:

Quote:A PHP Error was encountered

Severity: Warning

Message: include(http://localhost/projetos/codeigniter/sy...header.php) [function.include]: failed to open stream: no suitable wrapper could be found

Filename: appFilterRules/app_filter_rules_view.php

Line Number: 1

index_view.php
Code:
<?php include($this->template->get('template').'/header.php'); ?>
    <!-- start body block -->
    <div id="body">
        &lt;!-- start navigation block --&gt;
        <div id="left-nav">
            &lt;?php include($this->template->get('template').'/sidebar.php'); ?&gt;
        </div>
        &lt;!-- end navigation block --&gt;
        &lt;!-- start content block --&gt;
        <div id="main">
            <div id="content">
                <h1>Regras de Filtragem de Aplicações</h1>
                <ul>
                    <li>&lt;?php echo anchor('appFilterRules/index', 'Listar', array('title' => 'Listar Regras')) ?&gt;</li>
                    <li>&lt;?php echo anchor('appFilterRules/insert', 'Inserir', array('title' => 'Inserir Nova Regra')) ?&gt;</li>
                </ul>
            </div>
        </div>
        &lt;!-- end content block --&gt;
    </div>
    &lt;!-- end body block --&gt;

&lt;?php include($this->template->get('template').'/footer.php'); ?&gt;

I created a library with some methods to manage my template. Using the method $this->template->get('template') I got the template URI. I'm using this method to map the site path, but I don't works.

I didn't find anything in the forum. Could somebody help me?
#2

[eluser]jcopling[/eluser]
A little investigating lead me to this section of the PHP manual.

http://www.php.net/manual/en/ref.filesys...-url-fopen

It appears that having the allow_url_fopen and allow_url_include disabled can result in an error like the one you are receiving.

Hope it helps.




Theme © iAndrew 2016 - Forum software by © MyBB