Robin S Posted September 24, 2018 Share Posted September 24, 2018 Creating a support topic for this action now that the new actions-as-modules feature has been added to Admin Actions. Unordered List to Pages An action for the Admin Actions module for ProcessWire CMS/CMF. Creates a structure of new pages from an unordered list entered into a CKEditor field. The nesting of further unordered lists within the list will determine the nesting of the created pages. Created pages get a default template that you select, and you can override this default template per list item by specifying a template name between [[ ]] delimiters. This action can be useful to quickly create a page structure; especially so if you are rebuilding an existing non-ProcessWire site that has a Sitemap page that you can copy and paste from. Usage Install the Unordered List to Pages module. Visit the Admin Actions config screen and enable the "Unordered List to Pages" action for the roles who are allowed to use it. Navigate to Admin Actions > Unordered List to Pages and fill out the config fields: Source Enter/paste an unordered list in the Source field. There is a "cheatsheet" field above that explains the syntax you can use to set some template options for each list item. If you want to override the default template for an item you can specify a template name after the page title between double square brackets. If the template doesn't already exist it will be created. Example: Page title [[staff_members]] You can also specify one or more allowed child templates for a template like so: [[staff_members > manager tech_support]]This would create the page using the staff_members template, and set the allowed child templates of staff_members to manager and tech_support. Alternatively you can specify one or more allowed parent templates for a template like so: [[manager < staff_members]] This would create the page using the manager template, and set the allowed parent templates of manager to staff_members. Parent page Select a parent page that the new pages will be created under. Default template Select the default template to use for the new pages. Screenshots Action config: Result: https://github.com/Toutouwai/AdminActionsUnorderedListToPageshttps://modules.processwire.com/modules/admin-actions-unordered-list-to-pages/ 9 Link to comment Share on other sites More sharing options...
adrian Posted September 24, 2018 Share Posted September 24, 2018 Awesome work Robin - I can see this being my goto approach for quickly getting new site structures up and running! 2 Link to comment Share on other sites More sharing options...
Robin S Posted September 28, 2018 Author Share Posted September 28, 2018 v0.1.3 released, with some new features thanks to a request from Adrian. Any override templates specified in the list items will be created if they don't already exist. You can also set allowed parent templates or allowed child templates for a template within a list item. See the readme or the "cheatsheet" field for the syntax. 3 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted November 9, 2018 Share Posted November 9, 2018 Just came here to say that this stuff rocks, @Robin S and @adrian! And looks so awesome in the new admin theme. I know it's nothing really special (for a person spoiled by using PW for a long time), just an import with a UI... But it feels like magic and even cheating)) The new way to add actions to Admin Actions module - a super feature - just a byproduct of this...??!! ? 2 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted February 21, 2019 Share Posted February 21, 2019 Good day, @Robin S! Starting a new site. Creating structure with this module is really a breeze! Thanks! I have spotted a minor inconvenience when preparing a list in a test editor and pasting it into the Source inputfield. The text editor (or is the inputfield itself?) is adding <p> tags around the <li> contents. And this leads to creating 0 pages. Would be awesome to clear all markup but the ul>li before processing. 2 Link to comment Share on other sites More sharing options...
Robin S Posted February 21, 2019 Author Share Posted February 21, 2019 @Ivan Gretsky, this issue should be fixed in v0.1.4. 1 Link to comment Share on other sites More sharing options...
dragan Posted February 23, 2019 Share Posted February 23, 2019 Sadly, this doesn't work quite as expected here... The first time I used it, every page was created in root. The second time child and grand-child pages were created correctly, but there's something odd with the page-titles it generated for every parent page: PW 3.0.125 1 Link to comment Share on other sites More sharing options...
Robin S Posted February 23, 2019 Author Share Posted February 23, 2019 @dragan, my previous commit to v0.1.4 contained a silly mistake that didn't account for nested lists. Should be fixed now in v0.1.5. 1 Link to comment Share on other sites More sharing options...
dragan Posted February 23, 2019 Share Posted February 23, 2019 @Robin S Excellent! Works wonderfully now: Thanks for the swift fix! 2 Link to comment Share on other sites More sharing options...
dragan Posted February 23, 2019 Share Posted February 23, 2019 Sorry to spoil the party... ? Well, I'm not sure what this is all about, but right after creating the set of pages mentioned above, I went ahead and created another set. This time, the uppermost ul parent was not created: instead I got only the direct child list pages (with correct child pages). I checked that there were no pagename collisions or similar: there were no pages with the same page name as the one I defined as the main ul page-title. I am using a multilanguage setup (although - only the title is textmultilang)... could this have to do with such inconsistencies? I also made sure there was no accidental p tag in-between. The first thing I did when CKE loaded, is click on the list-icon, and then only used the indent/outdent buttons from CKE, to avoid such pitfalls. I'll do some more tests and see if I can find a pattern here. Link to comment Share on other sites More sharing options...
Robin S Posted February 23, 2019 Author Share Posted February 23, 2019 @dragan, everything seems to be working normally for me. If you can paste some CKE source code from a list that is causing you problems I'll investigate. Link to comment Share on other sites More sharing options...
Robin S Posted February 23, 2019 Author Share Posted February 23, 2019 @dragan, I just pushed an update to the repo (no version number change) that adds the "Source" button to the CKEditor field to make it easier to check/report any issues with source code. 1 Link to comment Share on other sites More sharing options...
dragan Posted February 24, 2019 Share Posted February 24, 2019 @Robin S Thanks! I made two tests - everything works just fine now (didn't test yet with specifying templates using [[abc]], but no doubt that works as well) Spoiler <!-- 1st test --> <ul> <li>Cities <ul> <li>Zürich</li> <li>Mumbai</li> <li>Berlin</li> </ul> </li> <li>Cars <ul> <li>Audi</li> <li>BMW</li> <li>Porsche</li> </ul> </li> <li>Colors <ul> <li>Red <ul> <li>Dark Red</li> <li>Light Red</li> <li>Ruby</li> </ul> </li> <li>Blue <ul> <li>Azure</li> <li>Sky Blue</li> <li>Deep Blue</li> </ul> </li> <li>Green</li> </ul> </li> </ul> <!-- 2nd test --> <ul> <li>Countries <ul> <li>Switzerland <ul> <li>Cities <ul> <li>Bern</li> <li>Basel</li> <li>Zürich</li> <li>Genève</li> </ul> </li> <li>Lakes <ul> <li>Zürisee</li> <li>Lac Léman</li> <li>Murtensee</li> </ul> </li> </ul> </li> <li>Croatia <ul> <li>Places <ul> <li>Split</li> <li>Dubrovnik <ul> <li>Things to See <ul> <li>Old Town</li> <li>Church</li> </ul> </li> <li>Where to Eat <ul> <li>Restaurant A</li> <li>Restaurant B</li> <li>Konoba C</li> </ul> </li> <li>How to Get There <ul> <li>By Air <ul> <li>From Germany</li> <li>From UK</li> <li>From USA</li> <li>From Australia</li> </ul> </li> <li>By Car</li> <li>By Bus</li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> 1 Link to comment Share on other sites More sharing options...
dragan Posted January 30, 2020 Share Posted January 30, 2020 I just got a weird error with this module and I'm a bit stumped... After entering a list, the following error occurs, and no pages are being created: CKE source code view: ProcessWire: 3.0.149 PHP: 7.3.13 Webserver: Apache/2.4.35 (Win64) OpenSSL/1.1.1d MySQL: 5.7.24 I've been using this lovely module on-and-off for a while now, but never saw such an error msg before... Link to comment Share on other sites More sharing options...
Robin S Posted January 31, 2020 Author Share Posted January 31, 2020 6 hours ago, dragan said: I just got a weird error with this module Thanks for the report. PHP 7.3 apparently makes some changes to the regex engine and so an update to the bundled Simple HTML Dom Parser was needed. Done now in v0.1.6 of this module. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now