We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    This is a simple collection of regular old XHTML tags, but created by a snippet. This could be useful for a website where the user doesn’t know much HTML (since there’s only a few attrbutes to name, and not all of them are needed), or used like BBcode on a snippet like WebLoginPE (this would require the coder to someone only allow these snippets --- I’m not good enough to do that  laugh).

    This is beta-ish quality, because I’m going to be constantly tweaking the code, since I created this for use on my website (and I’ll need to make more as I convert over the content to this new system). But if anyone else wants to create other ones, or add to what I already did, have at it. I’ll be putting all these together in a snippet for download in the Repository in a few months after I’m finished making them all, so if you add something to it, I’ll be sure to credit you. smiley

    For right now, all of these are in CODE blocks --- .php versions will be done with the "final" iteration. Also, no documentation is given as of right now (will be there eventually), but it shouldn’t be too hard to figure out.  grin

    Note that the IF statements that have  isset &xxx --- all this needs is something like &xxx=`y` (y could be anything) to make it work. Also, the &slim is for Slimbox.

    1. IMG
    <?php
    $hor = isset($hor) ? $hor : '0';
    $ver = isset($ver) ? $ver : '0';
    $box = isset($box) ? $box : 'Default';
    
    $link = preg_replace('/QU/','?',$link);
    $link = preg_replace('/EQ/','=',$link);
    
    if (isset($extra)) {
    
    if (isset($slim)) {
    return '<a href="'.$full.'" rel="lightbox['.$box.']" title="'.$desc.'"><img src="'.$thumb.'" align="'.$align.'" hspace="'.$hor.'" vspace="'.$ver.'" alt="'.$desc.'" title="'.$desc.'" /></a>';
    } else {
    return '<img src="'.$url.'" align="'.$align.'" hspace="'.$hor.'" vspace="'.$ver.'" alt="'.$desc.'" title="'.$desc.'" /> <a href="'.$link.'">'.$text.'</a>';
    }
    
    } else {
    return '<img src="'.$url.'" align="'.$align.'" hspace="'.$hor.'" vspace="'.$ver.'" alt="'.$desc.'" title="'.$desc.'" />';
    }
    ?>


    2. Link
    <?php
    $link = preg_replace('/QU/','?',$link);
    $link = preg_replace('/EQ/','=',$link);
    
    if (isset($pop)) {
    return '<a href="'.$link.'" class="'.$css.'" target="_blank">'.$text.'</a>';
    } else {
    return '<a href="'.$link.'" class="'.$css.'">'.$text.'</a>';
    }
    ?>
      My Snippets
      -> PopUpChunk v1.0
      • 28033
      • 925 Posts
      Small update this morning. smiley

      Added a replace function for question marks and equal signs, since MODx treats them as values to be interpreted by the parser. Also renamed URL in the Link snippet to LINK, to match the useage in the Img snippet.
        My Snippets
        -> PopUpChunk v1.0