Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/25/2013 in all areas

  1. I have done an iso for the raspberry pi with processwire installed with the basic profile, if anybody is interested in a copy just let me know.
    5 points
  2. Direct quote from Ryan, taken from the first thread linked up there: So yes, that's how it works. Taking a quick look at source, when asked for a database query Datetime fieldtype simply converts selector value to date with format 'Y-m-d H:i:s', right after sanitizing it (in which process any non-timestamp value is parsed by strtotime()). Digging through PW source is actually fun.. and also the only way to be 100% sure what's really going on and what kind of values will work
    5 points
  3. Hi all, I've been looking at adding MailChimp synchronisation to PW. I have a few sites with users that have to register and it's much simpler for me to have the whole user list synchronised into MailChimp rather than adding people on a case-by-case basis (as I have done in the past). With this in mind I have created a prototype module that syncs the whole list, a few fields and user roles. This allows you to send MailChimp campaigns to a segment of your users based on their roles. You can download and try out the module here: https://github.com/ffub/MailChimpSync I've a few ideas of where I want to take this: Switch to scheduled updates. To avoid updating the whole list users should be flagged as requiring an update when one of the relevant fields is updated. LazyCron or cron jobs would update flagged users. Automatic creation of the list on MailCimp and initial import. It would also be possible to add an interests field in PW and synchronise this too, which would effectively allow you to create lists in PW. I've had to hook before the user is actually saved as this is the only clean way I could find to get their new email address and their existing one at the same time. This is pretty inefficient as this holds up the user being saved in PW until the MailChimp update is done. I'd also like to only update the user when the fields defined in the module are updated, rather than the user as a whole. Stephen
    4 points
  4. Heh, now we got 3 mailchimp modules separately that do work differently. I'm holding mine back as it is a lot more complicated to create a good mailchimp module with remote managing lists and campaigns. Lists can't be created via API, reason being that you should work with segments and groups for a list instead of creating a list for every group. This is to avoid creating too many lists. But this get's a little more expensive in "recreating" the functionality Mailchimp already has done very very well. One thing that is different from your module for example is I don't use PW user but pages. I create campaigns for lists and submit them from a newsletter created from a special page the user can edit and select for submission. So far I haven't got the time to invest and list management is still missing, kinda what you got here but as said not for PW users. But it has a nice admin interface to create campaings and see part of statistics after sending. Thing is that to make it really efficient (as the requests are limited) it would need to have caching built in so it doesn't need to request all those informations everytime, kinda what they suggest in their API docs. We maybe should work all together I'm on holiday currently in Turkey this week, but maybe I can find some time to share module.
    3 points
  5. I discovered ProcessWire via CMS Critic (and gadgetopia). I am a reluctant Drupaler, so PW is a refreshing change. Looking forward to seeing more and hopefully contributing as well. Cheers
    3 points
  6. Hi alkahest, Welcome to PW! If I understand you correctly, this is determined in Setup->Fields->Input....scroll down to "Input field type". Change that to PageListSelect rather than the default "Select" and you should be good to go . Seems with "Select" you can only select top level pages. You can still limit the page selections to children, grandchildren, etc of a particular parent using "Parent of Selectable page(s)" setting. If you want all pages, then leave that setting to "Home". Lovely site and portfolio you got there, btw.. @Ryan/Others...is this by design (haven't searched the forums ). I suppose it is, to avoid endless scrolling maybe?
    2 points
  7. Updated code to v1.0.3 - this is an upgrade to the core Minify package (not my module or ProcessWire's code) to address a serious security issue. This update is SERIOUSLY recomended for anyone using this module! Thanks arjen for the heads-up! EDIT: Also worth noting that it was the main developer behind this forum software who noticed the flaw and suggested a fix to the Minify developers - I've also updated the Minify code in these forums. If you use Minify as a standalone package (ie. not this module, but the code available from the above link) elsewhere it would be worthwhile updating it wherever you have installed it. The issue is likely to be present in other JS/CSS minify modules/plugins in other CMS' that use the code from the above link too - I've spotted at least two WordPress modules for example that use the same codebase and there may well be others, so please bear that in mind if you use other systems.
    2 points
  8. Thanks for all the support, Ryan, Diogo, Soma and all the other forum members. I just finished my first pWire site. Although I still have to add the iOS icons and Soma´s great module for navigation markup doesn't seem to have the ability to limit the children <li> on my main menu, I will get that solved later. After a few weeks I'm very happy with process wire and every time I ask something here I feel a bit dumb. Process Wire simplicity to get things done is amazing! Thanks to kongondo too for the modx to pWire transition post: http://bit.ly/1dYgAnW You can check this simple and a bit text bloated pWire site here: http://artecassistencia.com
    2 points
  9. Andrew, Here's your demo for using SWFObject in ProcessWire. I reckon you owe me at least one free Russian lesson Hehe Here's the JavaScript code; the whole 3 or so lines of it <script type="text/javascript" src="<?php echo $config->urls->templates?>js/swfobject.js"></script> <script type="text/javascript"> swfobject.embedSWF("<?php echo $config->urls->templates?>swf/locomotive_poc.swf", "myContent", "900", "720", "9.0.0"); </script> And the HTML.... <div id="myContent" class="myflash" > <p>Alternative content if Flash doesn't work </p> </div> These code is placed in your ProcessWire template file. There is hardly any PHP in it. Of course, you can add your SWFObject parameters as you wish...Next you create a PW page and make it use that template file. I placed my swfobject.js file in /site/templates/js/ and the .swf in /site/templates/swf/ (I created the swf folder). That's all there is to it So, what do you say? ProcessWire rocks, right?
    2 points
  10. download ISO image Raspberry pi, for people that doesn't know about this little computer that cost less than 50$ The image comes form a 2GB SD card ProcessWire Admin user: admin pass: process2013 Mysql Database dbName = 'process'; dbUser = 'process'; dbPass = 'processdb'; Raspberry admin and ftp user user: pi pass: raspberry you get processwire files under /home/pi/www
    2 points
  11. Quick one...will update later...(will check for errors) - Tested with PW Dev (version from a couple of days back) Trash Pages get(); - will NOT get anything from the Trash get("include=hidden"); - will NOT get pages in the Trash (even if their status there is hidden). get("include=all"); - will get ALL pages in the Trash (all pages - visible, hidden, published, unpublished) Tree Pages (non-admin) get(); Unpublished + Hidden Page => will return something like "for-page-1532" if you echo out the name of the returned document. Echoing title returns the name normally (not the title). get("include=hidden"); Unpublished + Hidden Page => will return something like "for-page-1532" if you echo out the name of the returned document. Echoing title returns the normal name (i.e. without the "for-page-1532"). get("include=all"); Unpublished + Hidden Page => will return page. Echoing out the name behaves normally (i.e. without the "for-page-id"). get (); Published + Hidden Page => will return page normally. get (); Unpublished + Visible Page => will return page normally. You can use has_parent in your selector Edit: Yes, you can use parent!=$config->trashPageID in your selector as well .
    2 points
  12. Assuming the other domains are completely different (and not just subdomains) it is a little tricky to have the user logged in all of them, unless you are using some external service to manage the logins (whether one you've written or an already existing service). For instance, consider that Facebook recognizes you as logged in as you browse through other websites. But if you are looking for a simple solution, one possible is to use Javascript to duplicate the login form POST submission to other sites. I don't know of a way to do it without Javascript just because the client side (user) is the one that must actually login, so Javascript being client side, lets you perform that action for them without them knowing it. This is just untested pseudocode, but hopefully it gets the idea across. <form id='login-form' method='post' action='/login/'> <label><input type='text' id='user' name='user'> Username</label> <label><input type='password' id='pass' name='pass'> Password</label> <input type='submit'> </form> <?php if($config->httpHost == 'maindomain.com'): ?> <script> $(document).ready(function() { $("#login-form").submit(function() { var data = { 'user': $("#user").val(), 'pass': $("#pass").val(), 'submit': 'submit' }; $.post('https://www.otherdomain.com/login/', data); $.post('https://www.adones-site.com/login/', data); }); }); </script> <?php endif; ?> Now I'm not positive it would work exactly like this. You might have to open an invisible iframe to each of those external sites first to establish a session, but that would be fairly simple, just by adding some hidden <iframe> tags to the login forms of those other sites after your <form>. There may be other factors too, but I think this would work. Your /login/ page would also need something to detect when it is being submitted to, and login the user in: <?php if($input->post->user && $input->post->pass) { $name = $sanitizer->pageName($input->post->user); $user = $session->login($name, $pass)); if($user->id) { // login success if($config->httpHost == 'maindomain.com') $session->redirect('/wherever/you/want/'); else echo "Success"; // presumably this will never be seen } else { // login failed if($config->httpHost == 'maindomain.com') $session->redirect('/login/'); else echo "Failure"; // presumably this will never be seen } }
    2 points
  13. Complementing Ryans code. If you have a page field on the user template that points to one city page, and you have the ads as children of pages: if($user->isLoggedin()) { // display ads from your city foreach($pages->find("parent=$user->city" as $ad)){ echo $ad->render(); } } else { // display all the ads foreach($pages->find("template=ad" as $ad)){ echo $ad->render(); } } Of course it has to be even more complemented with pagination and those things... but it gives you an idea
    2 points
  14. if($user->isLoggedin()) { // display ads from your city } else { // display all the ads }
    2 points
  15. Welcome hop_along_kid! You are going to enjoy this ride I can promise you that
    2 points
  16. Welcome to PW, John! Glad you found the solution to your problem. Personally never heard of Kirby or Stacey (other than an area of Liverpool (spelt differently) and a mate's ex-girlfriend), but from a quick search, PW templates look somewhat similar to Kirby templates. Anyhow, enjoy experimenting with PW and come back to the forum with any questions.
    2 points
  17. You can detect whether the current page was loaded from ajax by checking the value of $config->ajax from your template file: <?php if($config->ajax) { // page was requested from ajax } Following that, you will likely want to render the page differently to accommodate whatever you are doing from the javascript side. For instance, you might want do one of these: 1. Deliver alternate or reduced markup when loaded from ajax 2. Deliver a JSON or XML string for parsing from javascript Below are examples of each of these scenarios. 1. Deliver alternate or reduced markup when loaded from ajax You might find checking for ajax helpful when you want portions of pages to load in your site without re-rendering the entire page for each request. As a simple example, we'll use the default ProcessWire site and make it repopulate it's #bodycopy area when you click a page in the top navigation. (To use this example, you'll need the default ProcessWire site templates, though you can easily adapt the example to another situation.) To accomplish this, we'll update our main page template to only include the header and footer markup if the page is NOT being loaded from ajax: /site/templates/page.php <?php if(!$config->ajax) include("./head.inc"); echo $page->body; if(!$config->ajax) include("./foot.inc"); Next we'll update the top navigation to do ajax loads of the pages when the client has javascript (and leave as-is when they don't). Paste this javascript snippet before the closing </head> tag in the header markup file: /site/templates/head.inc: <script type="text/javascript"> $(document).ready(function() { $("#topnav a").click(function() { $("#topnav a.on").removeClass('on'); // unhighlight selected nav item... $(this).addClass('on'); // ...and highlight new nav item $("#bodycopy").html("<p>Loading...</p>"); $.get($(this).attr('href'), function(data) { $("#bodycopy").html(data); }); return false; }); }); </script> Now when you click on any page in the top navigation, it pops into the bodycopy area without a page load visible from your browser. And all pages remain accessible from their URL as well. Note that this is just a test scenario, and I probably wouldn't use this approach for the entire bodycopy area on a production site (it would make bookmarking difficult). But this approach can be very useful in the right places. 2. Deliver a JSON or XML string for parsing from javascript Lets say that you want pages in your site to return a JSON string with the page's id, title, and number of children when it is requested from ajax. When not requested from ajax, they will return their content as normal. To handle the ajax requests, you'd want to add something like this at the top of your template file before any other output. <?php if($config->ajax) { // this is an ajax request, return basic page information in a JSON string $json = array( 'id' => $page->id, 'title' => $page->title, 'numChildren' => $page->numChildren ); echo json_encode($json); return; } // not ajax, continue with regular page output And here is some markup and inline javascript you might use to test the ajax call on some other page (or the same one if you prefer). You would paste this snippet right in your site's markup where you want that info to appear. <ul id='info'></ul> <script type='text/javascript'> var url = '/'; // this is homepage, so replace '/' with page URL you want to load JSON from $(document).ready(function() { $.getJSON(url, function(data) { $.each(data, function(key, value) { $("#info").append("<li>" + key + ": " + value + "</li>"); }); }); }); </script> The above snippet would output something like this: • id: 1 • title: Home • numChildren: 5 To take this example further, you could build an ajax-driven sitemap or any number of web services. Conclusion Hope this helps you to see how simple it is to use ProcessWire to deliver output for ajax. These are just contrived examples, but hopefully examples that might lead to more ideas. In addition, much of what you see in these examples is also applicable to building web services in ProcessWire.
    1 point
  18. CollagePlus is a jQuery plugin by Ed Lea. It takes a list of images and converts it to a nicely formatted grid. With this module, we use the CollagePlus plugin to produce nice grid output for ProcessWire image selection. This applies to the images that you select when clicking the image icon from the rich text editor (TinyMCE or CKEditor). The idea for this is from the great Unify admin theme for ProcessWire by @adamspruijt. To use, simply install the module and it is ready to go. Requirements: This module should run on any version of ProcessWire. But to be on the safe side, it would be best to use version 2.2 or newer. If you are using version 2.3.1 (dev branch) or newer this module makes use of conditional autoload for increased efficiency. Download: http://mods.pw/54 or https://github.com/ryancramerdesign/JqueryCollagePlus or install via Soma's ModulesManager. For those running ProcessWire 2.3.2 or newer, you can also install it from your admin: Modules > new > class: JqueryCollagePlus.
    1 point
  19. @Soma it would be lovely if there would be a "MailChimp/newsletter module team" here and maybe a "payment/e-commerce module team", too.
    1 point
  20. 1 point
  21. Andrew, Place that code in your template file and I can promise you it will run... . It is just JavaScript; nothing special about it. If I have the time I will prepare a demo with your code and demonstrate this. What k07n wrote above was just an example about including flash in your site.
    1 point
  22. Corrected. The forum should throw a PHP error when you make those mistakes while writing directly in the browser
    1 point
  23. Nice one guys @Diogo...thanks for the reminder about user templates being editable. I usually forget that... Btw, you are missing the closing ")" in your selectors' code
    1 point
  24. Greetings, As far as my experince goes, this is true. I use various date calls all the time in my ProcessWire sites, mixing ProcessWire and good old PHP to get what I need. To add one more link to kongondo's list, Ryan and I posted a bit on this here: http://processwire.com/talk/topic/2600-datetime-field-issue-with-dev/?p=25648 Thanks, Matthew
    1 point
  25. back to the topic: According to this http://video.about.com/animation/How-to-Embed-Your-SWF-in-a-Web-Page.htm you need to insert to your template file this code: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="225" id="FlashID" title="I'm Title"> <param name="movie" value="myflash.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="swfversion" value="7.0.70.0"> <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. --> <param name="expressinstall" value="Scripts/expressInstall.swf"> <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="kawaii3_.swf" width="300" height="225"> <!--<![endif]--> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="swfversion" value="7.0.70.0"> <param name="expressinstall" value="Scripts/expressInstall.swf"> <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --> <div> <h4>Content on this page requires a newer version of Adobe Flash Player.</h4> <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p> </div> <!--[if !IE]>--> </object> <!--<![endif]--> </object> You need to change param values of course. You can look here for more info: https://www.google.ru/search?q=embedding+flash+in+html&oq=embedding+flash+in+html&aqs=chrome.0.69i57j0l3.1279j0&sourceid=chrome&ie=UTF-8
    1 point
  26. Russian is my native language. I understand each word in first message, but hardly understand the whole message. So Like from WillyC has made my day =)
    1 point
  27. Sorry for that -- for some reason I simply copied your original (non-working) selectors and didn't fix them for my examples..
    1 point
  28. This theme is rather old and I'm not planning to update it any further, but stay tuned, surprise is coming really soon For those of you using the theme, you can download latest version of jQuery Cookie from here.
    1 point
  29. Peter, You can easily exclude pages in the trash by using, for example, has_parent!=7. The ID of the trash page is 7 by default...OR...example code from Trashman (the module) if ($page->parent->id != $this->config->trashPageID) { //blah blah}//used in function/method context $config->trashPageID returns the Page ID of the trash page. Pages sent to the Trash have their parents changed to the Trash page (ID=7). They don't become orphan or lost pages Edited: Added Trashman code example
    1 point
  30. I have a feeling PW date selectors will obey stuff you can throw at PHP strtotime
    1 point
  31. The rest are in Soma's head The guy knows everything . Jokes aside, I think they are buried deep in PW code. I recall Soma saying when he was getting started he studied module code and looked in PW modules, etc. Edit: Adding hopefully relevant links to collate date selector stuff in one place.. http://processwire.com/talk/topic/3290-sort-by-date-range/ http://processwire.com/talk/topic/2795-selector-with-dates-and-checkboxes/ http://processwire.com/talk/topic/2260-search-articles/ - Nice one! See post by Ryan
    1 point
  32. Well done but you should add something to the homepage that it's also about booking tickets to see shows. While this might be obvious not everybody will get that at first visit of the homepage. The Book tickets button shows up after you click on a miniature show square on the homepage. On top in the menu that is on all pages you have shows theatres my account. Add something to it there that you can also book tickets. Also add a nice frame around all the miniature show squares to give it that more theatre look and feel. Hope this might be usefull for your site. What about the spelling theatre ? Wasn't the only acceptable spelling theater like -er as normal American spelling ? In the United States the customary spelling is theater, but the National Association of Theatre Owners uses the spelling theatre to refer to a movie theater. Theatre is also British spelling but somehow got accepted in most parts of America ? Like centre is British and center is American. Just wondering how these spellings actually are in your country since the British were part of the history of India during 1900. I think spelling is important on a website.
    1 point
  33. Belay my last - I had set debug to true in my config.php. All well now. For what it's worth, I've spent a long time finding a CMS that provided just enough support but let me play with my html/css/js independently - liking what I see so far. I'm a convert from Kirby & Stacey.
    1 point
  34. I think this is where the confusion arises. I am assuming Kyle means "ADs for User 1, etc"...according to their City, but your example suggests "ADs by User 1, etc". Question is, who is posting the ADs?; these Users or others?
    1 point
  35. This thread is awesome... great community effort, makes me smile to read the Italian, I don't understand it but I can hear it in my head
    1 point
  36. What @arjen said + your first example doesn't really do anything: <a href='<?php $pages->get("/gallery/")->url; ?>'> Back </a> Second example is OK (except for the non-working selector), but what you probably meant to do in your first example was one of these: <a href='<?php echo $pages->get("/gallery/")->url; ?>'> Back </a> <a href='<?=$pages->get("/gallery/")->url?>'> Back </a> (ie. you were missing an echo or short echo statement there.) edit: fixed broken selectors to avoid confusion..
    1 point
  37. Ok, i've switch from _() to __() !
    1 point
  38. :/ Perhaps another oddity between windows and other platforms when it comes to mysql? If there's anything I can provide you from my side, test case or attempts, please let me know. I'm very happy to assist in giving back -- adam
    1 point
  39. ImageMinSize Module Already there since a couple months, I figured I'd finally add it to the repository. What it does ImageMinSize module allows you to define a minimum width and or height an image needs to have when uploading. This is same as the already existing maximum image size setting, just on the other end. You can set the max and min width and height setting to the same to restrict uploaded images to a specific size. If the requirements aren't met it will delete the image and show an error. After installing the module you'll be presented with the additional minimum width and height setting in the fields input configuration. Currently on github https://github.com/somatonic/ImageMinSize On modules repository (in approval state) http://modules.processwire.com/modules/image-min-size/ This module was getting started because of this thread: http://processwire.com/talk/topic/3476-fixed-image-size/?hl=imageminsize#entry34110
    1 point
  40. Hanacode is cool, I used it in combination of tags. (image tags) [[images tags="cars bikes boats"]] Now you could render albums instead of images when there are more then 6 photo's groups or something. There are two annoying things about HannaCode 01. after save it returns to the list of hana codes. 02. I can't use tabs. --- ps, Maybe we need a repository of good Hanna Codes.
    1 point
  41. One other immediate solution is to use Ryan's Hanna Code. I adapted the module to Hanna code, and it seems to be working pretty well, although the tags are a bit different: {fieldname:2} and [[images f="fieldname" n=2]] It looks a bit more complicated at first, but it's not really. Here is a resumed explanation: defaults: [[images p="0" f="0" n="0"]] where p is the page number, f is the field name and n is the image position on that field. The above is equivalent to simply: [[images]] And it will get all the images from the first field of the "image" type on the same page of this Hanna Code field. Because: if $p="0"; // $p will hold the $page object if $f="0"; // $f will hold the first images field found on $p if $n="0"; // $n will echo all the images from $f From here you can have any combination: [[images n="4"]] // echoes the image on the forth position of the first image field of this page [[images p="1" f="myimages"]] // echoes all the images of the field "myimages" in the homepage That's it. Here is the string to import this Hanna Code: !HannaCode:images:eyJuYW1lIjoiaW1hZ2VzIiwidHlwZSI6IjIiLCJjb2RlIjoiXC8qaGNfYXR0clxucD1cIjBcIlxuZj1cIjBcIlxubj1cIjBcIlxuaGNfYXR0cipcL1xuJG15UGFnZSA9ICRwID8gJHBhZ2VzLT5nZXQoJHApIDogJHBhZ2U7XHJcbiRmaWVsZE5hbWUgPSAkbXlQYWdlLT5maWVsZHMtPmdldCgndHlwZT1GaWVsZHR5cGVJbWFnZScpO1xyXG4kbXlGaWVsZCA9ICRmID8gJG15UGFnZS0+JGYgOiAkbXlQYWdlLT4kZmllbGROYW1lO1xyXG5cclxuJGluZGV4ID0gJG4tMTtcclxuXHJcbmlmKCRteUZpZWxkIGluc3RhbmNlb2YgUGFnZWltYWdlcyl7XHJcbiAgICBpZigkbil7XHJcbiAgICAgICAgJGltYWdlID0gJG15RmllbGQtPmVxKCRpbmRleCk7XHJcbiAgICAgICAgJGltYWdlID0gXCI8aW1nIGNsYXNzPSdJbWFnZVRhZ3MnIHNyYz0nJGltYWdlLT51cmwnIGFsdD0nJGltYWdlLT5kZXNjcmlwdGlvbic+XCI7XHJcbiAgICB9IGVsc2Uge1xyXG4gICAgICAgICRpbWFnZSA9IFwiXCI7XHJcbiAgICAgICAgZm9yZWFjaCgkbXlGaWVsZCBhcyAkaW1nKXtcclxuICAgICAgICAgICAgJGltYWdlIC49IFwiPGltZyBjbGFzcz0nSW1hZ2VUYWdzJyBzcmM9JyRpbWctPnVybCcgYWx0PSckaW1nLT5kZXNjcmlwdGlvbic+XCI7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgXHJcbn0gZWxzZSBpZigkbXlGaWVsZCBpbnN0YW5jZW9mIFBhZ2VpbWFnZSl7XHJcbiAgICAkaW1hZ2UgPSBcIjxpbWcgY2xhc3M9J0ltYWdlVGFncycgc3JjPSckZmllbGQtPnVybCcgYWx0PSckZmllbGQtPmRlc2NyaXB0aW9uJz5cIjtcclxufSBlbHNlIHtcclxuICAgICRpbWFnZSA9IFwiXCI7XHJcbn1cclxuXHJcbmVjaG8gJGltYWdlOyJ9/!HannaCode
    1 point
  42. Makes sense to me. The only thing is that PW core doesn't come with an Inputfield that does this, so it would be an external 3rd party dependency... something I'd like to avoid. So what I'll probably do is make the Inputfield type configurable so that you could tell it to use some future code-editing Inputfield instead of InputfieldTextarea.
    1 point
  43. needs to sholud have.type hintings, debuger and code.completion two
    1 point
  44. Maybe the example just isn't a very good one, as you don't know ahead if the repeater have any unchecked checkbox. $pa = $pages->find("template=basic-page, slides.count>0, slides.disable_slides=0"); foreach ($pa as $p) { foreach($p->slides->find('disable_slides=0') as $r) { echo "<p>$r->title</p>"; } } Should also work, not to loop pages that have no repeater that meet the criteria for nothing.
    1 point
  45. The term "selector" is the string you define to search, like in CSS or jQuery .someclass{} or $('.someclass') and not the result or the method "find()". I've read in some threads and now here (kongondo) (other than nesting the first selector inside the first foreach) and it can be confusing. Ok, find is your friend! Approaching it this way, with finding all pages with the repeaters, then loop all is all correct and required in this case, but seems like not so efficient to loop all repeaters just to find the not checked ones? Why not just use the wonderful search functions to get the repeaters not checked and then loop them? $pa = $pages->find("template=basic-page, slides.count>0"); foreach ($pa as $p) { foreach($p->slides->find('disable_slides=0') as $r) { echo "<p>$r->title</p>"; } }
    1 point
  46. Now we have this, I can imagine we have a "snippet" bucket somewhere were we can share some high quality "snippets".
    1 point
  47. Sorry my fault. I haven't read careful and assumed from your selector that you have authors with a page field "posts" to reference all posts. It's the other way round then. But having it the way I assumed would result in having a simpler code Don't worry, you could either change it if you like it or use this with current (like nico but little improved I think) $authors = $pages->find("template=authors"); // create empty page array $res = new PageArray(); foreach($authors as $a) { // temporarely add postscount property to author $a->postcount = $pages->count("template=posts, author=$a"); $res->add($a); } foreach($res->filter("sort=-postcount, limit=5") as $a){ echo "<p>$a->title ($a->postcount)</p>"; } Let me know if it works for you.
    1 point
  48. Once you've got your form, I think it'll be fairly easy to develop this. But your date fields are the only thing that's going to need a little extra work. Since you are asking for just month and year (no day) you'll want to qualify that to the beginning of the first month and the end of the second month. Finding the beginning of the first month is easy since all months start at day 1. There are various ways to find the end of the second month, but there's one way in my example below. Here's how I might perform the query from the API side (written in the browser so may contain typos): // where we will store our $pages->find selector $selector = array(); // add the search query if present if($input->get->search) { $search = $sanitizer->selectorValue($input->get->search); $selector[] = "title|body~=$search"; } if($input->get->yearFrom && $input->get->monthFrom) { // construct date like 2012-12-02 and convert to timestamp $dateFrom = strtotime("{$input->get->yearFrom}-{$input->get->monthFrom}-01 00:00:00"); if($dateFrom) $selector[] = "date>=$dateFrom"; } if($input->get->yearTo && $input->get->monthTo) { // do the same for month-to, but find the beginning $dateTo = strtotime("{$input->get->yearTo}-{$input->get->monthTo}-01 00:00:00"); // now find the end of dateTo month by adding 1 month and subtracting 1 second if($dateTo) $dateTo = strtotime("+1 MONTH", $dateTo) - 1; if($dateTo) $selector[] = "date<=$dateTo"; } // determine and validate the max records to show $limit = (int) $input->get->limit; if($limit > 50 || $limit < 1) $limit = 10; $selector[] = "limit=$limit"; // specify the template we are limiting the search to $selector[] = "template=article"; if(count($selector)) { // perform the search $selectorString = implode(', ', $selector); $articles = $pages->find($selectorString); echo "<h2>Found " . $articles->getTotal() . " articles matching your query.</h2>"; echo $articles->render(); // or however you want to output them } else { echo "<p>No search specified.</p>"; }
    1 point
  49. Jquestion, one good thing that has changed in ProcessWire since that post you linked to was written is that the user system is now built around pages and templates. You can add whatever fields you want to your 'user' template. This opens up a lot more possibilities that didn't exist back when that post was written. So if you want multiple users to have access to a given page, you might just want to create and add a new page reference field to the 'user' template. You might call it something like "client_page". Use 'PageListSelect' or 'PageListSelectMultiple' as the Input field type for that page field. Now when you edit a user, you can select what private page(s) they should be able to view. In your template used by that private page, you'll want to have some kind of access check in there like this: if($user->isGuest() || $user->client_page->id != $page->id) throw new WirePermissionException("You don't have access to this page"); or if a multi-page reference field: if($user->isGuest() || !$user->client_pages->has($page)) throw new WirePermissionException("You don't have access to this page"); To allow for logins by email address: if($input->post->login_submit && $input->post->email) { $email = $sanitizer->email($input->post->email); $emailUser = $users->get("email=$email"); if($emailUser->id) { $user = $session->login($emailUser->name, $input->post->pass); if($user) { echo "Login success!"; } else { echo "Login failed!"; } } else { echo "Unrecognized email address"; } }
    1 point
×
×
  • Create New...