• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Implementing a new library - moving data between controller and view.

#1
[eluser]Unknown[/eluser]
I believe I have this question because I am weak in PHP OOP, a beginner in Codeigniter or a combination :-S

I am having a problem understanding how to share an object between a view and controller.

I am implementing a date/time form field class that works in plain old php/html. It uses pulldowns to set YMD and HH:MM fields, takes care of some conversions and parsing.

In the view I have:
Code:
$concert_datetime = new Datetime_field();
Then the view displays using:
Code:
echo $concert_datetime->get_select_years("ldigit", "2009", "2012", "year");
echo $concert_datetime->get_select_months(1, "sword", "month");
echo $concert_datetime->get_select_days(1, "day");
echo $concert_datetime->get_select_hours(1, 12, "hour")."<b>:</b>";
echo $concert_datetime->get_select_minutes(1, "0", "min")."<b>:</b>";
echo $concert_datetime->get_select_ampm();
Currently there is no code to manipulate the object in the controller except:
Code:
$justEnteredDateTime = $concert_datetime->get_timestamp_entered();
Execution of this results in an undefined variable error.

Do I need a different form of reference?
Do I need to move the object declaration to the controller?
Then how do I refer to it in the view?

I would very much like to rtfm or rtft(utorial) or w(atch)tft but I have not yet found them :red:


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.