Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

Re: form for a specific record 27 Aug 2012 08:43 #3308

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
When you write :
$this->$user->id

We can see a syntax error. It should be :
(if $this->user is set)
$this->user->id


you can use this syntax for dynamic var names, for example
$this->a = 1;
$this->b = 2;

$varName = 'a';

echo($this->$varName);  //Returns "1"
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: form for a specific record 27 Aug 2012 10:45 #3313

  • BTB300
  • BTB300's Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 415
  • Thank you received: 132
Its the function that is called relative to layout being generated.
It provides data for a specific layout / view

function _buildQuery_default() - is the query for your tables default view
function _buildQuery() - defines the FK dropdown / combo box data (i think? from memory)

If you had two layouts for the same table

1) userdetails
2) usercontact

if your default table was userdetails...
you would have

function _buildQuery()
function _buildQuery_default()
function _buildQuery_usercontact()

if your default layout was usercontact
you would have
function _buildQuery()
function _buildQuery_userdetails()
function _buildQuery_default()

As for
function addWhere($where_clause)
it puts the item at the end of the statement
its useful if you need to define a query that returns a list of items containing specific data such as town, gender, postcode

for instance

. addWhere($address_town->id=4)
. buildQuery_WhereAuthor()

Would Give...
WHERE $user->id = 43 AND $address_town->id = 4
And the record would be returned if user #43 lived in town #4

If you understand MySql well enough and echo, copy and dump the query into your Mysql Interface it becomes a lot easier to understand whats happening

Please Log in or Create an account to join the conversation.

Last edit: by BTB300.

Re: form for a specific record 31 Aug 2012 08:09 #3343

@admin
OK what you suggest ($this->user->id) is also working... so I 've choosen this way.

I was also wondering the purpose of some methods in the models (as they have no header comments)
active() and
activeAll()

can you briefly explain.
Thks

Please Log in or Create an account to join the conversation.

Last edit: by e-struct.
  • Page:
  • 1
  • 2
Time to create page: 0.056 seconds

Dear Cook Team Firstly a massive thank you for your wonderful service!
audibleid (Forum)  

Get Started