We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: Chaps at Feb 15, 2011, 02:33 PM

    Hi Bob,

    Thankyou, Ive got it working with the second snippet of code - added the parameters I wanted and I can create a new page from the front end successfully smiley .How do I (or can I) edit pages that already exist, things that were created from the manager? Cant seem tp figure this out, I have the [[!NewsPublisher]] snippet code embedded in my template so all pages should be accessible.

    Sorry for the embarassing questions.

    Chaps

    Glad you got that worked out. You still have it backwards, though, The NewsPublisher tag should only go on one page -- the page you go to to create new documents (you definitely don’t want it in a template). It’s the NpEditThisButton tag that you want in the template of any pages that you might want to edit with NewsPublisher. That will display the Edit button. Click on the button and you’re editing the existing page in NewsPublisher.
      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
      • 4948
      • 33 Posts
      Ahhh now the penny has dropped - Thanks! Ive stripped out the [!Newspublisher] from my template and just added it to a single page in the frontend. Ive added the [[!NpEditThisButton]] snippet on all my other pages as I want my client to edit this as close as wysiswyg as you can get and this does indeed add a button on my page. However the button says "Could not set the np_id default property.Set it manually to the ID of". I have added the allow_modx_tags in the access policies, anything else Im supposed to do?

      Many Thanks again, much apppreciated, almost there.
        • 3749
        • 24,544 Posts
        First, be sure the page with the NewsPublisher snippet on it has "NewsPublisher" as its title (at least for now) and clear the site cache. Then, preview any page containing the button from the Manager when signed in as the admin Super User. That should set it. If not, got to the NpEditThisButton snippet, click on the properties tab, and set the default property np_id to the ID of the newspublisher page. Once the button is working, you can change the title of the NewsPublisher page.
          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
          • 4948
          • 33 Posts
          I’ve managed to set the np_id to 20 which is the page Ive got the [[!Newspublisher]] tags in. Ive cleared the cache so now when I’m viewing content for ID 12 for instance, which has an edit button on it, it opens up the newspublisher page which is ID 20. Is that the correct behavior?The template doesnt quite work properly with images etc, so seeing whats going on (its like the path to the css and images are not right....).Will experiment further and let you know how I get on.

          Thanks
            • 3749
            • 24,544 Posts
            That sounds right. When you click the button, you should see the newspublisher page, but you are actually editing the content of page 12.

            The images and formatting should look the same whether you get to the NewsPublisher page directly by previewing it, or by clicking on the button. The symptoms you’re describing sound like a bad template.

            Sometimes it helps to go here and validate the code, either by entering the URL, or by doing "view source" in the browser and pasting all the code in at the validator. With no rich text fields, you should get a perfectly valid page (TinyMCE introduces some spurious warnings due to a bug in the code that hasn’t been fixed in the production 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
              • 4948
              • 33 Posts
              Hi Bob,

              Got the template all working and the edit buton takes me to my page which has the newspublisher code so I think I am 95% done. The last thing to solve is why I get the message

              Sorry . . . There were one or more problems in producing the form:
              You do not have permission to edit resources containing modx tags.

              I am guessing it is to do with the allow_modx_tags not correctly set? Ive got this tag in the access policies (AdministratorTemplate), is that correct?

              Thanks
              Chaps
                • 3749
                • 24,544 Posts
                It definitely is that permission. The user who is logged in has to have that permission in the front-end context (unless you’re previewing from the Manager).

                It’s a fairly new feature, but it worked when I tested it.
                  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
                  • 4948
                  • 33 Posts
                  Thought it would be that permission. I’ll delete it and add it again, but I am logged in as the top level user as theres only one user in the system so far and that is me.
                    • 3749
                    • 24,544 Posts
                    Quote from: Chaps at Feb 18, 2011, 05:44 PM

                    Thought it would be that permission. I’ll delete it and add it again, but I am logged in as the top level user as theres only one user in the system so far and that is me.

                    After you make the change, be sure to flush both permissions and sessions and the site cache.

                    BTW, are you previewing from the Manager?

                    [Update] I just tested it and it works fine for me when previewing from the Manager. Remember that you need to add that permission to the Administrator Policy Template, *and* make sure it’s checked in the Administrator Policy.
                      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
                      • 4948
                      • 33 Posts
                      Hi Bob,

                      Thanks for the advice. I am obviously doing something wrong with my policies. Ive deleted, readded/amended flushed cache etc. Ive attached a screenshot of where I am,, it probably something so simple - I’ve attached a screenshot of the allow_modx_tags permission I have added.Thought it might help you to see where I am?

                      Many thanks again