Using a block $variable in the controller.
Permalink
Heya
I am building a roster block for our local football team.
I am very new to this, but some forum searchin got me pretty far.
I got everying displayed like I want it now...
But my problem is that I want to make the block a little more 'dynamic'.
I want to be able select which user group to display as a roster when I add the block.
This is what I use now, and it works like a charm.
My add.php
So in my view.php I can just: echo $teamName;
So far so good, but I cant do like this in my controller.php
So my question is: Is there any way that I can get the name I enter in add.php and use it in my controller.php?
To give you a better understanding i will include my controller.php as well.
I hope you undersand what i am trying to do.
Thanks for your time.
Have a nice day
Anders.
I am building a roster block for our local football team.
I am very new to this, but some forum searchin got me pretty far.
I got everying displayed like I want it now...
But my problem is that I want to make the block a little more 'dynamic'.
I want to be able select which user group to display as a roster when I add the block.
$userList->filterByGroup('Senior');
This is what I use now, and it works like a charm.
My add.php
So in my view.php I can just: echo $teamName;
So far so good, but I cant do like this in my controller.php
$userList->filterByGroup($teamName);
So my question is: Is there any way that I can get the name I enter in add.php and use it in my controller.php?
To give you a better understanding i will include my controller.php as well.
<?php Loader::model('user_list'); class BrewersRosterBlockController extends BlockController { var $pobj; protected $btDescription = "A Simple roster."; protected $btName = "Brewers Roster"; protected $btTable = 'btBrewersRoster'; protected $btInterfaceWidth = "350"; protected $btInterfaceHeight = "300"; public function view() { $userList = new UserList(); $userList->sortBy('uName', 'asc'); $userList->filterByGroup('Senior'); // This i want to change $users = $userList->getPage(); $this->set('userList', $userList);
Viewing 15 lines of 21 lines. View entire code block.
I hope you undersand what i am trying to do.
Thanks for your time.
Have a nice day
Anders.
*edit* Each field or column or in the case of getRow element of the array is mapped to the controller as a variable to the object.
*endedit*
so $this->teamName where you do filter by group will work.