Thanks for the API and all your work...
Questions...
1) Does SetTV creates a new TV and returns a new TV ID?
2) Does UpdateTV edits the value of the TV and returns a new TV ID, or it
is just a typo in the function doc header?
3) How does they deal with multiple data TVs like checkboxes or listboxes?
The value should be a string but in those cases is better to pass an array..
Does it only works with single string TVs?
Thanks again...
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
-
☆ A M B ☆
- 455 Posts
1) setTV gives TV ID and document ID and a value and INSERTs a value for a TV you have been created and returns ID of inserted row.
2) updateTV is like setTV but it UPDATEs a current row and return last effected row ID.
3) It gets string. Checking for TV types and other process may increase code lines and i think it’s better to do by programmer. MODx coding is really easy, These APIs are shortcuts and do not some special works....
Thanks
AHHP
Thanks for clarifying things AHHP.. appreciated..
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
Hmmm... I’d say, this will be extremely helpful. Can’t wait to try this out.
An aspiring web designer & front-end web developer who is very much interested on the modern web.
www.andrewabogado.com
Hello,
I think I ran into another bug... In the WHERE part of the query in the UpdateTV function, the ’tmplvarid’ is not checked. Resulting in replacement of values in all TV’s related to that content.
[tt]
function updateTV($tv, $docId, $value) {
if( !is_numeric($tv) ) {
$arr = $this->TV_name2id(array($tv));
$tv = (integer) $arr[$tv];
}
if( !is_numeric($tv) || $tv == 0 )
return false;
$update = array("tmplvarid" => $tv, ’contentid’ => $docId, ’value’ => $value);
if( ! $id = $this->db->update($update, $this->getFullTableName(’site_tmplvar_contentvalues’), ’contentid=’.$docId.’ AND tmplvarid=’.$tv) )
return false;
return $id;
}[/tt]