Jump to content

SwimToWin

Members
  • Posts

    68
  • Joined

  • Last visited

Everything posted by SwimToWin

  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.
  15. Excellent suggestions. Thanks to all. @adrian, your solution works like a charm: Press New Set Title and Name (Template is currently unassigned) Press "Save" - Page now gets published with the chosen template, all template fields are blank. Setting pages to unpublished is still possible. This is how I want the flow.
  16. The basic Processwire workflow assumes that I (as an Editor) want to save new Pages in draft mode - and therefore new pages are always set to unpublished by default. To publish the page, it is necessary to actively press "Publish", otherwise the Page will not be visible. The workflow is: Add new Page Status is now "Unpublished: Not visible on site." Press Publish - the page is now visible on site I want to publish pages right away (without having to press Publish). Where is that configured? ProcessWire 3.0.123 Uikit v3 admin theme (0.3.0)
  17. @adrian I do have one question: Users are allowed to create sub-pages in their branch, is it possible to restrict the templates, users can select? For instance, a Contact Page is created by me - and the user shall not be able to create an additional Contact Page. Template Once Per Parent seems to do the trick?
  18. I have a website that allows users to create their personal "website" (a page with sub-pages). Users shall be able to: Log in (frontend and/or admin), Edit "their" page(s) - I am using the "Page Edit Per User"-module (https://modules.processwire.com/modules/page-edit-per-user/) to grant access to the relevant pages Create child pages - possible? Users shall not be able to see other pages in the admin interface - "Admin Restrict Page Tree" may do the trick (https://modules.processwire.com/modules/admin-restrict-page-tree/)? Frontend editing shall be possible - I am considering "Fredi" (https://modules.processwire.com/modules/fredi/) for this. The challenge is that it takes a lot of modules and configuration. Is there a way to set this up that doesn't require a lot of configuration for each new user?
  19. ProcessWire is setting a "wires" cookie for each guest session. Is it possible drop that cookies, so there are no cookies at all for guests? That way, I don't need to spam the user with a cookie consent box. I don't need cookies for user preferences and marketing purposes. (Why are cookies being set by default in the first place?)
  20. Hi, I am in the process of creating a local news site, based on ProcessWire. Among other things, the site will be presenting local events, and I have a question specifically about recurring events. Events (recurring or not) shall be shown in *one* list, like in this example: 10.01.2019 19:30 - Some event (Page #1235) 11.01.2019 17:15 - Another event (Page #1237) 12.01.2019 16:00 - The Final Event (Page #1239) When I have recurring events, I would like to keep these on the same page (using a Repeater field) as shown here: 10.01.2019 19:00 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 10.01.2019 19:30 - Some event (Page #1235) 11.01.2019 19:30 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 11.01.2019 17:15 - Another event (Page #1237) 12.01.2019 20:00 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 12.01.2019 16:00 - The Final Event (Page #1239) The editing interface will use these fields: id title date_start - a datetime field (use for one-time events) time_start - a text field dates - Repeat field with these sub-fields: date_start - a datetime field (use for recurring events) time_start - a text field Listing events by date_start is simple when the site only has run-once events (using the 'date_start' field). But when repeated events enter the picture, it is necesssary to generate all occurrences for each repeated event ('dates.date_start') - and join these with the list of run-once events ('date_start'). I am unsure if that is possible? PS: I am aware that Ryan created an Events fieldtype module, unfortunately the site needs more detail about each event than this module offers so it is easier to create a site-specific set of Event fields.
  21. @adrian - Very nice module! I was requested to add password / passphrase protection of a Danish site, and this module came very handy. Background image added: html { background:url('/images/background.jpg') no-repeat center center; min-height: 100%; background-size: cover; } body { min-height: 100%; } Transparent background color added on top of the background photo (so the text remain readable): legend { background: #eee; opacity: 0.7; color: #333; font-weight: bold; font-size: larger; } If you have time to spare, then I have two minor enhancement requests: 1. The TITLE tag prepends "protected :: " before the site title. Better: Make the prepended string translateable (perhaps that's already possible somehow?). Or, add multi-language capabilities as suggested by Juergen (I would prefer a text string tough). 2. Login with a single passphrase field I only need one field (password / passphrase) - but the module require that I add two fields (username and password). Better: Allow the administrator to specify a passphrase ... if the passphrase is correct then a default username and password is activated. Here is how it may work: * Administrator creates a guest user. * Administrator creates a passphrase and links it to the guest user. * When end-user logs in with correct passphrase, then user is logged in as the guest user.
  22. Background info: I am using ProcessWire as the back-end to manage contents on multiple sites. I use ProcessWire as an editing system and database only. The ProcessWire templating system is not in use. I will describe the setup in a separate topic - it's cool! ;-)
  23. I am using ProcessWire as the back-end to manage contents on multiple sites (I call them "sub-domains"). I use ProcessWire as an editing system and database only. The ProcessWire templating system is not in use. I want to use ProcessWire's API and in particular the Include & Bootstrap method to output contents -- pretty much in the same way you do, if contents is stored in a MySQL database and output in PHP files that use PDO to load data. The issue is that I cannot get ProcessWire to fully work on each of the "sub-domains". https://processwire.com/api/include/ says: > You can do anything with ProcessWire's API that you can do from a template, > so all of this still applies, as does everything in the developer API. How can I get access to variables such as $input when using Include & Bootstrap? I tried these: $wire->pages->get("/foo/bar/"); echo "Segment1: " . $wire->input->urlSegment1; # Returns null $wire->pages->get("/foo/bar/"); echo "Segment1: " . $wire->input()->urlSegment1; # Internal Server Error $p = $wire->pages->get("/foo/bar/"); echo "Segment1: " . $p->input->urlSegment1; # Returns null $p = $wire->pages->get("/foo/bar/"); echo "Segment1: " . $p->input()->urlSegment1; # Returns null @ryan Can the API Variables documentation be updated with a section / an example that explain how to use "Include & Bootstrap" for each variable (since this is a really strong feature in ProcessWire)? $page $pages - Example: $homepage = $wire->pages->get("/"); $input $sanitizer $session $fields $user $log $templates $config
×
×
  • Create New...