Jump to content


Popular Content

Showing content with the highest reputation on 01/21/2015 in all areas

  1. 8 points
    New year, new site online http://schutzbelueftung.de/ This time industry client, they build ventilation systems for diggers, earth movers and stuff like that. Pretty interesting. English version is in the works, should be ready by march. This is the second page featering my pagetable extended module, with which the client can easily build an individual layout out of predefined layout elements. That means: Everything on the site is filled by the client, all images and text. One special thing is the database of their installations: http://schutzbelueftung.de/aufbaubeispiele/ Here you can filter by company, type field of application. This is done by ajax in the background, so easy to build with the PW selectors <3
  2. 6 points
    since everyone is trying to make themes based on their own wishes and needs, I tried to have a view from our clients: what do they really need? how often? what should they see and what not...? so I ended up with a really clean theme. the trash page will not be shown in the page tree. I'll move it in the right bottom corner. some footer informations are not necessary to be visible all the time (eg. pw version, copyright). I want to hide them behind a button. I often see people looking for a "back button" because they don't want to use the browser back button (don't know why - maybe just my view?). some ideas for other features (like custom colors)? let me know what you think. thanks
  3. 4 points
    -------------------------------------------------------------------------------------------------------------------------------- for PW 3.0+ please follow this link! -------------------------------------------------------------------------------------------------------------------------------- Croppable Image Module for PW >= 2.5.11 and PW <= 2.7.3 Version 0.8.3 alpha Hey, today I can announce an early (alpha) release of CroppableImage, what was forked from Anttis Thumbnails module. Until now there was a lot of work done by owzim, Martijn Geerts and me. We have solved the issues regarding the list from here: The modules are bundled together so that you only can and have to use FieldtypeCroppableImage for install, uninstall & configure. It uses new naming scheme that was introduced with PW 2.5.0 that supports suffixes. The complete image rendering is delegated to the core ImageSizer, or to any optional hooked in rendering engine. Template-settings are now fully supported, including removing variations when settings have changed. It fully respects settings for upscaling. If upscaling is set to false, you cannot select rectangles smaller than the crop setting. We implemented these enhancements: The GridView now is very nice and compact, and also benefits from the lately introduced setting for $config->adminThumbOptions. Permanent storage of the crop coordinates, quality and sharpening settings are now implemented native. No need to use PiM for this anymore. The usage/display of the Quality and Sharpening DropDown-Selects can be globally disabled/allowed in the modules Configpage. (additionally to that a setting on a 'per field base' is planned.) And the most wanted feature by the community: It gives back a pageimage and not the URL-string. This way you can use it like this: // get the first image instance of crop setting 'portrait' $image = $page->images->first()->getCrop('portrait'); You can further use every pageimage property like 'url', 'description', 'width' & 'height' with it: // get the first image instance of crop setting 'portrait' $image = $page->images->first()->getCrop('portrait'); echo "<img src='{$image->url}' alt='{$image->description}' />"; And you can proceed further image rendering with it: // get the first image instance of crop setting 'portrait' and proceed a resize with imagesizer $image = $page->images->first()->getCrop('portrait'); $thumb = $image->width(200); // or like this: $thumb = $page->images->first()->getCrop('portrait')->width(200); // and if you have installed Pia, you can use it here too: $thumb = $page->images->first()->getCrop('portrait')->crop("square=120"); The only downside with this is that when you (as the site developer) have enabled the usage of DropDown-Selects in the images editor, you do not know the values the editors have chosen for the images. As a workaround for this you can use the getCrop() method with a second param. This is a PW selector string. It can contain as many of the known pageimage options like 'quality', 'sharpening', 'cropping', etc, as you need, but none of them is required. But required is at least one setting for 'width' or 'height': $image = $page->images->first()->getCrop('portrait', "width=200"); $image = $page->images->first()->getCrop('portrait', "width=200, height=200, quality=80"); $image = $page->images->first()->getCrop('portrait', "height=400, sharpening=medium, quality=75"); . . You can get the module from GitHub: https://github.com/horst-n/CroppableImage (Better Docs are coming soon) Screenshots Related Infos A good setting in site/config.php for the AdminThumbs are: (height=>200 and scale=>0.5 !) $config->adminThumbOptions = array( 'width' => 0, 'height' => 200, 'scale' => 0.5, 'imageSizer' => array( 'upscaling' => false, 'cropping' => true, 'autoRotation' => true, 'sharpening' => 'soft', 'quality' => 90, 'suffix' => array(), ) );
  4. 4 points
    Hi, Another way to do this is to use subselectors, which were introduced in Processwire 2.5. The code would then be: $pages->find("parent.id=[pagefield1.pagefield2.field=value]"); I love subselectors...
  5. 3 points
    Okay, so I've actually decided to rename the module to ProcessJumplinks. I prefer it. https://github.com/mike-anthony/ProcessJumplinks Hit counter is done. Still need to work on importing from Redirects module - I'll do that tomorrow as I'm super-tired now. I don't think I'm going to make this compatible with the current stable (2.5.3). If you really want me to, please let me know. Will also work on docs soon - though my intro post covers a lot. Nice to have docs, however.
  6. 3 points
    I see. Yes that's somewhat different to what WireArray does, but you're way is fine then. You can add your own method to PageArray using hook then instead of a new class. wire()->addHook("WireArray::addUnique", null, function($event){ $item = $event->arguments(0); if($item instanceof WireArray){ foreach($item as $p){ if(!$event->object->has($p)) $event->object->add($p); } } else { if(!$event->object->has($item)) $event->object->add($p); } }); $pa = new PageArray(); $pa->add($pages->find("template=basic-page")); $pa->addUnique($pages->get("/about/")->children); $content .= $pa;
  7. 3 points
    @ESRCH That login code will throw error if you login 3 times with wrong credentials... I already tried to put a note in those various (dozens already and lost track of) threads that use this "exact" frontend login code, which works but has one flaw. Problem is that once the login throttle kicks in you're left with a exception error. It's not obvious and I think posting that code in the forum over and over just creates problems in the long run for everyone copy paste such code. Funny thing is that the code originally is from Ryan himself. Either Ryan should change the behaviour of the throttle code or you need to use this code instead with a try catch to catch the login throttle error: if ($user->isLoggedin()) { $session->redirect($pages->get('/')->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; try{ $u = $session->login($username, $password); if ($u) { if ($redirectUrl = $session->get('redirect')){ $session->remove('redirect'); $session->redirect($redirectUrl); } else { $session->redirect($pages->get('/')->url); } } else { $error = "Wrong username or password. Login failed."; } } catch(Exception $e){ $error = $e->getMessage(); } }
  8. 3 points
    One last attempt to suggest using the api, then I'm gone Instead of changing your source data, you can let the API create the pages for you when needed. So for a (simplified) table like this: Bibliography Type Document Title ----------------- ---------------------- Book Interesting Book 1 Book Interesting Book 2 Magazine Fascinating Magazine 1 .... you could use the following code, which automatically creates the pages for you function getBibliographyType($name) { $template = 'bibliography-type'; $parent = $pages->get('/bibliography-types/'); static $bibliographyTypes = array(); if (isset($bibliographyTypes[$name])) { return $bibliographyTypes[$name]; } else { // Create the bibliography-type page $p = new Page(); $p->template = $template; $p->parent = $parent; $p->name = wire('sanitizer')->pageName($name); $p->title = wire('sanitizer')->text($name); $p->save(); // Save bibliography type id for future calls, avoiding calls to the database $bibliographyTypes[$name] = $p; return $p; } } $f = $page->import_file->filename; $csvDelimiter = ','; $csvEnclosure = '"'; $templateName = 'Document'; $parent = $pages->get('/documents/'); while (($data = fgetcsv($f, 0, $csvDelimiter, $csvEnclosure)) !== false) { $bibliographyType = getBibliographyType($data[0]); $title = $data[1]; $p = new Page(); $p->template = $templateName; $p->parent = $parent; $p->name = $sanitizer->pageName($title); $p->title = $sanitizer->text($title); $p->bibliography_type = $bibliographyType; $p->save(); }
  9. 3 points
    Your method seems secure enough. You are after all not sending a 404, so your user already knows that the url that they originally requested exists. Another method is to use the session to store the redirect url. So in the restricted page you would do: if (!$user->isLoggedin()) { // Store requested url in the session, then redirect $session->set('redirect', $page->url); $session->redirect($pages->get('template=login')->url); } and on the login page you could have // Edit: This code is not correct as-is, please note Soma's post below including the try-catch block around the login code! <?php if ($user->isLoggedin()) { $session->redirect($pages->get('/')->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; if ($session->login($username, $password)) { if ($redirectUrl = $session->get('redirect')){ $session->remove('redirect'); $session->redirect($redirectUrl); } else { $session->redirect($pages->get('/')->url); } } else { $error = "Wrong username or password. Login failed."; } }
  10. 2 points
    Check your image's fields Input Tab and tick checkbox at 'Overwrite existing files?' Since version 2.5.1
  11. 2 points
    Peter, I've added a lot of custom fields to my blog-post template, so my template file for the blog post itself is going to have a lot of calls to the fields listed for the template so that I can't rely on the module to output everything I want in the way that I want. It should be totally possible, and the module has a lot of other features that make it worth my while (multiple authors, the dashboard, etc). Unless you're stripping even more off the blog than just the template output for the individual posts, I think I'd stick with using it. My 2¢!
  12. 2 points
    @Peter Knight I can confirm that Kongondo's example gist works no problem. Can easily add mark up to the necessary parts of the function. In my case I've added divs to suit bootstrap. No problem. And if you wanted to create separate markup for a single post you could either do it with a separate function or with a conditional statement within the renderPosts() function.
  13. 2 points
    I find it easier to manage these things in a module like this. Also you need to use a before hook, as saving the page with the new title after saving would trigger an infinite loop. See next posts <?php /** * ProcessWire 'Hello world' demonstration module * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class PutYourNameHere extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => '', 'version' => 1, 'summary' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('Pages::saveReady', $this, 'doStuffOnPage'); } public function doStuffOnPage($event) { $page = $event->arguments[0]; if($page->template->name === "blog_page" && $page->blog_categories == "Swatch"){ // Do your thing } } }
  14. 2 points
    There's a really great and simple example given by ryan here that can help you understand. In your case, you should be able to do the following (not tested): $pages->addHook('saveReady', function($event) { $sanitizer = wire('sanitizer'); $pages = $event->object; $page = $event->arguments(0); if($page->template == 'blog_page' && $page->blog_categories == 'Swatch') { // You can build the string as you wish, here is an example $concatenatedName = $page->blog_date; $concatenatedName .= '-' . $page->createdUser; $concatenatedName .= '-' . $page->blog_brand; $concatenatedName .= '-' . $page->blog_name; $page->title = $concatenatedName; $page->name = $sanitizer->pageName($concatenatedName); } });
  15. 2 points
    I’m not exactly sure if that’s what you want, but if you just want to generate a bunch of nested <ul>s, you should recursively travel around the page tree. Something like: function siteMap(Page $root) { $out = "<li>{$root->title}"; if ($root->hasChildren) { $out .= '<ul>'; foreach($root->children() as $child) { $out .= siteMap($child); } $out .= '</ul>'; } $out .= '</li>'; return $out; } Uuuuh… at least I think that should work. Untested It should give you the complete branch starting at whatever you plug into $root. edit: Actually. Something is bound to be wrong with this. And you need to supply the outer <ul> yourself. edit: Tested it. Fixed it because it was stupid.
  16. 2 points
  17. 2 points
    Nice idea, but I would personally go for a dedicated table for this. Perhaps you could steal some ideas from teppo's ChangeLog module: http://modules.processwire.com/modules/process-changelog/
  18. 2 points
    In the "Extra Allowed Content" section on the Input tab of your field's settings, add the following: span{!color} That will allow span tags so long as the color style attribute is set. You can get more details here: http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules-section-2 If you want to allow span tags no matter what attributes they have, then use this: span[*]{*}(*)
  19. 2 points
    Hello, all! Sorry if this should be in another forum, but I didn't see one for general introductions, testimonials, and the like. I actually don't need help yet (the documentation and existing forum threads have already been immensely helpful), but I am just finishing up my first project using ProcessWire and felt the need to come here and say thanks. I've been designing/developing websites for several years now, and this is by far the most intuitive CMS I've used...from both a development and end-user standpoint. I just showed my most recent client the backend a couple of days ago and he was amazed at how easy it was for him to update content. So, thank you!
  20. 2 points
    Welcome chadamas, I've been using PW since late 2011, and I don't think about CMS's anymore. I suspect you will never look back.
  21. 2 points
    Haha, sorry about that. I knew that title was misleading, but used it anyway! Wordpress more than anything else, but I've tried several over the years. Drupal and Joomla (of course), CMS Made Simple, Textpattern, a couple of flat-file systems...for two projects I even built a basic CMS on top of forum software (SMF and MyBB). I think my search might be over, though. Thank you all for the warm welcome!
  22. 1 point
    Inputfield Page Source Display a string with the rendered output of the Page (per it's Template) in an Inputfield. The markup could be copied with a button click (flash enabled browsers) and/or copied manually from the Inputfield. The rendered output is a runtime only value which is not stored in the database. Potential Use Provide an easy way for editors to copy the sourcecode of the page for the use in newsletter services and such. Note ! This Inputfield should not be used in the page template directly. (could give some “funky” results ) Download on GitHub
  23. 1 point
    Hi Folks, today we will learn how to set up a simple jquery plugin called calendario and fill events trough our admin backend. || ATTENTION || Modern Browser needed First of all, we need the jquery plugin. Grab your copy here: http://tympanus.net/...alendar-plugin/ Now create a new template file, lets call the file calendar.php In the next step we have to include all the needed files from the .zip package. You need the following .css files: calendar.css custom_2.css demo.css Just include them in the <head> </head> of your template file. Feel free to merge them together, so you could save some http connects. Now we need to include the needed javascript. Make sure you have included the latest jQuery library. Include the jquery.calendario.js and the modernizr.custom.63321.js right into the bottom of your template file. Save the calendar.php Now we will set up Processwire where the magic wil happen. We just need one new template. Create a new template called calendar. Assign the field headline to our template. Allow children to just use this template. Hit the save button. Now create a new Page as child of home and call it Calendar. Assign our calendar template to this page. Almost ready. Now we have to do some little scripting in our template file calendar.php Add this html markup to our calendar.php <div class="custom-calendar-wrap"> <div id="custom-inner" class="custom-inner"> <div class="custom-header clearfix"> <nav> <span id="custom-prev" class="custom-prev"></span> <span id="custom-next" class="custom-next"></span> </nav> <h2 id="custom-month" class="custom-month"></h2> <h3 id="custom-year" class="custom-year"></h3> </div> <div id="calendar" class="fc-calendar-container"></div> </div> </div> Now we have to call the javascript function, to get the calendar running. Just put this snippet right under the included jquery.calendario.js <script type="text/javascript" $(function() { var transEndEventNames = { 'WebkitTransition' : 'webkitTransitionend', 'MozTransition' : 'transitionend', 'OTransition' : 'oTransitionend', 'msTransition' : 'MSTransitionend', 'transition' : 'transitionend' }, transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], $wrapper = $( '#custom-inner' ), $calendar = $( '#calendar' ), cal = $calendar.calendario( { onDayClick : function( $el, $contentEl, dateProperties ) { if( $contentEl.length > 0 ) { showEvents( $contentEl, dateProperties ); } }, caldata : { <?= getEvents(); ?> // this is our function to grab our events }, displayWeekAbbr : false } ), $month = $( '#custom-month' ).html( cal.getMonthName() ), $year = $( '#custom-year' ).html( cal.getYear() ); $( '#custom-next' ).on( 'click', function() { cal.gotoNextMonth( updateMonthYear ); } ); $( '#custom-today' ).on( 'click', function() { cal.gotoNow( updateMonthYear ); } ); $( '#custom-prev' ).on( 'click', function() { cal.gotoPreviousMonth( updateMonthYear ); } ); function updateMonthYear() { $month.html( cal.getMonthName() ); $year.html( cal.getYear() ); } // just an example.. function showEvents( $contentEl, dateProperties ) { hideEvents(); var $events = $( '<div id="custom-content-reveal" class="custom-content-reveal"><h4>Termine am ' + dateProperties.day + '. ' + dateProperties.monthname + ' ' + dateProperties.year + '</h4></div>' ), $close = $( '<span class="custom-content-close"></span>' ).on( 'click', hideEvents ); $events.append( $contentEl.html() , $close ).insertAfter( $wrapper ); setTimeout( function() { $events.css( 'top', '0%' ); }, 25 ); } function hideEvents() { var $events = $( '#custom-content-reveal' ); if( $events.length > 0 ) { $events.css( 'top', '100%' ); Modernizr.csstransitions ? $events.on( transEndEventName, function() { $( this ).remove(); } ) : $events.remove(); } } }); </script> We are almost finished, but we are missing some very essential, have a look to our javascript. We are calling a function named getEvents() This function will grab our events and fire it right to our calendar. So here is the code: function getEvents() { $events = wire('pages')->get("/calendar/")->children(); foreach ($events as $event) { echo "'$event->title' : '<span>$event->headline</span> ',"; } } Put this snippet above the javascript includes. We will now create our first entry. Go back to the PW admin backend and create a Child of Calendar. Title and name need the Date on which the event has to be displayed. You have to form a date in this format: mm-dd-yyyy e.g. 12-27-2012. The headline field is our Event description. Hit the save button, go to your site and enjoy your event calendar. With a little coding you could extend the calendar to let it look like mine attached as screenshot. Hope this was useful to somebody. Cheerio.
  24. 1 point
    This module creates a blank dashboard page in your site admin and sets it as default when you login instead of the page list. It came from a need in a few projects where I was creating modules for various user roles to use and I didn't want them to see the page list at all, but needed to display various stats and quick access buttons. For example, if you have a person who is creating invoices or doing other back-office stuff in various other Process modules then as an admin you wouldn't want them to access the page tree anyway, and there are other scenarios where you might want to have a dashboard instead of launching straight into the page list. It also requires (and adds) a permission - "dashboard" - so you can create new roles and assign the dashboard permission to those roles - something you might want to do fairly commonly if you have a lot of admin modules that you want to restrict access to. Editing the template is simple - there is a dashboard.php template file in the /site/modules/ProcessDashboard/ folder (decided to leave it in there to keep it safe, but I might be tempted to move it into /site/templates/ ) as well as .js and .css files ready to add your code to. You can use the API as you usually would to create your dashboard experience. For example, display data based on user roles or even specific users using code like this: if ($user->hasRole('invoices') { echo "Hi staff member $user->name. View invoices to be processed below: ... ..."; } if ($user->name == 'pete') { // Show some super-awesome stuff here } You can also do away with the dashboard.php template file and edit the module directly, putting your code and output in the execute() function (the way most Process modules are written) but I decided to include the separate template file to make it easier for more people to use. This does touch on areas a few other modules have addressed to some degree (like diogo's Custom Admin Pages) but this is designed for one purpose - instant dashboard creation. You can download the module here: http://modules.processwire.com/modules/process-dashboard/ This module also uses code from diogo's ProcessHomeAdmin module so that the default admin page can be overridden.
  25. 1 point
    I'm happy to announce that the official ProcessWire Developer Directory has been launched at http://directory.processwire.com It comprises a developer list and a map and is designed to allow anyone developing with ProcessWire to find each other. It also allows potential clients to find developers as well as illustrating how widely ProcessWire is used worldwide. The developer list displays in random order so as not to favour any one developer and is currently quite short, but it should grow nicely as you create your own profiles. The login process is linked to your ProcessWire forum account so the same details you use to login here will allow you to get started. There is a manual approval process as well as some rules so that we can ensure that the directory contains quality content and is free of spam. As a minimum, developers must have 10 posts here on the forums before they can login and post a profile, however after that there are relatively few restrictions - as long as you follow the guidelines on the Profile form and abide by the Terms and Conditions (a condition of submitting a profile) you will be fine. You may notice small icons/badges next to some developers - these are designed to recognise special contributions to the ProcessWire project and are awarded by staff as part of the approval process. Whilst checking each entry's content we cross-check against forum profiles, the modules directory and other sources to determine which badges apply to a developer. There are plans for more features over time which you can be notified about by checking the box at the end of the profile form. I look forward to seeing your profiles soon!
  26. 1 point
    2.5.3 is the stable version, so this should be included even there.
  27. 1 point
    What I do often is taking the hooked method name and put before or after before that name. This way I don't have to think about a name (laziness) and I can see when or if the method derived from a hook. In this case I would have chosen afterSaveReady.
  28. 1 point
    If you would like to add this to the modules directory I can add your Module Developer badge over at the dev directory.
  29. 1 point
    You should maybe echo something, just to check whether the function gets called at all. Also a dumb question, but have you installed the module that you are developing?
  30. 1 point
    This is fantastic Martijn, thanks so much for creating it. Just set it up for exactly the purpose you mention - creating an html email based on content coming from PW. Well done!
  31. 1 point
    You need to add the hook in the init function as you can see it done in my first post here. The thing you're writing there is a class, these can only hold properties and functions and not raw code, like you did. It's only there to provide functionality, which can be called later. The init function of a module is always called on loading the module.
  32. 1 point
    Okay, should be better now. Thx you both!
  33. 1 point
    Seems really fast here. I'll take a longer look later, but looks/feels really nice so far. Great work as always!
  34. 1 point
    Oh, OK, in over my head then Thanks for the reply anyway!
  35. 1 point
    Ah, I see your class already does the same thing. So yeah, either way to get what you need. Seems easy enough to do in the template.
  36. 1 point
    after years working on PW it's always a bit difficult get in mind all the new stuff inside new versions, but it's a pleasure of course
  37. 1 point
    New additions arrived in April 2014 https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=58722 (grouping) https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=64049 (or-groups and sub-selectors) And are now documented here: http://processwire.com/api/selectors/ (but still missing grouping) OR-groups: matching one group of selectors or another Sub-selectors: selectors within selectors
  38. 1 point
    Well, PageArray is already unique. Considering this example, you'll end up with 1 entry in PageArray: $pa = new PageArray(); $pa->add($pages->get("/about/")); $pa->add($pages->get("/about/")); echo $pa;
  39. 1 point
    Something like this. Only 3 FieldSetTabOpen. For Category A we just rename 'Content' to something else in the template blog-post advanced settings. Category A Category B Category C Category D
  40. 1 point
    Look at my selector, my selector is amazing ( ): $favorites = $user->favorites->find("sort=title, private=0, start=".$start.", limit=".$limit); Favorites is Page field with settings: Multiple pages (PageArray). Private is an checkbox on every page which are listed on favorites. My test user has two(2) favorite pages. One public and one private. And it works great! Thanks bye! Wait.. I had a problem with this code: $favorites->getTotal(); I'm in the belief that this should return the amount of pages based on the selector excluding limit-selector. So the result should be one(1). But I'm getting two(2). Am I missing something or is this a bug? Even this one gives me two: $favorites = $user->favorites->find("sort=title, private=0"); echo $favorites->getTotal(); # 2 What I want is the total number of favorite pages. This of course works: $user->favorites->find('sort=title, private=0')->count(); But I would like to avoid making several finds if I could use ->getTotal. And why I can't do this? Because I'm using start/limit for pagination..
  41. 1 point
    Maybe it is this: http://processwire.com/api/arrays/page/
  42. 1 point
    Not directly related to your question, but if your tag list is getting too long, it might be useful to activate the "Page Auto Complete" module from Core, which allows you to type in the tags that you want to add, instead of clicking through the list. I find this much easier when I have long lists of tags. Using this module, an approach that I often use for tagging is the following: Create a "tag" template with only a title field Create a "Tags" page under which you will put all the tags Create a "tags" Page field with the following options:Multiple pages allowed Parent of selectable pages: Select the "Tags" page created previously Template of selectable pages: Select the "tag" template Input field type: Select "PageAutoComplete" Check the "Allow new pages to be created from field" option Now, when entering tags, you can type in the name, if it exists already you an select it, otherwise press "Enter" and the tag will be created automatically.
  43. 1 point
    This is a really great idea. Thanks Pete!
  44. 1 point
    I've run into long waits for thumbnails too on a site where some frontend pages have up to a couple hundred thumbnails from rather large source files. I'm also using tiny thumbs in the backend page lists. In normal operation with template caching and routine editing it's fine but during setup it was insane. I wrote a script which uses the API to see which variations are not made yet and make them. Before turning it loose you can use assess method to just get a report. Returns a handy array to use in other processing scripts. It's alpha, not gift wrapped and polished, but I can make it available somewhere if anybody wants it. Example of usage below. This puzzles me: While my script is building images all other PW activity pretty much grinds to a halt (that's not the puzzling part) but other pages on the site using PHP/MySQL independent of PW continue to work just fine. They use a different database so maybe some db lock/transaction thing is holding things up? $fab = new imagePrefab(); $fab->background = 1; //don't make browser wait $fab->verbose = 1; //Yes we want some feedback... $fab->setLog(); //...in a log file $ok = $fab->setBuilderCallback('buildImageMyWay'); //optional callback function if(!$ok)die(" Callback function not found at ".__LINE__); $data = $fab->build('my-template', 'image', array(array(48,48),array(110,110),array(800,0)));
  45. 1 point
    I added two config options: Including not only visible pages: optional, include all hidden and unpublished pages and pages that user doesn't have access to view Multiple Output: optional, multiple selection (using ASMSelect) Field settings: Select Lists: (settings above -> first one)
  46. 1 point
    Hi adrianmak, This seems to be a bug, I submitted a pull request to correct this. The problem is that when logging out, the user is changed to guest, and the language is set back to default. Interestingly, the $user variable still points to the logged out user (adrian in your case), while wire('user'), which is used by the __() translation function, points to guest. While waiting for the correction to the core, you can solve this issue by adding the following line after $session->logout(): wire('user')->language = $user->language; This will set the language back to what it was before logging out, and the correct translation will be shown.
  47. 1 point
    Thanks! It would be great to have a link of the developer page to the forums member page and if the developer created some modules the reference as well. (And I miss my module author icon )
  48. 1 point
    Hi Cerulean, echo "<p>{$page->bibliography_type->title}</p>"; Should do the trick. The number you were getting it the page ID of the selected item. This should give you the title. Can you attach more of your code so we can have a closer look? Maybe there's a typo somewhere?
  49. 1 point
    Had to do this yesterday. But this works only on the newest dev version of processwire, because Ryan just implemented the removeTab() method. Older versions will still show the tab, but no actual form to delete something. <?php /** * ProcessWire 'Hello world' demonstration module * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class RemoveDeleteTab extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'RemoveDeleteTab', 'version' => 1, 'summary' => '…', 'singular' => true, 'autoload' => true, ); } public function init() { // Remove Settings Tab in Global settings for non superadmins $this->addHookAfter('ProcessPageEdit::buildForm', $this, "removeDeleteTab"); } public function removeDeleteTab(HookEvent $event){ // check what role the user has, if superuser do nothing if($this->user->isSuperuser()) return; $page = $event->object->getPage(); if($page->template->name === "settings"){ $form = $event->return; $fieldset = $form->find("id=ProcessPageEditDelete")->first(); $form->remove($fieldset); $event->object->removeTab("ProcessPageEditDelete"); $event->return = $form; } } }
  50. 1 point
    So I spent some time fiddling around with this tonight and managed to get modal editing of page field pages working with the addition of just a few lines of code in InputfieldPage.module: InputfieldPage.module The modified file is attached. I commented the lines that I added with /* MJS 1/15/15 */ You'll want to put this file into /site/modules/ so you don't overwrite the core. Once it's up there, you should see an option in the field config settings for your page field that says 'Allow pages to be edited from field?' Check the box. This only works if you're using ASMSelect with your page field. The catch is that you have to save the page before the modal edit links become available (like when editing fields in the template editor). I think the only way around this would be to significantly re-engineer the ASMSelect inputfield with some AJAXy stuff. Not my strong suit. EDIT: There is a module for this now with more features. Use it instead! https://processwire.com/talk/topic/9857-module-page-field-edit-links/
  • Create New...