Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/19/2013 in all areas

  1. Hi everyone, I made a walkthrough of a web app I built using ProcessWire for the Tenova Group mining company. They needed an intranet application to keep track of their daily plant operations. I designed and developed a ProcessWire solution that would allow registered employees at Tenova HYL to record events regularly in an event log. Storing all of the events in this manner would allow registered users to find the events they're looking for using keyword search, date filters as well as filters based on other criteria. Each event also allows the user to upload supporting files for download, such as Word documents and PDFs, as well as upload relevant images to be displayed in a modal window. A high-performing, powerful solution using the ProcessWire CMS. Read about the project here in my portfolio. See the video here: Tina Holly tinaciousdesign.com
    8 points
  2. I thought I'd start this thread so we could all share our favorite debugging techniques. The idea for this came from this post by Soma: http://processwire.com/talk/topic/4416-delete-user-when-page-is-deleted/?p=43320 and some of the followups with other suggestions. Here's one that I find really useful. It allows you to output content to the browser's console from PHP. It sends content from PHP through javasacript's console.log(); Not as powerful as FirePHP etc, but simple and easy to use. Put this function somewhere that it will be available to all your template files. function debug ($data) { echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}"; $output = explode("\n", print_r($data, true)); foreach ($output as $line) { if (trim($line)) { $line = addslashes($line); echo "console.log(\"{$line}\");"; } } echo "\r\n//]]>\r\n</script>"; } Then you can simply put these anywhere in your templates: debug('test'); debug($variable); debug($array); This keeps your page content clear of debug messages and is easier then looking in log files, like if you were to use error_log() What are your favorite techniques?
    5 points
  3. When I need a quick info of assigned values I use a better readable version of var_dump: <?php /** * Original script from Stefan Eickhoff, 05.12.2002 * URL: http://aktuell.de.selfhtml.org/artikel/php/variablen/ * * @shortdesc output a better vardump. $outputMode: 1=Browser; 2=Commandline-Window; 3=StringVar; 4=file; * **/ function my_var_dump($v, $outputMode=2, $filename='') { // Ausgabe von var_dump ueber Output-Buffer in Variable einlesen ob_start(); var_dump($v); $content = ob_get_contents(); ob_end_clean(); // maximale Einrueckung ermitteln $m = 0; preg_match_all('#^(.*)=>#mU', $content, $stack); $lines = $stack[1]; $indents = array_map('strlen', $lines); if($indents) $m = max($indents) + 1; // Ausgabe von var_dump() an maximaler Einrueckung ausrichten $content = preg_replace('#^(.*)=>\\n\s+(\S)#eUm', '"\\1" .str_repeat(" ", $m - strlen("\\1")>1 ? $m - strlen("\\1") : 1). "\\2"', $content); // bei Array-Strukturen oeffnende Klammer { in neue Zeile $content = preg_replace('#^((\s*).*){$#m', "\\1\n\\2{", $content); // pre tags entfernen $content = str_replace(array('<pre>','</pre>'),'',$content); switch($outputMode) { case 1: // Output to Browser-Window echo '<pre style=" margin: 10px 10px 10px; padding: 10px 10px 10px 10px; background-color:#F2F2F2; color:#000; border: 1px solid #333; font-family: Lucida Console, Courier, monospace; font-size : 12px; overflow: visible;">'.$content.'</pre>'; break; case 2: // Output to Commandline-Window or to Browser as hidden comment echo isset($_SERVER['HTTP_HOST']) ? "\n<!--\n".$content."\n-->\n" : $content."\n"; break; case 3: // Output into a StringVar return '<pre style=" margin: 10px 10px 10px; padding: 10px 10px 10px 10px; background-color:#F2F2F2; color:#000; border: 1px solid #333; font-family: Lucida Console, Courier, monospace; font-size : 12px; overflow: visible;">'.$content.'</pre>'; break; case 4: // Output into a file, if a valid filename is given and we have write access to it //return $this->string2file(str_replace(array('>','"',' '), array('>','"',''), strip_tags($content)), $filename, true); break; } }
    2 points
  4. HTML5 specs are different. In HTML5 it's allowed to wrap block level elements with links. this is valid: <a href='/link/to/page.html'> <div> <h1>I'm</h1> <p>Allowed</p> </div> </a>
    2 points
  5. $time = Debug::timer(); echo Debug::timer($time); and my ChromePhpLogger ? module
    2 points
  6. You maybe wan't to look into the debug.inc that comes with the admin theme /wire/templates-admin/debug.inc and counting queries is kinda pointless, the type of queries are important.
    2 points
  7. continue here: http://processwire.com/talk/topic/1041-raydale-multimedia-a-case-study/ http://getsymphony.com/discuss/thread/79645/
    2 points
  8. If you are converting from WP to PW you should look at Ryan's case study here: http://processwire.com/talk/topic/3987-cmscritic-development-case-study/
    2 points
  9. Small world . Nice to know that the book was helpful, thanks. Well, I think I can say with utmost confidence that I'll never get you excited about another CMS . It's hard to imagine anything better than PW; I haven't found it and am not looking either . David, welcome to awesomeness! aka PW .
    2 points
  10. I've written a module that fulfils a small but hopefully useful need to provide clients with links to "live" but work-in-progress pages so they can be viewed by those that don't have a CMS login. The basic process is to add a "create draft" link to the page listing (after edit, new, move, delete etc). When clicked, this link creates a clone of the page and adds an MD5 hash of the current time to the URL so that a draft clone with an effectively "un-guessable" URL (name) is created that can be given out to clients to view the page. This clone has a "publish" link added to it in the page listing so this can then be copied over the original published page, and the draft deleted, with one click. The cloned pages also has "(DRAFT)" added to the title. Does this sound useful to anyone? The only problem is that, because the "draft" page is published it will show up in menu listings and anything else that is utilizing the site structure or API to grab live pages. If the "published" nature of the cloned pages makes this idea unworkable then I will go back to the drawing board! But if it has potential to be useful then I will at the very least publish the source on github or copy it in here so it can be tampered with by others. It occurs to me that it wouldn't be hard to filter out these pages with "(DRAFT)" at the end of the title so they don't show up in menu listings etc, but this would require extra effort on the part of the developer in every case where the fetching of pages is occurring.
    1 point
  11. I'm currently trying/learning out knockoutjs. http://knockoutjs.com/. A while ago I tried backbonejs which is also very nice but more complicated than knockoutjs. I found the tutorial kinda cool and just wanted to share here. Maybe something like this could be done for ProcessWire Check it out: http://learn.knockoutjs.com/ To try it out and learn I started a Process Module for creating a bunch of pages. So far it's very nice and I will share very soon. Through not sure if it would be a to be officially released module or not. It now looks like the screen. You can choose a parent page, then it will enable "add" button and provide templates that are allowed to use (regarding family setting) or all templates that can be used. After creating the set of pages the button "create pages" will be enabled and you can create them, once done you'll see a list with a link to the parent and the pages you created.
    1 point
  12. Hi globi, It's not a good idea to have your posts as repeater. Why? Scaling. After a certain number of posts, you'll get problems with repeaters, because Pw has to load them all. Maybe you're already facing this problem? I'd suggest to write a script which loops through your repeater posts and add them as single pages. Cheers
    1 point
  13. Hello Apeisa. How do you do the routing with angular, for example? angular.module('phonecat', []). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/phones', {templateUrl: 'partials/phone-list.html', controller: PhoneListCtrl}). when('/phones/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}). otherwise({redirectTo: '/phones'}); }]); with ng-view <html lang="en" ng-app="phonecat"> <head> ... <script src="lib/angular/angular.js"></script> <script src="js/app.js"></script> <script src="js/controllers.js"></script> </head> <body> <div ng-view></div> </body> </html>
    1 point
  14. I think Soma makes a good point with his last sentence - many well-crafted queries can work far quicker than one cumbersome query. Plus the technology has moved on so much in recent years that your server shouldn't really strain under lots of queries. Also, there are many caching options for ProcessWire to cut some of those out (MarkupCache for select lists etc, ProCache to serve a static version of your site and other solutions as well).
    1 point
  15. template != template file (usually html & CSS) You need one template, call it "babysite". Then load site specific CSS when needed and in some case probably site specific HTML too. This is very straightforward and we are here to help. on mobile atm, would provide code examples otherwise.
    1 point
  16. Firstly, you need to make the name of the checkbox field an array by appending [] echo "<input type='checkbox' name='type[]' value='{$t->id}'>{$t->title}<br>"; Then take a look at Ryan's example: http://processwire.com/talk/topic/3061-how-to-save-field-page-type-checkbox/?p=30229
    1 point
  17. If I understand your code correctly, $input->post->type will be an array (http://php.net/manual/en/language.types.array.php), consisting of 0 or more selected Sale Type id's, so you'll need to foreach through them at each stage of processing the form input.
    1 point
  18. No worries, that's pretty much what I already do. Unless a block of code is instantly understandable to me, I generally recode anything that goes into the core so that I can fully understand and comment it. That's why it sometimes takes me awhile to bring in PRs. But since I've got to support the code in the future, I figure I need to go through the process.
    1 point
  19. It's still a work in progress at the moment Tyssen and I'm on holiday now until the beginning of October so it won't be ready for a while unfortunately.
    1 point
  20. Thanks for the feedback on that - sounds like you have a better solution anyways! In case you, or anyone else misses the note in the edited first post, it is now available from the modules directory: http://mods.pw/5R Thanks again Martijn for all your help testing this - much appreciated!
    1 point
  21. The multi language input can get very easy out of sync when the list of added children is long. I think when you're building a multi language site it's saver to to just foreach the already created list (childpages) with custom code and provide for every (each) translation a input field. ( easy the write from your template ) I love the module how it is now. I think you shouldn't overcomplicate it. <adrian>PS Excuse the dodgy google translations</adrian> I google it all the time, I can't even write
    1 point
  22. Xeo - generally most of us would recommend that in a situation where categories can change that you might instead put an article for Milton under articles/milton and create your list of categories separately and tag Milton against different categories. This way it doesn't matter if the categories change or become more complex later on, the article is still under articles/milton and the categories can change as much as you like (in your example Milton could be tagged in the poetry category to begin with, but also under all of the child categories (american and revival in your example) later on so that you have lots of articles listed in the parent category of poetry and the list becomes more refined the further down the categories you go. Basically that way you're not breaking any URLs and can tag things easily in multiple categories - for example if you moved Milton to poetry/american/revival/milton but then had a category called poetry/poets and wanted milton under there too you would have a problem, so best to put the article itself under something like articles/milton instead and associate the articles with the categories separately so you can have that multi-category relationship going on.
    1 point
  23. Thank you for the quick response kongondo, exactly what I was needing - works great.. Btw, kongondo, you were the one who initially got me excited about ModX after I got a handle on Wayfinder using your tutorial. The fact that you're here now is a confirmation that PW is the new game in town
    1 point
  24. Hi flyerdave, Welcome to PW and the forums. PW "template files" are nothing more than HTML interspersed with some PHP to output the dynamic content. There are various ways to convert that theme for use in PW. One way is just to copy the output HTML by viewing source in your browser. Then, you would strip that of all dynamic content and remain with the skeleton HTML. Maybe you could also do this directly from the WP theme PHP files but am not sure. It has been a while since I looked at WP themes. All I remember is that they are a nightmare! I highly doubt you will need all those 25 PHP files in PW! After this, you will have to decide how to output those dynamic content of your site. Those would either be whole pages or fields of certain pages. I would say converting the theme for use in PW should be the least of your worries. You should instead concentrate, in my humble opinion, on learning the basics of PW. In order to make best use of the system, you will have to know some very basic PHP. Have a look at the following topics in the docs: http://processwire.com/api/variables/ http://processwire.com/api/selectors/ http://processwire.com/api/templates/ This will require some work and willingness to learn on your part beyond the point and click common in other CMS. On the other side, great rewards and total freedom await you if you are willing to overcome this initial hurdle
    1 point
  25. Hi David, See this thread and Diogo's response...it should get you on your way... http://processwire.com/talk/topic/3133-detect-first-and-last-sibling-page/
    1 point
  26. Scaling should happen on later time, on template level I think. (Don't mess up the originals) code for your template: $images = $page->images; // assumed that the field called images if(count($images)) { foreach($images as $image) { $width = $image === $images->first ? 600 : 200; $thumb = $image->width($width); echo "<img src='{$thumb->url}' alt='{$thumb->description}' />"; } } This should work, didn't test it.
    1 point
  27. Hi everyone, The new website of my company Omnitic is finally launched! Initially started in Wordpress, it was finally built on Processwire with Gumby Framework as i wanted a real use case to practice my "wiring". I must say that i'm pleased with the final result and how fast it was to get this up and running with Processwire. For a extra speed boost ProCache has also been used to make the overall experience as fast as possible : if you build website with Processwire and don't use this module, you're doing it wrong. There's still some tweaking to be done though (image optimization, some responsive issues to name a few) Regards and happy wiring. Nicolas
    1 point
  28. That was easier than imagined: $progetti = $pages->find("parent=$parent, user=$user->id");
    1 point
  29. thanks Ryan, I will implement this solution and let you know about performance
    1 point
  30. OK, fair enough. If I find some more info about this issue I'll post it here but for now I just have put pressure on ISP to update their MySQL.
    1 point
  31. Hi Chaps, First of all: thank you all ever-so much for getting back to me! There's a mountain of great advice from each of you for me to start working through, and I really do appreciate it. I had started to get a sense that ProcessWire was accommodating of various development methods, and it's actually quite refreshing to find a framework which *doesn't* enforce a strict development methodology. Suffice it to say, I'm looking forward to getting stuck in to developing my little test application to figure out which method here best suits my needs. You guys have been great. Thanks again for all the input! Cheers!
    1 point
  32. Thanks, Ryan! That was exactly what was needed--and now I know what the little gear sign next to a module name is for
    1 point
  33. pls disregard this altogether. I decided to do it "the PW way", and use sub-categories (sub-pages) instead. First of all, it looks more clean in the backend, and I don't have to construct over-complicated queries anymore. The import process via CSV takes now 2 more steps, but that's OK. i.e. 1. Create sub-category "container" pages 2. Create the pages 3. Move pages to their containers With my initial idea the import process would have been a lot easier, but I like a clean content overview in the backend... and I guess my client too Is there a way to do something like a GROUP / DISTINCT when I don't know the actual value? I have plenty of products in the same page-hierarchy, and one field is product_type_group. Several pages can share the same value. I'd like just to get the first one and skip the others. I already have a dozen product group within "products", but within these I'd prefer not to create another hierarchy level. I know how I'd do in without API methods, but I wanted to know if miss a special selector / API function.
    1 point
  34. Once again - simple and elegant. Thanks, Ryan! Awesome. I guess my mind is still living in a framework/CMS world where everything needs to be constrained and complicated. ProcessWire lets you breathe.
    1 point
  35. I'm using this feature quite a lot. Here's an example of creating a indented list for using with checkboxes, selects. IT creates a new PageArray and modifies the "title" to indent, and here with a (count) used in the context of the categories to see how many products are under that category. $children = $pages->get("/shop/")->children(); $list = new PageArray(); function mylist($children, $ind='', $arr){ $ind .= "– "; foreach($children as $cat) { $countproducts = wire("pages")->find("template=product,categories=$cat")->count(); $cat->title = $ind . $cat->title . " ($countproducts)"; $arr->add($cat); if($cat->numChildren) { mylist($cat->children,$ind, $arr); } } return $arr; } return mylist($children, $ind='',$list); This will produce something like –– Gewürze (0) –– –– Kräuter (27) –– –– Kräutermischungen (7) –– –– Einzelgewürze (0) –– –– –– Anis (2) –– –– –– Blaumohnsaat (1) –– –– –– Bockshornsamen (2) –– –– –– Chili (16) –– –– –– Glutamat (1) –– –– –– Galgantwurzel (3) –– –– –– Ingwer (4) –– –– –– Kardamom (4) –– –– –– Knoblauch (5) –– –– –– Koriander (2) –– –– –– Kurkuma (2)
    1 point
  36. Hi davo, What kind of users can add events? If you have editors that are creating the events for the website, I'd suggest to use the ProcessWire backend. It's really simple (clicking the "new" button under the events parent page). If your visitors (guest users) can post events, you could do it with a form in the frontend. It's straightforward - I'm sure if you give us some more informations there will be answers here with sample codes. As for the datepicker: You can use any Javascript date-picker in your frontend template. Depending on the complexity of the form, there's also the great FormBuilder module Cheers
    1 point
  37. Hmmm, think I have it. Got the feeling it was to do with the path part of setcookie, Ryan's tip to have a look in Chrome was a good one, the path was getting set for that page only and just specifying "/" didn't work, I had to add null to the domain part as am on localhost setcookie("InfoBar", $info_bar, time()+3600, "/", null);
    1 point
  38. It's possible to use <repeater-name>.<field-in-repeater> as a field name. For example: $matches = $pages->find("title|my_repeater.my_field~=$q");
    1 point
  39. The problem is that line above. You are calling $session->logout(); rather than providing a URL to logout. Since you are calling the logout() function, it is logging them out. What you want to do instead is link to some other page that logs them out. Something like this: <li><a href="./?logout=1">Logout</a></li> Then in your template file, or header include, or anywhere before you output anything, you'd want to check for that URL: if($input->get->logout) $session->logout();
    1 point
×
×
  • Create New...