We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19889
    • 616 Posts
    Quote from: ganeshXL at Jul 14, 2007, 09:25 PM

    In the file assets/plugins/tinymce2111/tinymce.functions.php at line 147,
    change
    $tinymceInit .= "		  entity_encoding : \"".$entity_encoding."\",\n";

    to:
    $tinymceInit .= "		  entity_encoding : \"raw\",\n";




    YOU CAN SET ENTITYENCODING IN THE CONFIGURATION PANEL OF THE TINYMCE PLUGIN - NO NEED TO EDIT THE FILE. THANKS ANYWAY
      • 13481
      • 97 Posts
      You’re mixing UTF-8 and ü stuff in the HTML though.
      Either use ö etc. + ISO-8859-1, or äàöü etc. + UTF-8.

      Actually the code strips all entities in the format &xxx;

      I did this because I wasn’t sure how search engines like Google would display these on their end. So using UTF-8 would be the way to solve this problem, but let me know if you think I’m off with my thinking that entities shouldn’t be the description.

      This could just be a setting to strip entities or not.

      Thanks,
      James
        • 13481
        • 97 Posts
        In fact, just commenting out this line in the snippet should do the trick for you:

        Make this:
        /* remove entity chars */
        $text = preg_replace('~&.+;~U',' ',$text);


        Like this:
        /* remove entity chars */
        //$text = preg_replace('~&.+;~U',' ',$text);


        That will leave all the entities in there. It’s a quick fix, but I’d still like to hear back on if people think entities should be in a meta description.

        Thanks,

        James
          • 19889
          • 616 Posts
          Quote from: devtrench at Jul 15, 2007, 07:27 AM

          You’re mixing UTF-8 and ü stuff in the HTML though.
          Either use ö etc. + ISO-8859-1, or äàöü etc. + UTF-8.

          Actually the code strips all entities in the format &xxx;

          I did this because I wasn’t sure how search engines like Google would display these on their end. So using UTF-8 would be the way to solve this problem, but let me know if you think I’m off with my thinking that entities shouldn’t be the description.

          This could just be a setting to strip entities or not.

          Thanks,
          James

          by the way, I did some changes to the code to fit my needs - since chunks and snippets are filtered out and if I just use the content to create the meta description I got some empty descriptions - so I check whether the description is empty and set e.g. the longtitle instead.

          if (!empty($descriptionTV)) {
            // if the $descriptionTV is not empty then we just print it with
            // no extra processing, it's up to you to manage your description
            echo $descriptionTV;
          } else {
            // for everyone else that is lazy, just grab it from the content, yeah!
            $doc = $modx->getDocument($id,'*');   
            $str = getDynaDescription($doc['content'],$maxWordCount);
            echo (strlen($str) > 0) ? $str : $doc['longtitle'];
          }
            • 13481
            • 97 Posts
            Sounds good, I’m glad you got it working for your needs. This conversation has made me think of some possible improvements for this snippet. I never use MODx’s description field, and I have another snippet I wrote that will pull the title or long title into the title tag. But everyone works differently so I’d like to make this snippet have a few more parameters to use as options (like being able to pull in a document variable instead of having to use a template variable).

            James
              • 29181
              • 480 Posts
              Great snippet, Thanks!
                Adrian Lawley: www.adrianlawley.com
                • 6537
                • 70 Posts
                Hi,

                Just found DynamicDescription and was wondering if there’s any way that it could be used in conjunction with Ditto? I have a very simple news page that displays the title and summary of a post, along with a ’read more’ link to the post itself, but I can’t find a way of achieving exactly what I want, which is a ’tidy’ summary.

                I’d rather not use [+introtext+], as it’s another thing thing the client has to type in - I’d rather the summary was generated from the main content of the post. The ’summary’ extender in the Ditto call sort of works, but I’m not keen to keep using it if it has been superseded, and also it sets the limit at x characters, which looks a bit messy if a word is cut in half.

                DynamicDescription looks really good as it limits to x words, but I’m not sure how to get it working with the parent page that contains the post summaries/links, as I need it to reference the document ids of each of the child pages.

                Has anybody done anything similar or have any ideas about this?!

                  • 6537
                  • 70 Posts
                  Sorry, just found that it can be done! The PHx word_limit modifier will do it, if anyone else is interested.
                    • 13481
                    • 97 Posts
                    Quote from: dan_s8 at Aug 26, 2009, 01:56 PM

                    Sorry, just found that it can be done! The PHx word_limit modifier will do it, if anyone else is interested.

                    Yep, PHx would be the way to go with Ditto.

                    I use this phx code to strip characters and shorten at the same time.

                    phx:striplen
                    <?php
                    $content = $modx->stripTags($output);
                    $output = (strlen($content)>$options) ? substr($content,0,$options).'...' : $content; 
                    return($output);
                    ?>
                    


                    usage: [+content:striplen=`200`+]

                    James