Part of the EllisLab Network
   
 
[Tutorial] View doesn’t display contents of array from controller
Posted: 25 January 2007 08:40 AM   [ Ignore ]  
Summer Student
Total Posts:  28
Joined  01-24-2007

Hello

Now that I got the index.php out of the way… I’m resuming reading the tutorial.

I’m running PHP 5.2.0 as provided by Abyss with their web server, and it seems like I have to make changes to its PHP configuration in the PHP Core section because, per http://www.codeigniter.com/user_guide/general/views.html , the contents of $data[] isn’t passed to the view file. I get a blank page.

Anybody knows if it’s indeed PHP that needs to be customized for a controller to be able to pass an array to a view, and if yes, what setting(s)?

Here’s phpinfo:

http://codecomplete.free.fr/php_config_abyss.html

Thanks.

Profile
 
 
Posted: 25 January 2007 08:54 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  28
Joined  01-24-2007

Please ignore the above: Because my setup doesn’t allow for the short PHP tag <?=, I had to use the usual <?php, but didn’t know that this meant I had to add echo to display stuff:

Change

<?=$title;?>

to

<?php echo $title; ?>

Cheers,

Profile
 
 
Posted: 25 January 2007 01:21 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  352
Joined  04-27-2006

for debugging you can put the following code into the view, to see which variables are all available

<?
    
echo "<pre>";
    
print_r(get_defined_vars());     
    echo
"</pre>";
?>

or better try this…

<?
    
echo "<pre>";
    
print_r($vars);    
    echo
"</pre>";
?>

hope this helps the next time wink

Profile
 
 
Posted: 26 January 2007 02:03 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  28
Joined  01-24-2007

Thanks for the tip grin

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64457 Total Logged-in Users: 19
Total Topics: 80969 Total Anonymous Users: 0
Total Replies: 435701 Total Guests: 181
Total Posts: 516670    
Members ( View Memberlist )