Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/02/2016 in all areas

  1. Aligator (wip) Processwire Module to render a nested tree starting from a single root or an array of pages. Aligator is similar to MarkupSimpleNavigation but has a different approach of how to define the markup for your menu. It doesn't assume any markup or classes. It's up to you to define them where needed. It's less plug and play and requires some more advanced knowledge of ProcessWire, as some additional setup and coding is needed. But allows for powerful and easier customization without using hooks. Aligator uses callback functions to achieve this. Additionally a selector can be used to filter the children for your navigation. Note: This module is a fun project trying to find simple configurable method to render navigations. It's a work in progress and there might be major changes to how the module works. See further infos and examples on the repository: https://github.com/somatonic/Aligator
    3 points
  2. Hello folks I have updated the code in my rest helper. Since It was created nearly 2 years ago! Now its much easier to create rest endpoints in Processwire You can download the code here. https://github.com/NinjasCL/pw-rest This is and example simple login code. $response = new Response(); $params = Request::params(); if (!Request::isPost()) { $response->setError(MethodNotAllowed::error()); } else { $username = $params['username']; $password = $params['password']; if ((!isset($username) || $username == '') || (!isset($password) || $password == '')) { $response->setError(Login\Errors\InvalidCredentials::error()); } else { if ($username == 'hello' && $password == 'world') { $response->output['data']['name'] = 'Tony'; $response->output['data']['lastname'] = 'Stark'; $response->output['data']['job'] = 'Ironman'; } else { $response->setError(Login\Errors\InvalidCredentials::error()); } } } $response->render(); Will render something similar to { "data": { "name": "Tony", "lastname": "Stark", "job": "Ironman" } } Any questions or comments are welcome
    3 points
  3. @SteveB: thanks for sharing this. Generally speaking I'd advice against a setup where the site can be accessed with both www and non-www domain – for reasons that include SEO considerations, caching, and consistency in general – but there are many situations where multiple httpHosts can (and should) be present and this kind of situation might occur, in which case it's good to keep this feature in mind
    2 points
  4. Bumping this old thread to shine some light on an obscure fact about that whitelist for domain names. Here's my story: Moved site from development server to real server. Some users (not all) reported View links sending them to the development server. Never happened to other users. Clearing browser cache did not help. Dumping DB and searching text for the development server domain name did not turn up anything. The only place I could find the development server domain name was in the config file in the array defining $config->httpHosts. Documentation calls $config->httpHosts a whitelist so I assumed I could put both the dev and real domain names in the list and maintain a single config file to use in both places. It's not just a whitelist!! The source code of ProcessWire.php explains that If you have not explicitly set $config->httpHost (note: no "s" on end) and the PHP vars for $_SERVER['SERVER_NAME'] and $_SERVER['HTTP_HOST'] don't match anything in $config->httpHosts (with "s") the getHttpHost function defaults to... "no valid host found, default to first in whitelist" The server's environment variables had the domain with www on it but the server accepts URLs with or without the www and people use either one. My dev site was the first one in the list.
    2 points
  5. I'm writing this to give back something to the community that has given so much up front over the past year. I noticed there's hardly any discussion about testing in these forums so I decided to write this quick primer to get some discussion going. I'm by no means an expert on phpunit or selenium but I had to jump through a few hoops to get it working (especially with PHPStorm), so I thought I figured I should share my experiences with the community. Also, I'm hoping non Phpstorm users can still pick something up useful in this post. Prerequisites : It is assumed Phpunit (https://phpunit.de/) is installed via Composer, Selenium (http://www.seleniumhq.org/) and Php-webdriver for Selenium (https://github.com/facebook/php-webdriver) is preinstalled. For Phpstorm users, there's a fairly detailed installation and unit testing instructions here (https://www.jetbrains.com/help/phpstorm/2016.1/testing.html) I found some parts of it leaving me with unanswered questions, so I'm hoping this post will supplement any questions that you might encounter. Rather than writing a single monolithic post, I will write several posts covering different topics.
    1 point
  6. Foundation 6 Minimal site profile for ProcessWire This profile is based on the "minimal site profile (intermediate edition)" and bundled with Foundation 6. This precompiled version can be downloaded at github. Features Foundation 6 framework Font-Awesome MeanMenu Slick Carousel (Why not Orbit ?) Render / helper functions for : Simple ul navigation Foundation Multi-level topbar MeanMenu - Responsive menu for mobile device Slick Carousel Foundation Accordion Foundation Callouts Jumbotron Dependencies jQuery How To Install Download the zip file at Github or clone directly the repo with git clone and skip the step 2. Extract the folder site-fdn6-precompiled into a fresh ProcessWire installation root folder. During the installation of ProcessWire, choose the profile "ProcessWire Foundation 6 profile". References Foundation 6 documentation ProcessWire documentation MeanMenu documentation Slick Carousel Documentation Credits The ProcessWire staff Screenshots
    1 point
  7. This week updates were focused on covering GitHub issue reports and feature requests, plus some great new performance improvements to our page traversal methods… https://processwire.com/blog/posts/pw-3.0.24/
    1 point
  8. You're not the first person to say this so there must be something to it, but that is not my experience. As a PW learner I haven't found working with modules to be a lot more difficult than working with any other aspect of PW / PHP and the docs seem pretty good to me. My experience has been that module development is challenging, but in a good way - you just get stuck in, debug issues as they arise, and ask for help in the forums when you get stuck. This makes me wonder if you are holding back from actually starting on your module while you do 'research' - I'm not sure this is the best way to learn module development and my suggestion is just make a start and learn as you go. Like many things in PW, I think you'll find it's a lot simpler and easier than you anticipate when you're on the outside looking in. Part of the problem with providing detailed documentation for something like module development is that the subject is so broad - a module can be created for any purpose and whoever is writing the docs can't know what you might want to do in your module. By analogy, it's like if you are learning to cook: you won't find much if you are searching for documentation on how to cook in general because the topic is too broad. Instead you have to decide what you want to cook and then look for help with that - how to make a chocolate cake or how to pluck a goose. Maybe you can say a bit about what you want your module to do?
    1 point
  9. No worries, I'm a frontend guy by trade so mostly functional, not class / object based programming. Hence, modules in PW or coding langauges generally are a new and obscure thing for me. Having said that, there must be "best practises" and easy ways of intereacting PW admin and site frontend etc using modules, I'm just trying to complie the resources for my own learning and to help others with future tutorials I'm hoping to write. The PW documentation is good, but when it comes to a beginners guide to modules it massively falls down
    1 point
  10. I personally haven't noticed this and hope it's not happening - the Version Switching panel in Tracy relies on these renamed folders/files being left after the upgrade. Maybe going back to old versions is not that critical for the average user, but as a module developer, it is super convenient to be able to instantly switch between versions, including the 2.x and 3.x branch. And honestly I think it can be useful for others too for helping to report core PW bugs - it makes for a very quick way to revert to previous versions to see if the problem exists there also.
    1 point
  11. Thanks for the hint. Everything is working as expected again in PW 3.0.24.
    1 point
  12. Is this still a problem with 3.0.23 since Ryan undid his earlier change?
    1 point
  13. @kixe can you upgrade to 3.0.23. A lot of modules and other stuff was broken on .22
    1 point
  14. Jeffrey Way, from the excellent Laracasts.com, just published a free series for PHP beginners: https://laracasts.com/series/php-for-beginners From the website: Jeffrey is a great teacher so if you are learning PHP, no better place you'll find.
    1 point
  15. No it's powerful and fast and dangerous ... With one "L"? It's more efficient... No I don't know your obsession. Well I don't know what MenuBuilder contents are. Why? Does MenuBuilder not have any render functions? Aligator and MSN only work with Pages.
    1 point
  16. Hey Marty, Unfortunately I never got around to finishing it - I just took a quick look at what I have and I think that rather than being a dedicated module, it might be better to convert it to an Action for ListerPro. I know that will obviously mean that you'll need a ListerPro license, but leveraging LP's ability to perform actions on just matched pages and its built-in batching will make for a more powerful and performant tool.
    1 point
  17. PW 3.0.x is very close to stable. I use it since 3.0.8 without any problems.
    1 point
  18. $page->getLanguages() was introduced in PW 3.0.21 (2.8.21). Please check your ProcessWire Version.
    1 point
  19. https://github.com/ryancramerdesign/ProcessWire/issues/1881#issuecomment-229027877 maxcolheightspacer fixed by ryan!
    1 point
  20. hi, i also think that this would be a great addition but should NOT be the only option. playing around with the jquery demo (http://jonom.github.io/jquery-focuspoint/demos/helper/index.html) i see that it would lead to problems when you only want to show a small part of the image that is located near the border of the image. i think a more advanced concept like the imagefoucsarea plugin would be better. the best would be to have the good old cropping plugin with predefined ratios and/or dimensions, have a simple focus point option and even more have a more advanced focus-area option like in the plugin linked above
    1 point
  21. I have improved this code please, check the new repo https://github.com/NinjasCL/pw-rest
    1 point
  22. Since PW 3.0.21 (2.8.21) you can use: echo count($page->getLanguages()); in your case: if (count($page->getLanguages()) > 1) { $markup = ''; foreach($page->getLanguages() as $language) { if ($language->isCurrent()) continue; $markup .= "<li><a href='".$page->localUrl($language)."'>".$language->getLanguageValue($language, 'title')."</a></li>"; } echo "<ul>$markup</ul>"; }
    1 point
  23. You need to add the checkbox in the backoffice. Then you need to do some PHP stuff. It might seem fancy, but believe me it's quite easy once you'll get a hold of this hooking stuff. Create a ready.php in your /site/ folder. Then place this: <?php // You can hook into the saving process => https://processwire.com/api/hooks/ $pages->addHookAfter('saved', function($event) { // We grab the current object (the page being saved) and store it in $page $page = $event->object; // Only run this script on training templates if ($page->template !== 'training') return; // Only run this script on empty dates if (!empty($page->training_start)) return; // Save field hasdate_checkbox and set value to checked/1 $page->setAndSave('hasdate_checkbox', 1); }); Written in browser, so not tested. But following the links provided above you will get an idea.
    1 point
  24. $markup = ''; foreach($languages as $language) { if($language->id == $savedLanguage->id) continue; if(!$page->viewable($language)) continue; $user->language = $language; // do not use $language here again $markup .= "<li class='language' style='float: left; display: inline; padding: 1em;'><a href='$page->url'>$language->title</a></li>"; } if(strlen($markup)) $markup = "<something>$markup</something>";
    1 point
  25. Update: Actually just found that there are some restrictions that are preventing me from installing the module. I'm currently in the process of discussing with admins for access. Thanks for the help!
    1 point
  26. any restrictions in the network or server your work computer is located?
    1 point
  27. Apparently the child has a higher z-index
    1 point
  28. Haven't used it now, but already like it! (have had a look to the readme!) Below an example of a root parent and a first level child:
    1 point
  29. Fieldtype Compatibility Overview doesn't work Fieldtype PageTable inside Repeater or RepeaterMatrix Fieldtype Page + 3d Party module AdminPageEditLinks inside Repeater or RepeaterMatrix works Fieldtype RepeaterMatrix inside RepeaterMatrix Fieldtype Repeater inside Repeater Fieldtype Repeater inside RepeaterMatrix and the other way round Fieldtype Page inside Repeater or RepeaterMatrix Fieldtype PageTable inside Page and the other way round @Martijn (next post) thanks, updated list
    1 point
  30. I wrote up a detailed tutorial on how to use this: https://processwire.com/talk/topic/11806-tutorial-building-a-simple-rest-api-in-processwire/
    1 point
  31. Hello friends, I have been using the wireRenderFile() function a lot. Since the inclusion of the wireRenderFile() method I made all my websites using this pattern. This is a medium post that I made explaining it. https://medium.com/@clsource/the-wire-render-pattern-806bf6d6097a?source=featured---------1 All the files will be uploaded here https://github.com/NinjasCL/wire-render-pattern
    1 point
×
×
  • Create New...