We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33175
    • 711 Posts
    Hello !!

    I wrote this plugin to integrate in document and manage easily links towards websites to which I often refers.
    So, I suppose it run in chunks (I not test this).


    /* Plugin : AutoLinkRef
    * Version : 1.0
    * Date : 2006-03-12
    * Author : Guillaume Charneau (Guillaume)
    *
    * Short desc : Create links automatically from a reference [-xxxxx-]
    *
    * Installation :
    * Create a new plugin
    * Copy and paste this code into
    * Check OnWebPagePrerender (system events > Template Service Events)
    *
    * Long desc :
    * This plugin parse the (x)html code to create weblinks from [-linkalias-] tag.
    * It can add "http://" before url, if you want.
    * All link attributes can be used to create the link and its context.
    * Possibility to specify values by default.
    * Possibility to use or not default values for each link.
    *
    * Example :
    * [-modx-] can become <a href="www.modxcms.com" class="modxlink" id="linkToModx" lang="en">Modx</a>
    *
    * Todo :
    * To add an interface to manage parameters
    * To add table into database for parameters
    */
    Regards

    Edit (2006-03-12 23:42) : I have modified www.modx.com to www.modxcms.com ; Thanks, davidm.
      Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
      • 10487 MODX Staff
      • 1,535 Posts
      Great plugin Guillaume! Thanks for sharing smiley

      One of those additions that I know will be a timesaver to a lot of people.

      Cheers, Garry
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 6726
        • 7,075 Posts
        It sure will be a time saver !

        Just one thing of no importance, in the example : it’s modxcms.com not modx.com wink

        It will sure be nice to have this, along with an autolink feature and the phpGiggle thing that’s in the hopper smiley

          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 4273
          • 356 Posts
          I don’t suppose this has any features to create a link with a _blank target location ? grin
            SMF Bookmark Mod - check it out
            http://mods.simplemachines.org/index.php?mod=350
            • 33175
            • 711 Posts
            Hi bugsmi0 smiley

            Quote from: Guillaume at Mar 11, 2006, 06:59 PM

            * All link attributes can be used to create the link and its context.

            You can create a link with all attributes smiley

            An example for your case ; in the code of the snippet plugin you need to add sommething like this :
            $alr_links['grunzig']['text'] = 'grunzig';
            $alr_links['grunzig']['title'] = 'Website of Grunzig';
            $alr_links['grunzig']['href'] = 'www.grunzig.net';
            $alr_links['grunzig']['hreflang'] = 'fr';
            $alr_links['grunzig']['target'] = '_blank';

            This code will generate this link :
            <a lang="fr" hreflang="fr" title="Website of Grunzig" href="http://www.grunzig.net" target="_blank">grunzig</a>
              Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
              • 4273
              • 356 Posts
              $alr_links['grunzig']['text'] = 'grunzig';
              $alr_links['grunzig']['title'] = 'Website of Grunzig';
              $alr_links['grunzig']['href'] = 'www.grunzig.net';
              $alr_links['grunzig']['hreflang'] = 'fr';
              $alr_links['grunzig']['target'] = '_blank';


              what snippet should we put this code in the dropmenu ? does it matter where in the snippet the code goes ?

                SMF Bookmark Mod - check it out
                http://mods.simplemachines.org/index.php?mod=350
                • 33175
                • 711 Posts
                Sorry bugsmi0 but I don’t understant your questions. My english is so bad... embarrassed
                Could you explain what do you want to mean ?

                Thanks
                  Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
                  • 4273
                  • 356 Posts
                  the code above you said to put it inside the snippet, did you mean the dropmenu snippet ? if so where in the dropmenu would this code go

                    SMF Bookmark Mod - check it out
                    http://mods.simplemachines.org/index.php?mod=350
                    • 33175
                    • 711 Posts
                    Sorry ! I commit an error. You need to put it inside the plugin and not the snippet.

                    For example, if you put this inside the plugin AutoLinkRef :
                    $alr_links['grunzig']['text'] = 'grunzig';
                    $alr_links['grunzig']['title'] = 'Website of Grunzig';
                    $alr_links['grunzig']['href'] = 'www.grunzig.net';
                    $alr_links['grunzig']['hreflang'] = 'fr';
                    $alr_links['grunzig']['target'] = '_blank';

                    In a document, this plugin will replace
                    [-grunzig-]
                    by
                    <a lang="fr" hreflang="fr" title="Website of Grunzig" href="http://www.grunzig.net" target="_blank">grunzig</a>
                      Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !