Jump to content


  • Posts

  • Joined

  • Last visited

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

3,441 profile views

SwimToWin's Achievements

Full Member

Full Member (4/6)



  1. @bernhard - Where does d() come from? In my ProcessWire 3.0.165 (production) I get: $str = "| Entry | | Foo |"; $md = $modules->get('TextformatterMarkdownExtra'); $md->format($str); d($str); // Fatal Error: Uncaught Error: Call to undefined function d() // Same for: d('foo');
  2. @bernhard - Please elaborate. In ProcessWire 3.0.165 I get this intermediate "Add New" page when creating a page. If only one template can be used, the page is still shown - just without the Template field. <- The purpose is to get rid of this "Add New" page.
  3. Suggested roadmap candidates to improve core: One-step Page Creation: Skip "Add New" and go directly to the resulting page. Better un-global Title fields. Page urls with auto-incrementing IDs (and without Page Name parts). Easier Permissions for Users, Roles, Templates & Pages
  4. I love nice urls - but I also recognize that they are not always needed nor desired due to the additional steps in page creation. Suggested solution: Page ID Page ID is a per-template auto-incrementing number. No. series might be added on a per-template basis (to be configured by webmaster). Page url Replace the full page url with an ID (as an optional configuration). Page url might then change to something like: www.example.com/page/1234 Editing (Page Tree is much less important in this scenario.) Like Drupal's Node IDs (nid). Why this change? Name may reveal confidential info. Name may not matter on certain templates. Page creation is no longer a two-step process; much like adding a row in MySQL. Benefit: This change will make it easier to use ProcessWire for other purposes than websites ("Oh - so ProcessWire is also a finance system!").
  5. Skip the "Add New" dialog page on Page Tree and elsewhere and go directly to the resulting page that shows all page fields right away. Page creation is now improving from being a two-step to becoming a one-step process. Scenarios: When only one Template can be selected: Skip the intermediate "Add New" dialog page by adding a GUID or other temporary page name that is later renamed. Show the final editing page so user can start editing all fields right away On Save: Page name is renamed with title When multiple Templates can be selected: Ask user to select Template on clicking New (before leaving the Tree Page). Then use the "one Template" flow above. (I am aware why the Page Name is needed.)
  6. When webmaster un-globals the Title field (for instance to have a person template with first and last name), there are some unintended consequences. For a site that uses Title on 90% of templates, un-global isn't really useful because it makes adding a new page harder for novice editors: Title field disappears from "Add New" dialog. When I "Add New" page using a template that DOES use the Title field, then the Title field is no longer shown in the Add New dialog window (in this window, an editor will enter Title and Name - and the page is then created and shown to the user in edit mode). No other "pseudo-title" fields can be added to the "Add New" dialog (and it's not possible to skip the two-step page creation process). (There is no simple way to pre-populate the Title field on templates.) Consider these flows: When Title field is global: Steps: From Page Tree, press New to create a new page, "Add New" page is shown with Title and Name fields, (User may need to select Template) Enter Title (Name is automatically set), The new page is shown - start editing fields Observation: Title and Name are shown on same page (good!). Page is created with little mental effort. When Title field is un-global and Page Template has a Title field: Steps: From Page Tree, press New to create a new page, "Add New" page is shown with Name field (but Title is no longer shown when template DOES have the Title field), (User may need to select Template) Enter Name, The new page is shown - start editing fields ("where am I?"). Enter Title (user no longer sees Title and Name at the same time) Observation: Redundant entries (Name and Title are often identical). Name and Title are separated across pages. Better: Show Title and Name on "Add New" page, use Title to set Name (as when Title field is global). When Title field is un-global and Page Template doesn't have a Title field: Setup: Webmaster goes to Template -> Advanced to set "List of fields to display in the admin Page List" (example: "{foo} - {bar}"). Thanks to Robins S for pointing this out. Webmaster cannot specify "Title" fields to be filled in on the "Add New" page. Steps: From Page Tree, press New to create a new page, "Add New" page is shown with Name field, (User may need to select Template) Enter Name, The new page is shown - start editing fields ("where am I?"). Better: Setup allows webmaster to specify "Title" fields to be filled in on the "Add New" page. Even better: Skip the "Add New" dialog page and go directly to the resulting Title page (when only one Template can be selected). Maybe by adding a GUID or other temporary page name that is later renamed? Also I don't think it's possible to pre-populate the Title field in the Administration? (for details, see Pavle's comment). See also: Creating a page without a title? (from 2012 - so I think it's OK to begin a new thread).
  7. (Text deleted as the feature exists)
  8. Better private pages for note-taking, intranets, extranets: I happen to use ProcessWire as public as well as a private note-taking tool. While ProcessWire works really well as a public website, the private website is harder. As a webmaster I want to protect the entire site, a branch (root page and it's children) or a page so that I know my page(s) stay private. Much like Adrian's Page Protector module. As a webmaster I want the page tree to show if a page is protected so that I don't worry if it's protected. As a webmaster I want page protection to be built-in and work with Page Status. As a web designer I want to present public pages to visitors and public+protected pages to permitted users. As a webmaster I want to grant access / permission to specific users and roles. As a webmaster I want to ensure that private / protected pages stay private. Today I might easily publish a page by mistake (when using Unpublished status to control private pages): Benefits: This change will make ProcessWire attractive in a whole new game (intranets, extranets, note-taking, private online knowledge-bases and much more).
  9. As an admin I want to use the API to ask if a page is published - using the $page->isPublished() method - so that I know it's published - as opposed to unpublished or trashed pages. That includes hidden pages. This method will correspond to Settings -> Status when editing pages: (Published is also mentioned explicitly where the edit page says "Published on [?]".) I would expect the API - and specifically the $page->hasStatus() method - to ask if a page has status published. But as I can see, it's only possible to ask for exceptions such as isUnpublished() and isHidden(). <?php // This fails with "Fatal Error: Uncaught Error: Undefined class constant 'statusPublished'" if($page->hasStatus(Page::statusPublished)) { echo 1; } ?> PS: My current use case is that I want to count number of published vs. unpublished pages. I can only do that by getting all pages (include=all), then subtract any unpublished pages.
  10. I have a nested page structure that fails for users without superuser permissions: Works for superusers / non-superusers: - foo -- bar --- page (status: published) ---- page (status: published) --- page (status: published) Fails for non-superusers (Works for superusers): - foo -- bar --- page (status: published) ---- page (status: published) --- page (status: unpublished <- apparently the template structure fails when there's one unpublished page) Template: <?php foreach ($page->children('include=all') as $p): #Fails for non-superusers ?> <?=$p->render()?> <?php endforeach; ?> a) Works for non-superusers when I grant Page Edit permissions (on the template) to their assigned role/s. b) When I remove 'include=all' or 'include=unpublished' then it also works for non-superusers: <?php foreach ($page->children() as $p): #Works for non-superusers ?> <?=$p->render()?> <?php endforeach; ?> Error message (non-superusers) Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Error has been logged. /www/site/assets/logs/errors.txt /foo/bar/baz/ Error: Exception: Page '/foo/bar/baz/quz/' is not currently viewable. /www/site/assets/logs/exceptions.txt /foo/bar/baz/ Page '/foo/bar/baz/quz/' is not currently viewable. (in /wire/modules/PageRender.module line 410) Debug (non-superusers) Error: Exception: Page '/foo/bar/baz/quz/' is not currently viewable. (in wire/modules/PageRender.module line 410) #0 wire/core/Wire.php (397): PageRender->___renderPage(Object(HookEvent)) #1 wire/core/WireHooks.php (823): Wire->_callMethod('___renderPage', Array) #2 wire/core/Wire.php (465): WireHooks->runHooks(Object(PageRender), 'renderPage', Array) #3 wire/core/WireHooks.php (924): Wire->__call('renderPage', Array) #4 wire/core/Wire.php (465): WireHooks->runHooks(Object(Page), 'render', Array) #5 site/templates/template.php (191): Wire->__call('render', Array)
  11. @adrian The page tree is visible, please re-read my comment.
  12. @adrian Currently the page tree doesn't show if a page is protected, is it possible to show this information somehow? Maybe add a locker icon or something? Similar to Unpublished pages that are striked through to show that they are, well, unpublished.
  13. Keeping template snippets / functions in the code can be achieved with ob_start / output buffering. Note how you can inject the $page object into the function - and continue using the ProcessWire API inside the function - that's highly useful. This solution works with your IDE and is based on vanilla PHP. Compared to Hanna Code, this solution allows you to keep all code in the file system. Compared to heredoc and nowdoc, this solution allows you to use PHP / ProcessWire code in the snippet. It's almost like using the Twig and Smarty template engines only it works out of the box, it doesn't add additional overhead and you don't need to learn a proprietary template language. functions.php: function uk_subnav_pill($title,$page,$selector) { if($page->children($selector)->count>0): ob_start(); ?> <li class="uk-active"> <a href="#"><?=$title?> <span uk-icon="icon: triangle-down"></span></a> <div uk-dropdown> <ul class="uk-nav uk-dropdown-nav"> <?php foreach ($page->children($selector) as $p): ?> <li class="uk-list-hyphen"> <a href=#<?=$p->name?>><?=$p->title?></a> </li> <?php endforeach; ?> </ul> </div> </li> <?php return ob_get_clean(); endif; } include your functions file in init.php (I use the delayed output template file strategy but of course the function file can also be included directly in the template file - it's up to you): include 'includes/functions.php'; Then call the function in your template file: <ul class="uk-subnav uk-subnav-pill" uk-margin> <?=uk_subnav_pill('Foos',$page,'template=foo')?> <?=uk_subnav_pill('Bars',$page,'template=bar')?> <?=uk_subnav_pill('Bazs',$page,'template=bar')?> </ul>
  14. I want to add a dependent SELECT field on my template page that lists pages from a parent "sub-page" in the current parent node. On /product1/page I have the field "photo" which is a SELECT field. I want the SELECT to list pages from /ROOTPARENT/photos. The idea is that I can reuse the same photo in many places - but only need to keep it update it once under /product1/photos. My page structure looks like so: /product1/page /product1/photos/photo3 (template=photos) /product2/photos/photo9 I have tried adding these Selector Strings on the Field (Setup -> Fields -> PHOTO -> Input tab -> Selectable Pages field group -> Selector String): parent=/product1/page, template=photos, sort=name WORKS (but only on children of current product). parent=page.rootParent ... parent=$page.rootParent ... parent=$page.rootParent parent=$parent ... parent=$parent1 When using a SELECT Input Field Type, the editing pages gives the fatal error "Unrecognized operator: $". parent=parent ... parent=. Returns an empty list How might I find child pages from the current "/product1/photos/ page"? Your inputs are appreciated. Thanks.
  • Create New...