We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    I've read the NP docs regarding multiple pages but I'm having problems.

    I have 3 NP forms:

    NPform1
    NPform2
    NPform3

    It's this part of the docs I don't quite understand,

    "If you use the following snippet tag for the button, you can have it launch the appropriate NewsPublisher page by creating a TV for each page called NpId and setting the correct NewsPublisher page ID in it:
    [[!NpEditThisButton? &np_id=`[[*NpId]]`"

    How/where does the NP page ID get set in the TV?

    Also, the docs say to use a different Snippet Tag for each form, but different how?
      Todd
      • 3749
      • 24,544 Posts
      The instructions assume that (in your case) you have three separate NP pages. The value gets in the TV when you put it there manually.

      You use a different NP tag for each of your NPform# pages because you want them to be different. If you didn't, you'd only need one NP page. You might, for example, want to use a different &show property for each NPform.

      Say you have two separate pages page1 and page2). You want page1 to be edited with NPform1 and page2 with NPform2.

      The page with the NPForm1 version of the NP tag has an ID of 12.
      The page with the NPForm version of the NP tag has an ID of 13.

      You create the NpId Template Variable and attach it to the appropriate templates.

      Then, you edit page1 and set the NpId TV to 12.
      Next, you edit page2 and set the NpId TV to 13.

      You add this tag to the template or the page content of page1 and page2:

      [[!NpEditThisButton? &np_id=`[[*NpId]]`]]


      When you click on the edit button on page1, it will be edited in the NPform1 version.
      When you click on the edit button on page, it will be edited in the NPform2 version.









        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
        • 40088
        • 708 Posts
        I think I might understand what you're saying.

        For clarity (just in case this isn't how multiple NP pages is meant to work) let me explain exactly what's happening.

        * Previously only a single NP form was used for creating/editing member resources but now a total of 3 different forms are in play.

        As it works currently:
        When a member signs-in they are presented with a main listing of all their articles/resources. The listing has an inline edit button (set in a Chunk) for each resource which takes them to the NP (edit) form. Additionally, there's also an edit button on the actual article page.

        I've since had to add 2 more NP forms for a total of 3, each one different and each publishing to a specific area of the site. Again, that part works great.

        The problem is with the inline edit button on the main resource listing mentioned above, not the edit button on the individual article page(s) which works fine. Because the main listing now includes resources created from different NP forms I need to dynamically point a resource’s inline edit button to its respective (edit) form on a resource-by-resource basis.

        If I understand Bob’s explanation correctly it sounds like his approach requires each resource be manually set (via a TV). If I'm correct then this won't work for me, it needs to happen on-the-fly.

        Of course I could remove the edit button from the main listing and avoid the headache but it's pretty convenient, so I would like to keep it if possible. [ed. note: todd.b last edited this post 11 years, 8 months ago.]
          Todd
          • 3749
          • 24,544 Posts
          If you're creating the main listing page with getResources or something similar, try putting the proper NpId in each page's TV and put the edit tag in the getResources Tpl chunk using a placeholder like this:

          [[!NpEditThisButton? &np_id=`[[+NpId]]`]]


          Be sure to set the TV-related getResources properties.
            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
            • 40088
            • 708 Posts
            Correct me if I'm wrong, but as far as implementing the whole TV thing does that not still require manually adding the appropriate NP id to every newly created resource? I’m hoping that it can be done dynamically instead.

            In any case I followed your above instructions but still nothing. Clicking the edit button simply reloads the listing page.

            Thank you for the suggestion but it looks like I’ll have to remove the inline edit buttons from the main listing until I can get it sorted. [ed. note: todd.b last edited this post 11 years, 8 months ago.]
              Todd