We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23018
    • 353 Posts
    UPDATE: This developed into a fully functional plugin that works with 2.2.13+ and very likely older version as well!

    See this thread for more information: https://forums.modx.com/thread/90070/new-screencast-ppbhelpmanager-plugin-beta-release#dis-post-494921

    Regards,

    pepebe

    P.S. How do I close a discussion?

    --------------------------------------------------------------------

    Inspired by this thread: url]https://forums.modx.com/thread/89412/screencast-helpful-tv-descriptions-in-modxmanager[/url], I've written a small plugin that adds help tab to your resources.

    Disclaimer:
    * I hammered this today into my computer, so it is only tested on revo2.2.12 and google Chrome (v33).
    * I also didn't manage to automatically set the right height for the container surrounding the iframe. The height is therefore fixed to 400px. If your iframed page is taller, you'll you'll have to live with scrollbars to handle the content.

    Note: In a few minutes I'll post a link to a quick screencast showing how it works.
    Screencast uploaded: http://quick.as/a0x3colj

    The results looks like this:


    Note: If the image is not displayed, have a look at the attachment below.

    AS always your feedback is most welcome.

    Regards,

    pepebe

    INSTALLATION INSTRUCTIONS

    1. Create a new plugin, name it "help" and activate it.

    2. Activate the onDocFormPrerender checkbox inside the System Events tab.

    3. Copy the following code into the plugin:

    [s]<?php
    /*
        Add help tab to all templates with a link inside the template description that has a rel="help" attribute.
        
        Example description:
        Use this template for XML feeds <a href="add-your-link-here.html" rel="help"></a>
        
        Hints:
        * Don't add text to the documentation link or it can be seen inside the template picker.
        * href can be any resource relative to the manager directory, as well as any internal or external url.
        * Don't forget, that some pages don't like to be put into iframes (googel, for example).
        
    */
    
    $id             = $modx->resource->get('id');
    $resource       = $modx->getObject('modResource', $id);
    
    $templateObj    = $modx->resource->getOne('Template');
    $description    = $templateObj->get('description');
    
    if (class_exists('DOMDocument')){
        $doc = new DOMDocument(); 
        $doc->loadHTML( $description ); 
        
        $links = $doc->getElementsByTagName( "a" );
        
        foreach($links as $link){
            $rel = $link->getAttribute('rel'); 
            if($rel = 'help'){
                $url = $link->getAttribute('href');
            }
            /* We assume that there is always only one link to the template documentation ... */
            break;
        }
    
        if(!empty($url)){
            $content = '<iframe onload="parent.MODx.helpWindow.getEl().unmask();" src="' . $url . '" width="100%" height="100%" frameborder="0"></iframe>';
        }
        else {
            return;
        }
    }
    else {
        return;
    }
    
    $html = "
        <script>
            MODx.on('ready',function() {
                MODx.addTab('modx-resource-tabs',{
                    title: 'Help',
                    id: 'help',
                    width: '95%',
    			    layout: 'fit',
                    items: [{
                        html: '" . $content . "',
    			        height: 400
                    }]
                });
            });
        </script>
    ";
    
    $modx->regClientStartupHTMLBlock($html);
    return;[/s]
    


    Now all you have to do is adding a link to a template description:

    Example:
    Some helpful description for your TV <a href="add-your-link-here.html" rel="help"></a>
    .

    Sidenote: You can only add 255 characters to a template description (its limited in the db).

    The result can be any external or internal page. Create your own online documentation and add it to the backend of your clients. [ed. note: pepebe last edited this post 12 years, 6 months ago.]
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • 29597 ☆ A M B ☆
      • 350 Posts
      Just so simple and amazing...
      Will definitely use this.
        MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
        DESIGNfromWITHIN, MPThemes and Any Screen Size
        Follow me on Twitter | Read my blog | My code on GitHub
        • 23018
        • 353 Posts
        If I can convince the MODX team to remove the striptags function from line 363 in core/model/modx/modtemplatevar.class.php, I could add the modal tv descriptions to this plugin as well.

        I'll do a pull request later today.

        Regards,

        pepebe
          Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
          • 23018
          • 353 Posts
          Warning: I've found a problem that might be related to the helpManager plugin.

          I'm working on identifying the root of the problem. If you encounter unexpected behaviour in manager (blank pages), deactivate the plugin and see if it works again.

          I'm confused. Is there any condition where for the event onDocFormPrerender

          $modx->resource === false 


          can be true?

          Regards,

          pepebe [ed. note: pepebe last edited this post 12 years, 7 months ago.]
            Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
            • 29597 ☆ A M B ☆
            • 350 Posts
            Hey pepebe,

            Any news on this? Totally love your concept.
              MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
              DESIGNfromWITHIN, MPThemes and Any Screen Size
              Follow me on Twitter | Read my blog | My code on GitHub
              • 23018
              • 353 Posts
              Quote from: ThaClown at Apr 03, 2014, 03:22 AM
              Hey pepebe,

              Any news on this? Totally love your concept.

              Well, I fixed the problem, but I don't still don't know why the problem was there in the first place and why the new code works.

              I've also added some new features and right now I'm trying to put everything together into a plugin thatwill already work in 2.2.x

              * individual helptabs based on the current template
              * Better TV descriptions with optional help modal.
              * Category based helptexts for the template variable tab.

              Regarding 2.3 I have good news. I'm working on a pull request that will make most of the plugin part of the core system.

              Got some work to do this week, but I'm optimistic that I will be able to fork out some extra hours next week.

              Regards,

              pepebe
                Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                • 29597 ☆ A M B ☆
                • 350 Posts
                Great to hear! Could you let me know if you have the plugin done? Could use it.
                  MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
                  DESIGNfromWITHIN, MPThemes and Any Screen Size
                  Follow me on Twitter | Read my blog | My code on GitHub
                  • 23018
                  • 353 Posts
                  Quote from: ThaClown at Apr 13, 2014, 02:01 AM
                  Great to hear! Could you let me know if you have the plugin done? Could use it.

                  In the next few days. If you don't mind getting your feet wet with a beta version, I can send you a link in the next few hours.

                  Cheers,

                  pepebe
                    Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                    • 29597 ☆ A M B ☆
                    • 350 Posts
                    Great! I plan to use it in my ThemeForest theme IVORY. I would live to test:

                    info at themesmodx.com
                      MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
                      DESIGNfromWITHIN, MPThemes and Any Screen Size
                      Follow me on Twitter | Read my blog | My code on GitHub
                      • 23018
                      • 353 Posts
                      Quote from: ThaClown at Apr 13, 2014, 04:55 AM
                      Great! I plan to use it in my ThemeForest theme IVORY. I would live to test:

                      info at themesmodx.com

                      You might also be interested in this: https://forums.modx.com/thread/89953/new-quickcast-manager-plugin---quickmanagernav?page=2#dis-post-494359

                      Cheers,

                      pepebe

                      P.S. I'm curious about your modxtheme for themforrest. If you want to have some feedback, and you have a modxcloud account, send me a copy of your cloud.
                        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe