We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    I’m converting bits of XHTML code to chunks to make it easier for me to make updates site-wide, as well as make it easier for my content writers who don’t know a lot of HTML.

    Now, for most XHTML, chunks are perfectly fine. But for some things, like a < td > tag that needs a colspan attribute, or a < a > link that needs a border="0", I would have to make a chunk for every possible value that was needed.

    So is there a way to code this in a snippet, since it allows logic (aka PHP code)? I know with the help I got on the PopUpChunk snippet, I could have the URL call a chunk. And in snippets like WLPE, there’s ways to specify chunks to be used instead of the default template. So it is correct to assume I could have something like [[td &colspan=`2`]], and do the required stuff in a snippet to parse that number and insert it into the code?

    UPDATE: Whee, finally figured out what I did wrong. Man, is PHP fun or what? tongue The final code is below, in case someone wants to use it. smiley

    <?php
    // CONFIGURATION SETTINGS
    // $colspan [string]
    // This setting controls how many colspans get attached to a <td> tag. Default is 1 (one).
    $colspan = isset($colspan) ? $colspan : '1';
    
    return '<td colspan="'.$colspan.'">';
    ?>
      My Snippets
      -> PopUpChunk v1.0