Jump to content

Adding to an array


acctman

Recommended Posts

from what i understand from the coding... $form->getField('uri') is for the Sql table field (field uri) location and ->getValue() is the inputbox Value so ->setUri is grabbing the inputbox value and inserting it into Field 'uri' but what I need to do is combine getValue with the string/url profile.site.com/file?name=

 

$new_uri
    ->setUri($form->getField('uri')->getValue())
    ->setHost($form->getField('host')->getValue())
    ->setUser($user->isAuthorized() ? $user->getId() : 0)
    ->save();

Link to comment
Share on other sites

You have to give us some code to work with. Giving us a class name does not help, unless we can actually see that class, or at least the docs for it.

 

this is the documentation I've been reading and work with.

 

 

All data stored in Mokoala's CMS (each record) is handled through an instance of MK_Record.

 

Let's assume there's a table with two fields; 'full_name' and 'married'. Accessing row data is performed as follows; the field 'full_name' would be accessed by calling $record->getFullName() or by calling $record->getMetaValue('full_name'). The 'get' method prefix simply returns the data stored under that field, for that record.

 

If you want to check if a value is set, for instance on the field 'married', you can use $record->isMarried() $record->isMetaData('married'). The 'is' method prefix casts the returned data for that record as a (boolean) value. For instance if 'married' was '0' false would be returned.

 

You can also use 'is' methods to set data. If you were to call $record->isMarried(true) or $record->isMetaData('married', true) this data would be set to 1/true or 0/false depending on the field type.

 

If you want to change the value of the 'full_name' field then you would use $record->setFullName('Matt Lowden') or $record->setMetaValue('full_name', 'Matt Lowden'). In order to save these changes to the database you would use $record->save(). The save and 'set' methods return an instance of $record so they can be strung together, as shown below.

 

$user_module = MK_RecordModuleManager::getFromType('user');
$user = MK_RecordManager::getFromId($user_module>getId(), 1); // `full_name` = 'Matt Lowden', `married` = '0'

$user
->setFullName('Matthew Lowden')
->isMarried(true)
->save();

print $user->getFullName(); // Would print 'Matthew Lowden'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.