We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18830
    • 161 Posts
    I like the output for images in this form:

    <dl class="foo">
    <dt><image src="foo" width="xx" height="xx" alt="alt" title="caption" /></dt>
    <dd>caption</dd></dl>

    This seems to be more semantic than using divs.

    To achieve this with MODx I created three TVs: class_image, class_caption and image (with image widget) and wrote a litte snippet:

    <?php
    $output=’’;
    $class=’’;
    $caption=’’;
    $idname=$modx->getTemplateVarOutput(’class_image’,$modx->documentIdentifier);
    if($idname[’class_image’]!=’’) $class.=$idname[’class_image’];
    $idname=$modx->getTemplateVarOutput(’caption_image’,$modx->documentIdentifier);
    if($idname[’caption_image’]!=’’) $caption.=$idname[’caption_image’];
    $idname=$modx->getTemplateVarOutput(’image’,$modx->documentIdentifier);
    if($idname[’image’]!=’’) $output.=’<dl class="’.$class.’"><dt>’.$idname[’image’].’</dt>’.$caption.’<dd></dd></dl>’;
    return $output;
    ?>

    This works fine. But taking a closer look at the output I missed the width and the height. sad Does anyone knows a solution? Or is it possible to get this output with TinyMCE?

    Thank you for sharing your ideas.
      • 18830
      • 161 Posts
      Well, here is the solution - I combined my snippet with that of aNoble.