Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 3rd, 2009, 05:37 AM
Registered User
 
Join Date: Jul 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controller Question

In the index funtion the code is .

function index() {

$data['title']="Welcome to Claudia's site";
.......
.......
}

How is it that $data['title'] becomes $title in the template view as you write ?

Thanks.
Reply With Quote
  #2 (permalink)  
Old July 6th, 2009, 06:09 PM
Wrox Author
 
Join Date: May 2008
Location: Austin, TX, USA.
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default sorry for the delay....

....was trying to get some projects out the door, but now i'm back!

$data['title'] in the controller becomes $title in the view via a simple process:

Right before you load the view, you have to load the vars stored in $data, like this:

PHP Code:
function index(){
  
$data['title']  = "This is my title....";
  
$data['other_stuff'] = "Other stuff....";

  
$this->load->vars($data);
  
$this->load->view('template');


After that, create a template.php view, and in that, you can use $title and $other_stuff, etc.
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
testing a controller using rspec Manoah RoR Ruby on Rails 0 September 26th, 2008 04:02 AM
PHP Controller cyber_kaley20 Beginning PHP 0 July 8th, 2007 10:12 PM
controller to controller tigransh Spring 1 November 11th, 2006 12:48 AM
throwaway controller mmasters BOOK: Professional Java Development with the Spring Framework 0 June 27th, 2006 10:56 AM
Model View Controller gpartin33324 Java GUI 0 October 4th, 2004 04:00 PM



All times are GMT -4. The time now is 12:45 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.