<![CDATA[ [Documentation]MODx API Documentation - MODX Community Forums]]> https://forums.modx.com/thread/?thread=19733 <![CDATA[Re: MODx API Documentation]]> https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109832 Name:
parseChunk

Description:
returns a chunk with any placeholders inside it populated with your own values


Syntax:
parseChunk($chunkName, $chunkVars, $prefix, $suffix);

Parameters:

* chunkName - name of the chunk
* chunkVars - an associative array of variables
* prefix & suffix- the strings which wrap around any placeholders in the chunk
(defaults to {placeholder} , NOT {+placeholder+} !!)

Example of use:

if we have a chunk called ’anecdote_chunk’, like this:

<strong>The tramp made friends with a {+colour+} {+smell+} {+beast+}.</strong>
<img src='images/{+colour+}_{+smell+}_{+beast+}.jpg'>


Then your snippet can access and populate the chunk...

$vars=array();
$vars['beast']='pig';
$vars['colour']='yellow';
$vars['smell']='cheesy';
$output = $modx->parseChunk('anecdote_chunk', $vars,  '{+',  '+}'  );
return $output;


Notes
parseChunk makes use of $modx->getChunk($chunkName) which you might find more useful]]>
chichilatte Aug 16, 2006, 03:07 AM https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109832
<![CDATA[Re: MODx API Documentation]]> https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109831 The core MODx team is more busy in developing than in documenting. And that’s ok, since you cannot do both at the same time.
So, having developers on the one end, and competent documentators on the other - that’s what makes up MODx’ success.
The only thing I’d ask for: do not do it only in Russian! wink
]]>
silent Aug 13, 2006, 06:21 PM https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109831
<![CDATA[getTemplateVarOutput]]> https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109830 Name:
getTemplateVarOutput

Description:
returns an array of TV values

Syntax:

getTemplateVarOutput($tvname, $id, $published);

Parameters:

  • tvname - name of the TV (TV)
  • id - id of the document of which we want the TV value
  • published - published or not only (0 or 1)


Example of use:
#returns the value of "tvparameter" TV for the current document

$id = $modx -> documentObject['id'];
$param = $modx->getTemplateVarOutput('tvparameter',$id);
$output = $param['tvparameter'];

return $output;
]]>
yentsun Aug 13, 2006, 04:20 PM https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109830
<![CDATA[ [Documentation]MODx API Documentation]]> https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109829
Name:
name of the function

Description:
A textual description of what a func does

Syntax:

Syntax of the function call - somewhat like its used in Quick Reference

Parameters:
a list of funcs parameters

Example of use:
a piece of code implementing the function]]>
yentsun Aug 13, 2006, 04:16 PM https://forums.modx.com/thread/19733/documentation-modx-api-documentation#dis-post-109829