We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    I have thought for a while that weblinks could greatly benefit from having access to the introtext or summary field. With a little encouragement I decided to check this out and was greatly amazed that this can be easily accomplished with a very simple modification to the mutate_content.dynamic.php file.

    On line 563 there is a bit of logic that identifies the weblink:
     <?php if($content['type']=="reference" || $_REQUEST['a']==72) { ?>
                  <tr style="height: 24px;">
                    <td><span class='warning'><?php echo $_lang['weblink']; ?></span> <img name="llock" src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/tree/folder.gif" width="18" height="18" onclick="enableLinkSelection(!allowLinkSelection);" style="cursor:pointer;" /></td>
                    <td><input name="ta" type="text" maxlength="255" value="<?php echo !empty($content['content']) ? stripslashes($content['content']) : "http://" ;?>" class="inputBox" style="width:300px;" onchange="documentDirty=true;" />  <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif" onmouseover="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02.gif';" onmouseout="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif';" alt="<?php echo $_lang['document_weblink_help']; ?>" onclick="alert(this.alt);" style="cursor:help;" /></td>
                  </tr>
                <?php } else { ?>
                  <tr style="height: 24px;">
                    <td valign="top" width="100" align="left"><span class='warning'><?php echo $_lang['document_summary']; ?></span></td>
                    <td valign="top"><textarea name="introtext" class="inputBox" rows="3" style="width:300px;" onchange="documentDirty=true;"><?php echo htmlspecialchars(stripslashes($content['introtext']));?></textarea>  <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif" onmouseover="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02.gif';" onmouseout="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif';" alt="<?php echo $_lang['document_summary_help']; ?>" onclick="alert(this.alt);" style="cursor:help;" spellcheck="true"/></td>
                  </tr>
                 <?php } ?>


    You can exclude (not delete) the else portion from the logic of the code and the introtext will be available. The edited code will look like this (I left in the edited notice for illustration purposes):
    <?php if($content['type']=="reference" || $_REQUEST['a']==72) { ?>
                  <tr style="height: 24px;">
                    <td><span class='warning'><?php echo $_lang['weblink']; ?></span> <img name="llock" src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/tree/folder.gif" width="18" height="18" onclick="enableLinkSelection(!allowLinkSelection);" style="cursor:pointer;" /></td>
                    <td><input name="ta" type="text" maxlength="255" value="<?php echo !empty($content['content']) ? stripslashes($content['content']) : "http://" ;?>" class="inputBox" style="width:300px;" onchange="documentDirty=true;" />  <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif" onmouseover="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02.gif';" onmouseout="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif';" alt="<?php echo $_lang['document_weblink_help']; ?>" onclick="alert(this.alt);" style="cursor:help;" /></td>
                  </tr>
                <?php } // EDITED removed the opening else tag ?>
                  <tr style="height: 24px;">
                    <td valign="top" width="100" align="left"><span class='warning'><?php echo $_lang['document_summary']; ?></span></td>
                    <td valign="top"><textarea name="introtext" class="inputBox" rows="3" style="width:300px;" onchange="documentDirty=true;"><?php echo htmlspecialchars(stripslashes($content['introtext']));?></textarea>  <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif" onmouseover="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02.gif';" onmouseout="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif';" alt="<?php echo $_lang['document_summary_help']; ?>" onclick="alert(this.alt);" style="cursor:help;" spellcheck="true"/></td>
                  </tr>
                 <?php // EDITED removed the else closing tag ?>


    I have tested this on my testing environment and on one production site and seems to be working without any problems. Please test this out and post if you have any problems.

    Attached the complete edited file.
      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

      Something is happening here, but you don&#39;t know what it is.
      Do you, Mr. Jones? - [bob dylan]
      • 25663 MODX Staff
      • 12,272 Posts
      Is there any reason not to do this for the next 0962 release?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 25663 MODX Staff
        • 12,272 Posts
        For clarification dev_cw, is the use case for making more things available for weblinks in fact menu building code, and maybe ditto?
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 25663 MODX Staff
          • 12,272 Posts
          FYI, committed this tweak at #3390
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 7231
            • 4,205 Posts
            As you can tell it is pretty basic so I don’t see any potential problems. It is mostly cosmetic so should not effect anything else. I checked with Ditto and Wayfinder and they both recognizes the introtext field for the weblink so looks ok with the major add-ons.

            Quote from: rthrash at Feb 18, 2008, 12:10 PM

            For clarification dev_cw, is the use case for making more things available for weblinks in fact menu building code, and maybe ditto?
            Yes. My reason for this is to be able to add a summary for weblinks in a "links" section of a site displayed with Ditto. The description field is to limiting since the client wants to add a complete summary. I could add a TV but I did not want to use a new template or add a superfluous TV to the existing template. So I said to myself "if only the weblink had an introtext field this would be resolved", then in a recent post when I brought this up I was urged to give it a go and here we are. grin

            It is a good idea for me, I prefer not to use TVs when they could be avoided. I see this being useful in several situations as well.Quote from: rthrash at Feb 18, 2008, 12:31 PM

            FYI, committed this tweak at #3390
            Geeze, you are moving faster than I can type. You are in the zone grin grin
            Wow, this is exiting...my first contribution shocked
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Careful; it’s addictive cool
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org