Linked Pages - automatically include any new child pages created

Sharon Parry asked on April 4, 2019 03:26

As hopefully the subject describes my question, is there a way to automatically create a new linked child page of its parent linked page when a NEW page is inserted as a child page of the main parent page?

eg:

At the location of the actual page:

  • Page Title
  • Sub one
  • Sub two
  • Sub three

(I can't get the Sub's to indent in the display, but hopefully you get the gist)

The actual page "Page Title" has been linked in another location of the site, with "Link also all child pages" selected. Initially the location containing the linked pages is exactly the same as above.

At some later time, another child page is added in the main location, so it is now:

  • Page Title
  • Sub one
  • Sub two
  • Sub three
  • Sub four

I'm trying to find a way so that "Sub four" would be added as a new linked page at the location of the linked "Page Title".

Recent Answers


Brenden Kehren answered on April 4, 2019 04:02

You would have to create a global event handler for this to happen. There is nothing out of the box to do this. Your event handler would have to do some lookups of the following fields on the CMS_Tree table. I don't know the exact query or process but based on these fields and doing some queries in the database you should be able to get your code worked out.

NodeID = unique ID per content tree node
NodeParentID = parent content tree node of the current document
NodeLinkedNodeID = node ID of the page this node was linked from
NodeOriginalNodeID = node ID of the original node this page was linked from. Meaning if you created a linked page from NodeID 10, which then created NodeID 20, then you created another linked page from NodeID 20, it would have NodeID 10 in this field.

Clear as mud? Hopefully this gets you in the right direction.

0 votesVote for this answer Mark as a Correct answer

Sharon Parry answered on April 4, 2019 04:11

:) Ok, thanks Brendan. That gives me something I can work with. I think that would probably work. I hadn't thought about global events.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 4, 2019 04:13

You could do a scheduled task but I think that would be kind of messy because you'd don't want to check all the pages every time, just the page that is created.

0 votesVote for this answer Mark as a Correct answer

Sharon Parry answered on April 4, 2019 04:30

Yes, I thought about that when I was replying to your answer - ie Schedule vs Global events.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.