SwimToWin

Members
  • Content count

    38
  • 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,670 profile views
  1. SwimToWin

    @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.
  2. SwimToWin

    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! ;-)
  3. 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
  4. 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.
  5. 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.
  6. SwimToWin

    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..
  7. SwimToWin

    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>
  8. 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.
  9. SwimToWin

    @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.
  10. SwimToWin

    After 7 days no reply? @kongondo Noted
  11. SwimToWin

    Issue posted in separate topic (to prevent this topic from becoming too long): MarkupSimpleNavigation - Navigation menu with dropdowns in Bootstrap 4
  12. SwimToWin

    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/
  13. SwimToWin

    @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.)
  14. SwimToWin

    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
  15. > 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.