SwimToWin

Members
  • Content count

    37
  • Joined

  • Last visited

Community Reputation

7 Neutral

About SwimToWin

  • Rank
    Distinguished Member

Contact Methods

  • Website URL
    http://www.styrhjemmesiden.dk/

Profile Information

  • Gender
    Not Telling
  • Location
    Denmark

Recent Profile Visitors

2,549 profile views
  1. 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! ;-)
  2. 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
  3. It works. Thanks, much appreciated. I also have a few reflections on the workflow in ProcessWire: First of all - I am able to achieve the result. ProcessWire never lets me down.. However, getting there was a bit difficult due to a few things: (I say this in a positive spirit and as a constructive contribution to the ongoing development efforts) 1. It is unclear to me that the "Super User" role is in fact a "Web master" role. 1a. Recommendation to @ryan: Rename the "Super User" role to "Web master" to make it obvious that the super user is a co-administrator with permissions to work with a) contents and b) site structure. 1b. Recommendation: Create a default "editor" role with Permission to work with contents and users only. Adding an Editor should be as easy as adding a co-administrator. Why would I ever want to grant co-admin permissions to a customer? They can destroy the entire site structure by accident - in minutes). 2. I created a new "editor" role but granting Create and Edit permission is not possible on the "Edit Role" page. Why? "The page-add and page-create permissions can only be added from the template access settings and are shown here just for informational purposes." As a result, it is necessary to edit each of the relevant templates and specify role access (hard!). 2a. Edit Role page: Editor was allowed to "create pages" - but that is not enough to add pages in "sections" (/foo-section/new-page). Granting the "add children" access permission was also needed. 2b. Recommendation: Administration of each Role should be possible from the Edit Role page (/processwire/access/roles/edit/?id=1234&s=1&c=1). I hope these observations and enhancement requests make sense and will prove usable in future development effors. And again, thank you for your quick reply and guidance.
  4. In my world, Super Users / Editors should only be able to work with Pages and administer users. Everything else is the domain of the web master. The purpose is to prevent technically inexperienced editors from destroying core elements of a site, such as fields and templates. That leaves me with the question, how to deny Super Users access to Setup, Modules and Roles / Permissions? PS: May I also suggest that it shall be possible to set Permission for each of the main menu items - including their sub-menu items.
  5. Hi Robin S, FYI - There is a simple way to get support for array_chunk in WireArrays, it's described here: https://processwire.com/talk/topic/17324-array_chunk-support/ I am posting this in the hope that you and others will find it useful..
  6. While ProcessWire and WireArray does not have support for array_chunk, there is a simple way to achieve this. With array_chunk() you can easily add DIVs to a foreach loop, without having to set up counters when using general PHP (hat-tip to Laurance over at StackOverflow). The idea in a ProcessWire context is to use array_chunk() to split an array into chunks - and use eq() when looping page results. Simple example that will split a WireArray into three columns. Before we begin, you should know the array_chunk syntax: array_chunk($array, $chunk_size, $preserve_keys=true|false). <?php $p = $pages->get('/news')->children('limit=15, template=article, sort=-sort'); ?> <div class="row"> <?php foreach (array_chunk(range(0,14),5) as $chunk): ?> <div class="col"> <?php foreach ($chunk as $i): ?> <h5><a href="<?=$p->eq($i)->url?>"><?=$p->eq($i)->title?></a></h5> <?php endforeach; ?> </div> <?php endforeach; ?> </div> A more realistic example: <?php $p = $pages->get('/news'); $pp = $p->children('limit=15, template=article, sort=-sort'); ?> <h2><a href="<?=$p->url?>"><?=$p->title?></a></h2> <div class="row"> <?php foreach (array_chunk(range(0,14),5) as $chunk): ?> <div class="col"> <?php foreach ($chunk as $i): ?> <h5> <a href="<?=$pp->eq($i)->url?>"><?=$pp->eq($i)->title?></a> </h5> <?php endforeach; ?> </div> <?php endforeach; ?> </div>
  7. How can I translate the admin buttons that are shown when mousing over a page in the admin interface ("Edit", "View", "New", "Move", "Unpub", "Hide", "Lock", "Trash")? The site uses the built-in Language Support module. I am here: /processwire/page/. I looked for files to translate in the Languages setup section (/processwire/setup/languages/edit/?id=1234), so far unsuccessfully because I was not able to identify a file to translate.
  8. @Soma You may be right that the request is beyond "simple navigation". It's a cool module and has worked well for me in many other projects. I have created a plain Processwire solution that supports dropdowns and multi-language using Bootstrap 4 markup, will post it when time allows.
  9. After 7 days no reply? @kongondo Noted
  10. Issue posted in separate topic (to prevent this topic from becoming too long): MarkupSimpleNavigation - Navigation menu with dropdowns in Bootstrap 4
  11. I want to create a navigation menu with dropdowns in Bootstrap 4 (ProcessWire 3.0.62 and MarkupSimpleNavigation v1.3.4). This was possible in Bootstrap 3, but I have yet to see it work with Bootstrap 4. CODE - FAILS (Bootstrap 4) <ul class="navbar-nav mr-auto mt-2 mt-lg-0"> <?php $treemenu = $modules->get("MarkupSimpleNavigation"); echo $treemenu->render([ 'max_levels' => 2, 'show_root' => false, 'parent_class' => 'active', 'current_class' => 'active', 'has_children_class' => 'dropdown', 'outer_tpl' => '<ul class="nav navbar-nav">||</ul>', 'inner_tpl' => '<ul class="dropdown-menu">||</ul>', 'list_tpl' => '<li%s>||</li>', 'list_field_class' => 'nav-item', 'item_tpl' => '<a href="{url}" class="nav-link">{title}</a>', 'item_current_tpl' => '<a href="{url}" class="nav-link">{title}</a>', 'code_formatting' => true, ], $page); ?> </ul> OBSERVED OUTPUT: <ul class="navbar-nav mr-auto mt-2 mt-lg-0"> <ul class="nav navbar-nav"> <li class="active dropdown nav-item"><a href="/foo/" class="nav-link">Foo</a> <ul class="dropdown-menu"> <li class="nav-item"><a href="/foo/bar/" class="nav-link">Bar</a></li> <li class="nav-item"><a href="/foo/baz/" class="nav-link">Baz</a></li> </ul> </li> <li class="dropdown nav-item"><a href="/alfa/" class="nav-link">Alfa</a> <ul class="dropdown-menu"> <li class="nav-item"><a href="/alfa/beta/" class="nav-link">Beta</a></li> </ul> </li> </ul> </ul> EXPECTED OUTPUT (GOAL): <nav class="navbar navbar-expand-md navbar-dark bg-dark"> <a class="navbar-brand" href="/">EnormiCorp</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <ul class="navbar-nav mr-auto mt-2 mt-lg-0"> <ul class="nav navbar-nav"> <li class="active dropdown nav-item"><a href="/foo/" class="nav-link">Foo</a> <ul class="dropdown-menu"> <li class="nav-item"><a href="/foo/bar/" class="nav-link">Bar</a></li> <li class="nav-item"><a href="/foo/baz/" class="nav-link">Baz</a></li> </ul> </li> <li class="dropdown nav-item"><a href="/alfa/" class="nav-link dropdown-toggle" id="dropdown1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Alfa</a> <ul class="dropdown-menu" aria-labelledby="dropdown1"> <li class="nav-item"><a href="/alfa/beta/" class="dropdown-item">Beta</a></li> </ul> </li> </ul> </ul> </nav> CODE - WORKS (Bootstrap 3) <div class="navbar"> <div class="container"> <?php $treemenu = $modules->get("MarkupSimpleNavigation"); echo $treemenu->render([ 'max_levels' => 2, 'levels' => false, 'show_root' => true, 'parent_class' => 'active', 'current_class' => 'active', 'has_children_class' => 'dropdown', 'outer_tpl' => "<ul class='nav navbar-nav vertical-align-bottom'>||{$editlink}</ul>", 'inner_tpl' => '<ul class="dropdown-menu">||</ul>', 'code_formatting' => true, ], $page); ?> </div> </div> See also: https://getbootstrap.com/docs/4.0/components/navbar/ https://getbootstrap.com/docs/4.0/components/dropdowns/
  12. @Mike Rockett & Soma: The reason for processing the form outside PW is that it's part of a 3rd party booking system using an external database. I have the following enhancement request for the module: "It shall be possible to include plain PHP pages ("/foo/bar.php") from third party plug-ins and the like to MarkupSimpleNavigation. Suggested solution is to allow adding in-memory pages to the navigation entries on the fly. The purpose of adding in-memory pages is to place the 3rd party page in PWs Page structure. Something along these lines: $p = new Page(); $p->setOutputFormatting(false); $p->parent = $pages->get("/MyParentPage"); $p->template = "SomeTemplate"; $p->title = "External page"; $p->name = "external_page"; // Note I do not use $p->save(), so it's a pseudo page that exists in memory only. // Add the page to $entries somehow [...] -> $entries = $pages->get("/")->navigation_entries; .... $entries = $pages->get("/")->navigation_entries; // Load entries (including our new page) echo $treeMenu->render(null, null, $entries); (Perhaps this is already possible without making changes to the module?) Right now, I will go ahead and 1) make a unique template for the form that "include()" the form from a PHP file, 2) add a PW page for the form and 3) repeat this process for all relevant files (4 times in total per site using the booking system). I can then output a link and title to the page using MarkupSimpleNavigation. (I have done this before, it's a bit cumbersome but it will work.)
  13. Hi Soma, I need to use plain PHP pages ("/foo/bar.php") to a website powered by ProcessWire. How can I add this in Markup Simple Navigation? Sample structure that shows the mix of Processwire pages and PHP pages in use: ProductsProduct 1 Product 2 Product 3 Request quote <- Quote form in plain PHP. References About us
  14. > Posted 06 December 2012 - 04:42 PM > Updating this tutorial very soon, its horrible and incorrect The update newer happened. I suggest this post is deleted.
  15. I find that editors with low web skills have difficulties working with the ProcessWire Admin interface. I am here talking about users who rarely write text and with low web skills. Also, my customers are Danish but see the ProcessWire Admin interface in English -- they are not all comfortable working in an English user interface (I can fix this in part by adding fields in Danish). The main reason for the usability challenges is that users are forced to work in the tree structure in the ProcessWire Admin interface as it is today. The Page tree can be hard to comprehend when getting back to Admin after 2 months or more. Below I offer observations on what I have seen customers do in the user interface, and based on that I suggest how usability may be improved. Note, this post is written in a positive spirit with the intention to improve ProcessWire. Observed user behavior 1. New pages. Users incorrectly place new pages at root level when they correctly should have been placed in - say - the "News" section. Observed behavior: Users log in to Admin, immediately see the "New" link and create a new page. The link is incorrectly being placed at root level. Correct behavior: Users log in to Admin, click "News", click "new" (next to "News"). Training users in doing the right thing is also hard. It is hard to explain users to: "1) log in to Admin, 2) click "News", 3) click "new" (next to the News link)." As a possible workaround, I can lock down the content types that can be created from the root level, but in my view that should not be stricly necessary. 2. Overview. Users find the admin interface hard to understand when getting back to it after 2 months. Some of the questions users (and me too) ask themselves are: "What can I do here?", "Under which section (segment1 nodes) should I add my new Product or Event?" Possible workaround: The web designer can spend time writing a guide, but I guess most would prefer that the admin interface answered the question "What can I do here?" -- possibly with a written instruction. 3. Clutter in the tree structure. As a web designer I have to store categories andother system nodes in a tree structure that is visible to end users. I create a "Value lists" node and put pages that I use in different Select boxes in other pages -- editorial users really don't need to see these "Value lists" in the main view. Better: Move system information to a secondary area as in many other CMSes (see suggestion 3 below). 4. User error risks. Users can mess up the entire site structure if they start moving around with root-level pages. For instance, Navigation will suffer when using the Simple Navigation module. Also entire sections can be deleted / moved by editors. Suggested Solutions 1. Buttons. As a web designer it would be nice to have the option to create "buttons" on the admin start page (/processwire/page/). Example Buttons: "New Article" - clicking the button will create a new page of type "Article" and place it under a specified parent page ("/articles"). "New Event" "New Product" "New Solution" "New Employee" 2. Apps. Pretend that the website contain many "apps". As a web designer I can create such "apps" in Admin. Apps can be as simple as a shortcut in a menu (right menu as seen here). 3. "Site system trees". The Page tree contain two very different types of data. The first is content, the next is "system nodes". I would like to move the "system nodes" to one or more "site system trees". As a web designer I can create a "system tree" for the site that contain non-content nodes. A link to the "site system tree" can be placed in the admin navigation (Pages, Setup, Modules, Access). Access to "system trees" can be restricted. My "system tree(s)" would contain information such as: Blocks Snippets Menus Site settings Search Admin 404 Page Not Found Trash PS: How do I create "Admin apps" in the Admin left menu (as in this example)?