Using MODX 2.2.14
Hi everyone,
I'm processing a chunk via the API using AJAX. It's pulling all the data as it's supposed to, however, the snippet being called in that chunk isn't processing. Also, only
some conditional statement will not work if false.
AJAX File
<?php
// Get Variables
$project_id = $_POST['project_id'];
// Include MODX
require_once '../config.core.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error','error.modError', '', '');
// UPDATE Project Phase & Status
$sql = "SELECT * FROM table_name WHERE id=".$project_id;
$query = $modx->query($sql);
$info = array();
if($query){
while($project = $query->fetch(PDO::FETCH_ASSOC)) {
array_push($info, $project);
$output .= $modx->getChunk("tpl_project_page",$project);
}
}
echo $output;
Chunk: tpl_project_page (simplified)
<h3>[[+priority:is=`1`:then=`<small><span class="label label-danger">!!!</span></small> `]][[+client_name:ucwords]]</h3>
<p>ERP ID: [[+erp_project_id:empty=`N/A`]]</p>
<p>Platform: [[+project_platform:empty=`N/A`]]</p>
<p>Staging Site URL: [[+staging_site_url:empty=`N/A`]]</p>
<p>Live Site URL: [[+live_site_url:empty=`N/A`]]</p>
<h3>People</h3>
[[!get_profiles? &project_id=`[[+id]]`]]
In the case above:
- [[+priority:is=`1`:then=`<small><span class="label label-danger">!!!</span></small> `]] is returning the whole conditional statement, with the html formatted.
- ERP ID returns [[+erp_project_id:empty=`N/A`]], while all the other ones are returning "N/A" when they're empty.
- The get_profiles snippet returns [[!get_profiles? &project_id=`51`]].
*see attachment for output
Am I doing anything wrong? Or am I missing something?
Thank you.