1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to programmatically create a Page Node??

Discussion in 'XenForo Development Discussions' started by HeadHodge, Jan 14, 2016.

  1. HeadHodge

    HeadHodge Member

    My add-on requires a Page node to function properly.

    How can I add the required Page from my install program?
     
  2. Jake B.

    Jake B. Well-Known Member

    Why does it require a page node? Any reason against just creating a controller and route?
     
    Alfa1 likes this.
  3. HeadHodge

    HeadHodge Member

    because that's the way I designed the add-on and what I desire to use.
     
  4. Jake B.

    Jake B. Well-Known Member

    It's definitely not the best option and not recommended. But you'll need to use the page DataWriter. Take a look at actionSave in the admin controller for pages
     
  5. HeadHodge

    HeadHodge Member

    ok thanks
     
  6. HeadHodge

    HeadHodge Member

    Sorry... I didn't give you a very good answer earlier.

    We use the node tree as basically our main menu and it's easy to (manually) insert Page nodes into the node tree. Not sure how I would do that with the controller/route method. It's seems (to me) there is no easy way to programmatically add a node (no matter which type of node it is).

    It's easy to add a new record to the Page table, but not so easy to the Node table because it's doing some B-tree pointer type stuff that doesn't seem easy to calculate. :(

    So calling their data-writer is probably going to be the easiest way.
     

Share This Page