CodeIgniter Forums
Blank Views - head scratcher - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Blank Views - head scratcher (/thread-34001.html)



Blank Views - head scratcher - El Forum - 09-15-2010

[eluser]techgnome[/eluser]
quick into - I'm a programmer by trade, and I've been doing php development off and on for a number of years... I'm not exactly what you would call a noob when it comes to this. -- I mention this so you don't feel the need to talk to me like a 3-year old... I'm at least 5... Wink

And I did search the forums, saw similar, but not exactly the same problem, and I've done some initial troubleshooting and have narrowed down where the problem lies... but I cannot for the life of me figure out the WHY.

Here's the setup: (ignore caps... force of habbit)

root
root \ application
root \ application \ Controllers
root \ application \ Views
root \ application \ Views \ Includes

So, my controller, "view" is in the controllers folder... that seems to work.. there's an index function and others...
the includes contains my header, navigation, sidebar, and other common view files... in the view folder are all of the views ports that make up the main content section.

Within the includes folder is "template.php" and it looks like this:
Code:
<?php
    $this->load->view('includes/_header_view');
    $this->load->view('includes/_quicklinks_view');
    $this->load->view('includes/_subheader_view');
    $this->load->view($content_view);
    $this->load->view('includes/_sidebar_view');
    $this->load->view('includes/_footer_view');
And nothing more...

The index function looks like this:
Code:
function index()
    {

$this->output->enable_profiler(TRUE);  
      $data['pageName'] = 'home';
    $data['css'] = $this->css;
    $data['base'] = $this->base;
    $data['content_view'] = 'view_content_view';

        $this->load->view('includes/template', $data);

    }

The "view_content_view" is in the view root...

At home... on my local machine (Win7Pro, running latest XAMPP) it all works great. When I uploaded it to my test site at my host (running Linux and php5)... nothing... I did remember to change the base_url in the config file... and the default controller is "view" -- but when I go to /index.php/view/index ... all I get is a blank page... no output or anything.

So, I started adding echo statements to track where it was going... everything runs fine up to the loading of the template view.

If I add echo("Hai there!"); to just before the load->view in the controller, and inside the template.php file AND just after the load->view command.... I get "Hai there!Hai there!" ... when I expected "Hai there!Hai there!Hai there!" ... that tells me that the view isn't loading correctly. I even took the load views out of the template and put themn directly in the controller, no dice. I even (just now) changed it so that it would load a view directly (instead of the template)... same blankness I get from my 6-year old sometimes.

HALP!

Clearly I've overlooked something, but for the life of me, I cannot think of what.
If necessary, I can post more code chunks, run diagnostics, what ever. Like I've mentioned, I've searched the forums, and didn't find anything like this. I've turned on error reporting, nothing. Tried the Diagnostics option... nothing useful there.

Note... If I run /index.php/view/somefuncdoesntexist... .I get the CI 404 error I've come to know and dislike... so I'm pretty sure it's not a problem with CI ... it could be my setup... could be I missed a comment or a php tag somewhere too...

Any help would be appreciated.

-tg


Blank Views - head scratcher - El Forum - 09-15-2010

[eluser]techgnome[/eluser]
Now I'm sure I'm overlooking something stupid. If I change my controller to load a view that can't possible exist... I expected an error... and I got nothing.
Code:
$this->load->view('includes/template_fileof_somekind', $data);

Maybe I've got a file reference problem.

-tg


Blank Views - head scratcher - El Forum - 09-15-2010

[eluser]danmontgomery[/eluser]
Have you checked the apache error log?


Blank Views - head scratcher - El Forum - 09-15-2010

[eluser]techgnome[/eluser]
apache logs? I knew I'd forget to check something. No I haven't. I don't have direct access to them from here. -- wait... I might. Hmmm... that's going to take a while to dig through.

At any rate....
I did turn on logging and told CI to log everything...
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>

DEBUG - 2010-09-15 16:24:33 --> Config Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Hooks Class Initialized
DEBUG - 2010-09-15 16:24:33 --> URI Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Router Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Output Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Input Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Global POST and COOKIE data sanitized
DEBUG - 2010-09-15 16:24:33 --> Language Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Loader Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Helper loaded: url_helper
DEBUG - 2010-09-15 16:24:33 --> Controller Class Initialized
DEBUG - 2010-09-15 16:24:33 --> My Data 1 Array
(
    [pageName] => home
    [css] => styles/style.css
    [base] => http://test.obscurilizingURL.com/
    [content_view] => view_content_view
)

DEBUG - 2010-09-15 16:24:33 --> Loader Class Initialized
DEBUG - 2010-09-15 16:24:33 --> Controller Class Initialized
DEBUG - 2010-09-15 16:24:33 --> My Data 2 Array
(
    [pageName] => home
    [css] => styles/style.css
    [base] => http://test.obscurilizingURL.com/
    [content_view] => view_content_view
)

DEBUG - 2010-09-15 16:24:33 --> Final output sent to browser
DEBUG - 2010-09-15 16:24:33 --> Total execution time: 0.0181
(not my real url, but it is set correctly in the log file).

I don't see anything out of the ordinary. And the log message in my template.php file doesn't show either. I'll check the server logs when I get home... I'm hoping there's a clue there.

-tg


Blank Views - head scratcher - El Forum - 09-15-2010

[eluser]techgnome[/eluser]
I "think" I've found my problem... I've been foolishly trying to use "view" as the name of my controller... when I renamed it to "site" things started working again... problem is that I don't really want to use "site" ... grrr... for now I can live with it though.

-tg


Blank Views - head scratcher - El Forum - 09-15-2010

[eluser]sprise[/eluser]
Yep that would be one of the reserved words, but you can call it just about anything else (or add a prefix) :-P


Blank Views - head scratcher - El Forum - 09-16-2010

[eluser]techgnome[/eluser]
HA! Nice... I was wondering if there was such a list.

Note to tutorial writers out there: When introducing and discussing Views, Controllers, Models, Libraries, etc... might want to mention the taboo words... Tongue Just a suggestion.

sprise - thanks for that list... I'll have to snag a copy later and keep it in my notes so I don't do that again.

-tg