Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/23/2013 in all areas

  1. Just in case anyone was wondering why I've been silent for the last week, it's because I've been away on vacation, so have a lot of catch up to do here (didn't have internet access while I was gone). Just got back last night, and it seems my hands have to re-learn how to type. When I click on "view new content" I have 9 paginations of unread messages–ouch. This is probably going to take me a week to get through, especially with the Christmas holiday here. But I've been anxious to get back into the swing of things here and looking forward to getting focused on PW 2.4 now. Because I'm behind on the messages here, if there is anything urgent that you know of waiting on me, please reply or PM me and I'll make sure to get those right away. Thanks to all of you for taking good care of the forum while I was gone. Also Merry Christmas / Happy Holidays to everyone.
    9 points
  2. Hey all, just wanted to share with you the new Milktop website http://www.milktop.co.uk/ (powered by PW of course). This comes to life as the result of merging Milktop with ED DESIGN ( the design company of Diogo, who you all know and love and his partner Erika, a fantastic graphic designer). It's been great to work with this new team, and we hope that you guys will like the website as much as we have enjoyed creating it A few notes on how we accomplished some things: For the grid we used Bourbon Neat. We wanted to try out this framework since it doesn't make impact at all on the markup. We're pretty happy with the result, but in the end we feel like we didn't save that much time by using it than if we would have used simple SASS variables or created our own mixins. For the icons we used Fontello. This is great because it allows you to create a new font with your own set of icons from several sources, and even add some custom built icons by importing a SVG drawing. One advantage is that the final font only has the icons that you put there, which makes it a very small download. We decided to use large images to display our work in the best way possible, but we're serving smaller images for smaller screens. We do this by serving the smaller size by default and swapping the image for a larger version by measuring the container element : <img data-large="<?php echo $img->url; ?>" src="<?php echo $img->width(400)->url; ?>"> For speed we are using the excellent ProCache module by Ryan For publishing automatically to Twitter and Facebook we plan to (not done yet) publish a RSS feed with Ryan's RSS module and use IFFFT to pull it into both social networks. If you don't know IFFFT, you should definitely check it out. A final detail, our logo is designed in HTML and CSS Hope you guys like it and thanks again to the great ProcessWire community without whom this collaboration would never have happened. Have a great evening.
    4 points
  3. Hope you had fun! Happy Easter
    4 points
  4. Had a good vacation ? Got your batteries charged now for a while. Ok, meanwhile processwire still going strong, found a new job and upgraded my php skills and oh yes 2 pw forces joined each other in Milktop. Good to have you back Ryan.
    3 points
  5. Hi! Here is my second work on PW: one page promo site for super mega cool strut mounts (some car stuff). www.ss20gold.com - ProcessWire 2.3.7 - multilingual; // pm me, if there are funny/wierd mistakes, please - scroll-scroll; - animated gif reincarnation; - about 50 times of Massive Attack - Heligoland in process. Thanks all of you, you guys are rock!
    2 points
  6. It's not necessary here, as ProcessWire doesn't include the http host with url() calls... just the path. So you can prepend the http host yourself, or make a custom function to do it for you. For example, you make an uppercase "URL" property to refer to your own version: wire()->addHookProperty('Pagefile::URL', function($event) { $event->return = "http://www.domain.com" . $event->object->url; }); Usage: <img src="<?=$page->image->URL?>">
    2 points
  7. I work on multiple devices, ranging from phones (rarely) and tablets (not so rarely) to desktop machines. Having everything properly set up no matter what device I start (and no matter whether I've ever even used it before) is cool. I'm also most productive when I don't have to spend time adapting to new environment every time I start different machine, so having a consistent experience would definitely be a big plus. Personally I've solved most of these by having everything set up server-side, making browser and SSH client (and, though that's apparently going to change pretty soon, Photoshop) only things I really need to start working and be productive. Nevertheless I can see why some people might not like that and would actually prefer some horrible mouse-driven graphical IDE and other similar productivity killers.. From company's point of view, on the other hand, this just makes sense; not only does it make new kind of collaboration possible (like Joss already pointed out) and (theoretically) even make moving people from one project to another a breeze, it can also decrease costs of each new employee. No more high-end Macs, pricey IDEs and self-hosted complicated environments when all you need is couple of cheap thin clients and web-based, monthly billed app. That, and the (sad) fact that when that environment is developed far enough your employees don't really even need to know what's happening behind the scenes (Git, whatsthat?) when everything just magically works. Lower requirements when hiring new people often equal lower salaries.. and each new guy takes shorter time to learn the ropes and start being productive. I could list a dozen or so other benefits, but I think this pretty much summarizes it
    2 points
  8. offtopic @Soma, break compatibility would make your color picker better. Now your field always need some extra logic. You can't just output $page->color, because of the max length of 6 characters. example: "<div style='color: #{$page->color};'>"; can render to <div style='color: #transp;'> I do love this field, but the extra logic sucks. Please break the backward compatibility.
    2 points
  9. Take a look at ryan's example, it's basic but works.
    2 points
  10. Love it all. Love the favicon and jealous of it's clarity—congrats!
    2 points
  11. It's fixed for info: we had a grayscale filter on the css for those images that was causing the weird behaviour. For now we only removed it because we don't need it anymore, but later I will investigate why. Thanks guys!
    2 points
  12. I can reproduce what Peter Foeng has found with Firefox on windows desktop: images on the about page only show up after resizing the window. With Cometbird browser, even after resizing the window, images do not show up. With Opera browser the images show up ok.
    2 points
  13. Very nice! The images on the about page do not show on desktop version (running firefox 25 windows) but when I resized the window they show up
    2 points
  14. These should also work (on dev): // save directly from page object $page->save(array('quiet' => true)); // save just 1 field from page object $page->save('myfield', array('quiet' => true)); When quiet mode is set, the modified date is set to whatever is specified in the page. Meaning, the modified date is not updated unless you change it yourself. Quiet mode also lets you modify the modifedUser and createdUser for the page, if you want to. These are two properties you can't usually modify, but quiet mode lets you do it.
    2 points
  15. You can even make columns with fieldsets. Tabs and fieldsets are just special fields you create that are actually two fields one for open and one for closing. PW creates the closing *_END automaticly. You then add them to the template and wrap fields with them. You also only need to add the opening fieldset/tab field and after saving PW will automaticly attach the _END field too. I'm surprised so many people miss them, as they are also in the field dropdown when creating fields. FieldsetOpen, FieldsetTabOpen.
    2 points
  16. Template Notes Adds a "Help" tab to pages for notes and instructions on the current template used. You can add content by simply putting a html or markdown file in /site/templates/notes/ the module will automatically load that file if it finds one and adds a "Help" tab to the page edit form. Name the files using the template name. You can use html or markdown to write the help text. - /site/templates/notes/[tplname].html - /site/templates/notes/[tplname].md To style the content you can specify a custom css file url you add to the module settings. http://modules.processwire.com/modules/template-notes/ https://github.com/somatonic/TemplateNotes This module was quickly written after seeing a wish-list request by Joss http://processwire.com/talk/topic/5016-help-tab-for-template/
    1 point
  17. Here are some API additions to the dev branch, primarily for WireArray/PageArray/etc. I've found these very handy lately, and would have on almost any project I worked on, so decided they'd add value to the core. I'll add these to the cheatsheet once 2.4 replaces 2.3, but for now, here they are. The examples here use PageArray, but note that these API additions apply to any WireArray derived type, not just PageArray. WireArray::implode() Implode all elements to a delimiter-separated string containing the given property from each item. Similar to PHP's implode() function. Usage: $string = $items->implode([$delimiter], $property, [$options]); Arguments: $delimiter - The delimiter to separate each item by (or the glue to tie them together). May be omitted if not needed $property - The property to retrieve from each item (i.e. "title"), or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. [$options] - This argument is optional. When used, it's an array with modifiers to the behavior: skipEmpty: Whether empty items should be skipped (default=true) prepend: String to prepend to result. Ignored if result is blank. append: String to prepend to result. Ignored if result is blank. Examples: $items = $pages->find("template=basic-page"); // render all the titles, each separated by a <br>, for each page in $items echo $items->implode('<br>', 'title'); // render an unordered list of each item's title echo "<ul><li>"; echo $items->implode('</li><li>', 'title'); echo "</li></ul>"; // same as above, but using prepend/append options, // this ensures no list generated when $items is empty echo $items->implode('</li><li>', 'title', array( 'prepend' => '<ul><li>', 'append' => '</li></ul>' )); // same as above, but with all items now presented as links // this demonstrates use of $property as a function. note that // we are also omitting the delimiter here as well, since we don't need it echo $items->implode(function($item) { return "<li><a href='$item->url'>$item->title</a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); WireArray::explode() Return a plain array of the requested property from each item. Similar to PHP's explode() function. The returned PHP array uses the same keys as the original WireArray (if that matters). Usage: $array = $items->explode($property); Arguments: $property - The name of the property (string) to have in each array element (i.e. "title"). You may also provide a function/closure here that should return the value to store. When a function/closure is used it receives the $item as the first argument and the $key (if needed) as the second. Examples: // get an array containing the 'title' of each page $array = $items->explode('title'); // get an array containing the id, url and title of each page $array = $items->explode(function($item) { return array( 'id' => $item->id, 'url' => $item->url, 'title' => $item->title ); }); WireArray::data() Store or retrieve an arbitrary/extra data value in this WireArray. This is exactly the same thing that it is jQuery. I've personally found this useful when building search engines: the search engine can store extra meta data of what was searched for as a data() property. Then any other functions receiving the WireArray/PageArray have access to this additional info. For example, the search engine portion of your site could populate an array of summary data about what was searched for, and the render/output code could render it to the user. Usage: // Setting data $items->data('key', 'value'); // Getting data $value = $items->data('key'); // Get array (indexed by key) of all data $values = $items->data(); Arguments: The above usage section explains all that's needed to know about the arguments. The only additional comments I'd make are that 'key' should always be a string, and 'value' can be anything you want it to be. Example: function findSkyscrapers() { $floors = (int) wire('input')->get->floors; $year = (int) wire('input')->get->year; $items = wire('pages')->find("template=skyscraper, floors=$floors, year=$year"); $items->data('summary', array( 'Number of floors' => $floors, 'Year constructed' => $year )); return $items; } // the render function can focus purely on output function renderSkyscrapers($items) { echo "<h2>You searched for:</h2>"; // render the summary of what was searched for foreach($items->data('summary') as $label => $value) { echo "<p>$label: $value</p>"; } echo "<h3>Skyscrapers found:</h3>"; // note use of new implode() function, though a foreach() would be just as well here echo $items->implode(function($item) { return "<p><a href='$item->url'>$item->title</a></p>"; }); } WireArray::and() WireData::and() Return a new copy of the WireArray with the given item(s) appended. Primarily as a syntax convenience for various situations. This is similar to jQuery's add() and andSelf() functions, but I've always felt "add" implied adding something to the original rather than creating a new combination, so went with "and" in this case. The term "and" is actually a reserved word in PHP, so you can't usually have a function named "and()", but through the magic of hooks, ProcessWire can. This function should reduce the instances in which you'd need to do "$a = new PageArray();" for example. Usage: // create a new WireArray with $items and $item (appended) $myItems = $items->and($item); // create a new WireArray with $items and $moreItems (appended) $myItems = $items->and($moreItems); // create a new WireArray with $items and $item (prepended) $myItems = $item->and($items); // create a new WireArray with $item and $anotherItem (appended) $myItems = $item->and($anotherItem); // create a new WireArray 4 items $family = $pappa->and($mamma)->and($brother)->and($sister); Examples: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } // check if page or its children has a featured checkbox if($page->and($page->children)->has("featured=1")) { echo "<p>Featured!</p>"; }
    1 point
  18. Hi All, First of all a big "THANK YOU!" to the community of ProcessWire and its founding father! It has been a great adventure developing this site with ProcessWire, allowing me to focus on getting things done! http://www.goaroundeurope.com On thing that was great, for me and for the site owners is the widget system I created. I used Pagefields for including a multitude of widgets that the site-owners place on pages in the site. They can create their own widget too and reuse them throughout the site. ProcessWire not only helped me during development, but the backend is very user friendly for the site owners. This was one of the major factors I considered when choosing the platform to build this site on. I only have to develop it once (and maintain/extend it ofcourse), but they have to use it day in day out....
    1 point
  19. I must say that I agree with both views here; what Martijn described is definitely a nuisance and I really wouldn't mind if Soma decided to change it, but it also feels that it's just wrong (and inconsistent) to have fields behave in different way when used in module settings context
    1 point
  20. Congratulations ! Onjegolders & Diogo Site's looking great, hope the same for the business !
    1 point
  21. Unread forum posts - one of the worst things after returning from holiday! Hope you and the family had a great time, and welcome back
    1 point
  22. I started playing with these things about a year ago and sort of got bored. It seems to be solving a problem that doesn't quite exist, at least for the lone worker. I can see more advantages for collaborative projects, but then, things like GitHub seem to work pretty well for those - at least it allows separate experimentation and then pulling successful elements together. Personally, I still use an old PC as a dev server with Virtualmin and Samba on it, and I have just added WD My Cloud to the home network (which is accessible from the web) for other bits (There is a 4-bay, raid version now for people that want extra safety). That way I can hop around editors and IDEs as I fancy, Also, the faster everyones connections are, the less of a pain it is sending stuff to clients rather than archiving centrally somewhere for them. It seems that clients always manage to have problems with things like Own Cloud or Ajaxplorer, however carefully I set them up. Often easier to either email something or just bung a zip up on my server.
    1 point
  23. I keep misreading the subject of the thread as "New Milktops webiste and BAND" Which sort of puts a whole new spin on the project. When you auditioning for musicians?
    1 point
  24. You guys hooked up? Like a ProcessWire marriage? I must have missed that one. Good luck on the new business! Great work on the website. Looks really, really good.
    1 point
  25. I just went ahead and did what I wanted to do since a long time. Yesterday at this time there was nothing. Now there's this: http://soma.urlich.ch/ My old portfolio, taking dust, is gone for good! Now I have new shiny blog. Starting with zero, this took a couple hours to setup a complete custom blog. I'm still working out details here and there and adding new stuff I still want to. But what I need and wanted is there now roughly. Some things used in this ProcessWire site: - ModulesManager (of course) - Hanna Code - Repeaters (for the inline code snippets added to content by some Hanna code) - Rainbow JS for the highlighting (http://craig.is/making/rainbows/) - PW Comments Core module - RSS Feed Core module - Markup Twitter Feed (http://modules.processwire.com/modules/markup-twitter-feed/) - Pocketgrid (there's no good grid system other than this http://arnaudleray.github.io/pocketgrid/) - FontAwesome Icon Font No frameworks used except PW. I hope I'll find time to write some things about web dev in general and ProcessWire. Hope you step by now and then.
    1 point
  26. It looks like you are using http_build_query to build a query for $pages->find(). That's something you'd use to insert a query string in a URL, but it's not something you want to use for a selector. Instead, you'd want to sanitize selector values with $clean = $sanitizer->selectorValue($dirty); Though if you've already sanitized something as an (int) then it's not necessary to run it through selectorValue. For your 'sort' you'd want to setup a whitelist of valid sorts and validate against that. Rather than doing a "die()", I suggest doing a "return;" so that you pass control back to PW rather than terminating execution. To find only modified products since a particular date, you can include that in your find() query. Perhaps the client can specify "modified" as a variable to the web service. If they specified it as a date string like "yyyy-mm-dd h:m:s" then you can sanitize and convert it to a timestamp with $date = strtotime($str). Then use "modified>=$date" in your selector. To find which pages were deleted, the client usually identifies this by the non-presence of an item that used to be there. I also like to sometimes setup a separate "exists" feed that the client can use to test their IDs against. For instance, the client might query domain.com/path/to/service/?exists=123,456,789 and the response would be handled with something like this. It returns an array of TRUE for each queried page that still exists, and FALSE for pages that no longer exist. if($input->get->exists) { $dirty = explode(',', $input->get->exists); if(count($dirty) > 200) throw new WireException("You may only check up to 200 at once"); $ids = array(); foreach($dirty as $id) { $id = (int) $id; if($id) $ids[$id] = false; // set as not exists (default) } $results = $pages->find("template=product, id=" . implode("|", $ids)); foreach($results as $result) { $ids[$result->id] = true; // set as exists } header("Content-type: application/json"); echo json_encode($ids); }
    1 point
  27. You're welcome. It takes some time to get used to the 'simple' way of thinking, but after a while you see the greatness of the simplicity and you build all kinds of this stuff. Do not hesitate to ask more questions.
    1 point
  28. That is caused by Session Login Throttle. With code below you can force Session Login Throttle to delete the entries. And make the account work again. $u = $users->get('admin'); $u->of(false); $u->pass = 'type-in-your-pass'; $u->save(); just throw it somewhere in you template, and call it with a browser visit.
    1 point
  29. I'm not shure but it was something like: $pages->save($page, array('quiet' => true));
    1 point
  30. Sorry to talk shop down the pub (as it were) but I just did something simple that made editing much nicer This is something that perhaps lots of us already do but I didn't. I rearranged my templates so the Body (and Sidebar if you have one, so the main content edit areas) are first in the template. Now when I create a new page I have to scroll down once to name it (subtitle it, whatever). But every other time I open it to edit copy the fields I from that point on almost always need are at the top I was just so glad I'd realized my mistake in not doing this until now I just had to share... Right, as you were and back to proper pub talk.
    1 point
  31. You do know you can make tabs and close a field as well?
    1 point
  32. Stop me if I'm wrong, but does the stockist template only apply to one page? If that is the case, you need to create a stockist.php template file which will load when you browse to that page with something like the following code: <?php foreach ($page->store_middle as $store) { echo "<h5>$store->store_name</h5>"; echo "<p class='less_padd'>$store->store_address</p>"; } However, if you have more than one page using the stockist template then something like this would work: <?php foreach ($pages->find("template=stockist") as $stockist) { foreach ($stockist->store_middle as $store) { echo "<h5>$store->store_name</h5>"; echo "<p class='less_padd'>$store->store_address</p>"; } } What I have noticed is that you mentioned _left and _middle in your code, so that might be causing an issue too. You also hadn't closed your opening <p> tag which might be hiding some content perhaps? Hope that helps.
    1 point
  33. Maybe I don't understand what you're saying The halfsuperuser should be created in roles, not in permissions. Every role can have a multitude of permissions you want. You can set give access at Template level.
    1 point
  34. Take a look at Hanna Code module, it does exactly what you described above.
    1 point
  35. If you like, please check out our latest project powered by Processwire: http://www.gasthaus-stuhlmacher.de/ A small website to the well known Restaurant Gasthaus Stuhlmacher in Muenster, Germany. It is one the oldest restaurants in town with a long tradition and a great historical background. Processwire is absolutely stunning! It is just unbelievable how fast and clean we are able to develop our projects. The backend is so easy to use. All of our customers are in love with it too. Especially the ones who are coming form Typo3, Drupal or Jomla! Thank you so much for all your efforts and support.
    1 point
  36. Greetings, Gerhard: and now to blow your mind with potentials... 1. Open the cheatsheet (thanks, Soma): http://cheatsheet.processwire.com 2. Look under "$page" 3. Look under "PageArray/WireArray" 4. Consider that you can often chain 2->3 (replace $a variable with your choice in 2) Use the flexibility wisely! Thanks, Matthew
    1 point
  37. 1 point
  38. I think you're searching this.
    1 point
  39. good one I also wrote about in some thread... and for those being even more lazy can also use the even shorter $page->is(selector) if($page->is('template=template1|template2|template3|template4')){ edit: or if just for one template instead if($page->template == "basic-page"){ use if($page->is("basic-page")){
    1 point
  40. And for those that don't know, you can do this in ProcessWire if you want to match against multiple templates, like this: if ($page->matches('template=template1|template2|template3|template4')) { ... instead of this: if ($page->template == 'template1' || $page->template == 'template2' || $page->template == 'template3' || $page->template == 'template4') { ... Just thought that was worth sharing as I was typing it the long-hand PHP way just now and stopped myself before I wrote a lot of extra characters for no real reason! A shorter PHP alternative than above would be this: if (in_array($page->template, array('template1', 'template2', 'template3', 'template4')) { ... but I much prefer the ProcessWire version. $page->matches is a lovely thing that can be used to test the current page against any selector you can think of that makes sense in your situation.
    1 point
  41. Just for the record and for those wondering what $event->replace = true; does: It prevents the hooked function to get executed when you use addHookBefore().
    1 point
  42. Thanks again Soma, I feel like an idiot right now having the status as a string (not done it anywhere else in my modules so was just being blind ). All working now - for those interested, this is the final code: public function init() { $this->pages->addHookBefore('trash', $this, 'preservePages'); $this->pages->addHookBefore('delete', $this, 'preservePages'); } public function preservePages(HookEvent $event) { $page = $event->arguments[0]; if ($page->template == 'template-name') { $page->addStatus(Page::statusHidden); $page->save(); $event->replace = true; $this->message("The page was hidden instead of deleted. Pages using the '" . $page->template . "' template can be linked to other pages, so deleting is prohibited"); } } As you can see, much simpler after Soma's expert help. @Soma: I can't mark both your replies as the Solved post, so will have to mark this one with the full code if that's okay?
    1 point
  43. not as a string should work... $page->addStatus(Page::statusHidden); Cheers
    1 point
  44. There you go https://github.com/somatonic/TemplateNotes
    1 point
  45. If you give me another 10 minutes I got something for you...
    1 point
  46. Joss, you can get the page number with $input->pageNum, so: if ($input->pageNum < 2) { // Show the thing }
    1 point
  47. That's an easy one <?php echo $pages->get('/your/page/')->right; ?>
    1 point
  48. Spex is official now, I've added this to the modules directory =)
    1 point
×
×
  • Create New...