We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36834
    • 25 Posts
    Mac OSX 10.6.4
    Apache 2.2.15 (Unix)
    PHP 5.3.3
    MySql 5.1.47
    MODx 2.1.3-pl traditional

    I am using a plugin to develop custom tv input and output types outside the core and am having a problem when the resulting tvs are parsed for output.

    I am using the ’OnTVOutputRenderList’ event in my plugin to supply the path to the php render file (see the following example - I have both events registered to the plugin).

    $core_path = 'path/to/customtvs';
    
    switch ($modx->event->name) {
    	
        case 'OnTVOutputRenderList':
            $modx->event->output($core_path.'elements/tv/web/output/');
            break; 
    
    	case 'OnTVOutputRenderPropertiesList':
            $modx->event->output($core_path.'elements/tv/mgr/output/');
            break;
           
    }


    All the custom tvs appear in the manager and are working fine up until the point of rendering the web page.

    The problem I am having is that if I have more than one custom tv of the same type, only the first occurence is being parsed with the output file. The second and further tvs are simply inserted with their raw value.

    For example I have a tvs for metatags where the user simply fills in a textarea with the relevent text.

    The first tag in the template is parsed correctly -

    <meta name="description" content="decription here" />


    The secong tag renders with only the raw value -

    key, words, here



    I have tried to debug this problem without success. By writing to the log I have established that the ’OnTVOutputRenderList’ event fires twice during the page render, but the second time it appears to omit the custom path that it uses the first time. (Example from log below0

    [2011-08-06 16:17:05] (ERROR @ /modx/index.php) /pathto/modx/core/model/modx/processors/element/tv/renders/web/output/    /pathto/customtvs/core/components/customtvs/elements/tv/web/output/
     
    [2011-08-06 16:17:05] (ERROR @ /modx/index.php) /pathto/modx/core/model/modx/processors/element/tv/renders/web/output/


    I would be extremely grateful if anyone can shed anylight on this issue. Am I using the event incorrectly? Or could it be a bug?

    Thanks in advance.
      • 28215
      • 4,149 Posts
      Can you file this as an issue here: http://bugs.modx.com/

      So we can give it a thorough test?
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 36834
        • 25 Posts
        Will do. Can I login with the same details as the forum or do I need to create a new account?
          • 28215
          • 4,149 Posts
          You use your modx.com account. If you don’t have one of those, you’ll need to register here: http://modx.com/login/
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 36834
            • 25 Posts
            I have found the cause for this. I was including the plugin code from an external file using php’s include function. The end result was the issue above (with or without cacheing turned on). It would be nice to be able to include plugins externally for development. I have updated the bug report to reflect this.