We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15162
    • 59 Posts
    [[!NewsPublisher? &show=`pagetitle,longtitle,introtext,content,1,19,5,11,15,12,13,17,16,14,10,9,8` &initdatepicker=`1` &parent=`3` 
    &required=`pagetitle,longtitle,introtext,content,tags,age,developer,publisher,game,platform,reviewed,release,points,summary,pros,cons` &template=`arvostelu`]]

    [[!NewsPublisher? &show=`pagetitle,longtitle,content,1,19,2,3` &initdatepicker=`1` &required=`pagetitle,longtitle,content,tags` &parent=`2` &template=`artikkeli`]]

    [[!NewsPublisher? &show=`pagetitle,longtitle,introtext,content,1,19,2,3` &initdatepicker=`1` &parent=`4` &required=`pagetitle,longtitle,introtext,content,tags` &template=`spesiaali`]]


    These are the three that I use.
      • 3749
      • 24,544 Posts
      Just as a test, try deleting the &required parameter and see if it makes any difference.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 15162
        • 59 Posts
        No, still doesn’t work.
          • 3749
          • 24,544 Posts
          I don’t know what to tell you, it definitely works for me with the name.

          If you want to try it, here’s the patched code for _getTemplate().

          Edit the file:

          core/components/newspublisher/classes/newspublisher.class.php

          and replace the _getTemplate() function with this one and the template ID should work:

          protected function _getTemplate() {
                  if ($this->existing) {
                      return $this->resource->get('template');
                  }
                  $template = $this->modx->getOption('default_template');
          
                  if ($this->props['template'] == 'parent') {
                      if (empty($this->parentId)) {
                          $this->setError($this->modx->lexicon('np_parent_not_sent'));
                      }
                      if (empty($this->parentObj)) {
                          $this->parentObj = $this->modx->getObject('modResource', $this->parentId);
                      }
                      if ($this->parentObj) {
                          $template = $this->parentObj->get('template');
                      } else {
                          $this->setError($this->modx->lexicon('np_parent_not_found') . $this->parentId);
                      }
          
                  } elseif (!empty($this->props->template)) {
          
          
                      if (is_numeric($this->props['template'])) { /* user sent a number */
                          $t = $this->modx->getObject('modTemplate', $this->props['template']);
                          /* make sure it exists */
                          if (! $t) {
                              $this->SetError($this->modx->lexicon('np_no_template_id') . $this->props['template']);
                          }
                      } else { /* user sent a template name */
                          $t = $this->modx->getObject('modTemplate', array('templatename' => $this->props['template']));
                          if (!$t) {
                              $this->setError($this->modx->lexicon('np_no_template_name') . $this->props['template']);
                          }
                      }
                      $template = $t ? $t->get('id')
                                  : $this->modx->getOption('default_template');
                          unset($t);
                  }
          
                  return $template;
              }
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 3749
            • 24,544 Posts
            Just a thought. Are you sure the template you’re requesting is a template (shows in the Template section of the Elements tree) and not a chunk?
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 15162
              • 59 Posts
              Tried the fix and still no luck. It’s something specific to my installation or server. I tried the parameter on a fresh install (localhost) and it worked as it did with you.
                • 3749
                • 24,544 Posts
                Quote from: JX3 at Jan 09, 2011, 03:54 AM

                Tried the fix and still no luck. It’s something specific to my installation or server. I tried the parameter on a fresh install (localhost) and it worked as it did with you.

                That’s very odd. I can’t think of anything that would let it work in general, but mess with that one function. I assume that you’ve tried clearing the cache by deleting all the files in the core/cache directory and clearing your browser cache and cookies.

                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 11858
                  • 130 Posts
                  Quote from: BobRay at Jan 06, 2011, 07:53 PM

                  Quote from: Hat-rack at Jan 06, 2011, 05:14 PM

                  Bobray, is there a plan to implement some sort of image/file upload mechanism?

                  I thought about implementing it for Image TVsit, but just didn’t have time to do it. Part of the problem is whether it should let you select from existing files on the server (as the Manager does with Image TVs), or whether it should let you upload new files from a local machine (and put them where?).

                  I have been thinking about this, maybe 2 options would be needed.

                  1) something that’s exactly like the standard modx file manager, where you can select from existing files and also the option to upload to anywhere you wish within a specified folder (the files folder for example.)

                  2) allow uploads using an extra parameter &uploadPath and force the directory to upload to. This could be somewhat automatic using a snippet call to define the parameter. For example: &uploadPath=’/assets/images/2011/[[date? format=’%m’]]’]]

                  Does that sound feasible? I think it would really increase the usefulness of newspublisher.

                  Sorry if format/spelling is off, posting from a phone ATM... smiley
                    • 3749
                    • 24,544 Posts
                    That sounds about right, but it would take some effort to implement in the front end -- it would have to have security restrictions, and remember that in the Manager, you can select from among already uploaded images (with thumbnails of the images) to set the value of the TV, so it should do that also. I’m afraid it’s unlikely that I’ll have time to do any of that in the near future.

                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 14877
                      • 110 Posts
                      Rich Text Editing Problem

                      I have no trouble (well, no more than usual when I try new things smiley ) getting NewsPublisher to work... except, I cannot get RTE to work.

                      RTE, using tinymce, works fine in the back-end (it’s not perfect, but it seems to work quite well and I’m happy with it for clients); however, nothing in the front-end. It shows up with a regular plain-text editor, showing all the HTML markup (perfect for me; no good for clients).

                      I just installed tinymce 4.1.2-pl (versus the -rc1 I was using), but that made no difference. I’ll show the [[!NewsPublisher...]] call at the bottom.

                      &cancelbutton appears to have no effect whatsoever. The default is "No" (surely it should be "Yes"?). I tried both of the following, with no difference (manually clearing the cache, just to be sure):

                      &cancelbutton=`0`
                      &cancelbutton=`1`


                      The documentation says &initdatepicker is required if... However, the default setting is "Yes", so presumably doesn’t need setting in the snippet code.

                      Anyway, here is my snippet call if anyone has any ideas (I really want this to work!).

                      [[!NewsPublisher?
                        &initrte=`1`
                        &rtcontent=`1`
                        &groups=`Interest Groups`
                        &show=`pagetitle,longtitle,Email,Location,content`
                        &published=`1`
                        &hidemenu=`0`
                        &cacheable=`System Default`
                        &searcheable=`System Default`
                        &richtext=`1`
                      ]]

                        __________________
                        JRG