We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43592
    • 97 Posts
    Hi Forum and Hi BobRay;),

    Newspublisher posting Ressoures (events) works well - now I want to let the users edit existing ressources in the login area.

    The call seems to work generally because I get the amout of links of the ressources the user created on the login homepage:
    [[!getResources? &parents=`39` &where=`{"createdby:=":[[!+modx.user.id]]}` &tpl=`editevents_tpl` ]] 
    


    But I get a message, that the np_id couldt be set and I've to set it manually.

    This is my editevents_tpl and I'm not sure what to set as the id.
    Is it the pageid of the ressource where I create the events or is it something else.
    Additionally I want to use Newspublisher for creating another set of ressources and I couldnt really read out of the guide how it works.

    <tr class="[[+tv.kuerzlich_geaendert]]"><td>
    [[+tv.Kursart]],<td>[[+tv.Leitung]]</td><td>[[+tv.Beginn:strtotime:date=`%A, %d.%m.%Y um %H.%M Uhr`]]</td><td>
    [[!NpEditThisButton? &np_edit_id=`[[+id]]`]]
    </td></tr>
    


    I'm even not shure if the TV-call [+tv.TV]] is okay in the tpl-file because I cannot see the variables even in the public area of the page.
    Please give me some additional information - thank you!!

    This question has been answered by multiple community members. See the first response.

    [ed. note: sspind last edited this post 8 years ago.]
    • discuss.answer
      • 3749
      • 24,544 Posts
      Have you changed the pagetitle of the NewsPublisher page? If so, change it back to NewsPublisher, run your code once to get the np.id set, then change it back.
        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
        • 43592
        • 97 Posts
        Thank you - that did it!
          • 43592
          • 97 Posts
          One addition please. I dont get out the tv-values out of the template-file, which I use via getressources.
          np-id is correct and works ans links to the correct data. But I dont get the template variables, even not with fastfield.
          <tr class="[[+tv.kuerzlich_geaendert]]"><td>
          [[+tv.Leitung]],/td><td>[[+tv.Beginn:strtotime:date=`%A, %d.%m.%Y um %H.%M Uhr`]]</td><td>
          [[!NpEditThisButton? &np_edit_id=`[[+id]]`]]
          </td></tr>
          
            • 3749
            • 24,544 Posts
            Are the TVs set when you look at the Create/Edit Resource page in the Manager?

            Are the TVs showing up in the NewsPublisher form?

            If you're trying to show TV values for the current page, the tags should be in this form:

            [[*tv.Leitung]]
              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
              • 43592
              • 97 Posts
              I tried now

              <tr class="[[*tv.kuerzlich_geaendert]]">
              <td>[[*tv.Kursart]],[[*tv.Leitung]]</td><td>[[*tv.Beginn:strtotime:date=`%A, %d.%m.%Y um %H.%M Uhr`]]</td><td>
              [[!NpEditThisButton? &np_edit_id=`[[+id]]`]]
              </td></tr>


              for the Login.Homepage getressources tpl but no TV shows up.
              Buttons are here, they link correctly to the Edit-Pages within the right id.
                • 3749
                • 24,544 Posts
                Do the TV values show up in the Create/Edit Resource page?

                If you clear the site cache do the TV values show up?

                Is that code in your last post in a TPL chunk used by getResources or some other extra, or on the page itself?
                  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
                  • 43592
                  • 97 Posts
                  Quote from: BobRay at Apr 13, 2016, 05:48 PM
                  Do the TV values show up in the Create/Edit Resource page?

                  Yes.

                  If you clear the site cache do the TV values show up?

                  No.

                  Is that code in your last post in a TPL chunk used by getResources or some other extra, or on the page itself?

                  That code is in a TPL chunk used by getResources. I have two of those. One uses in Login area, one public. Both do not work.

                  This is the public TPL chunk used again by getRessources

                  <tr class="[[*tv.kuerzlich_geaendert]]"><td><strong>
                  [[*tv.Kursart]]<span style="float:right"><a href="#" onclick="javascript:$.fade('#[[*tv.Kursart:strip:replace=` ==`]]')"> Mehr Infos zu dieser Kursart ... </a></span></strong> </td><td>[[*tv.Leitung]]</td><td>[[*tv.Beginn:strtotime:date=`%A, %d.%m.%Y um %H.%M Uhr`]]</td><td>[[*tv.PLZ]] [[*tv.Ort]], [[*tv.Bundesland]]</td><td><a href="[[~[[+id]]]]">Anmeldung ...</a>
                  </td></tr>
                  


                  The link
                  <a href="[[~[[+id]]]]">Anmeldung ...</a>


                  Links to the CORRECT ressource and this works. ALL OTHER TV's do not show up!
                  • discuss.answer
                    • 3749
                    • 24,544 Posts
                    OK, if that's in a Tpl chunk, you need to go back to this style:

                    [[+tv.Kursart]]


                    You need to put this property in the getResources tag:

                    &includeTVs =`1`
                      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
                      • 43592
                      • 97 Posts
                      Thank you so much, Bob Ray!

                      I was too much in complicate thinking.