Hi all,
does anyone knows of a way I can set the page [+introtext+] to be the first <p></p> of same page content?
-
MODX Staff
- 2,502 Posts
It seems possible using regex and the documentObject[’content’] but it would likely take all day for me a PHP grasshopper to wade through.
Sorry.
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
-
☆ A M B ☆
- 24,524 Posts
Hm. That does indeed sound good. Would obviate the necessity of training end users to copy the first x amount of text into the Summary field for Ditto’s use.
-
MODX Staff
- 2,502 Posts
The trick here would be to get all the text up to the first </p> occurance. I am not sure how to do that with PHx but it is not hard to do with a snippet.
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
-
☆ A M B ☆
- 24,524 Posts
The plugin could specifically exclude a list of page IDs, or perhaps even better, since this really would only be useful for blog or news pages, have it work with pages whose parent is in a list of ids.
$parents = array(56, 74);
if(in_array($_POST['parent'], $parents) {
// do stuff ...
}