Jump to content

Leaderboard

Popular Content

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

  1. Ryan was kind enough to agree to answer some questions about himself and about ProcessWire for an interview which I've posted over on my blog at http://codingpad.maryspad.com/2013/07/19/interview-with-ryan-cramer-processwire-cms-founder-and-lead-developer/ I think it's a pretty good read and quite informative and hope it brings lots more exposure to PW and how awesome it is! Many thanks Ryan, you rock!!
    10 points
  2. Hi guys, It's been a while that I've posted here on the forum, the reason was - I got a new job few months ago so I've been rather busy and haven't got time to post some new things. I've made a Yahoo! Weather module that connects to Yahoo weather API and pulls current forecast and forecast for next 4 days. The module is completely ready for translation, I've also made days and weather conditions translatable because Yahoo API doesn't offer localization (English only). The widget has normal mode and compact mode and you can easily customize it's appearance through included CSS. Edit 12.04.2015. This module is not longer supported, check out the new version at this link. I'll fix some errors that are currently in this module for those of you who like the old version better then the newer one. Screenshot Download https://github.com/nvidoni/MarkupWeather How to install Copy module directory to /site/modules/ directory. Click check for new modules in ProcessWire Admin Modules screen. Click *install* for the module labeled: "MarkupWeather". How to use Copy this line to template of your choice where you want the weather widget to be displayed: <?php echo $modules->get('MarkupWeather')->render(); ?> This module has the following options: Yahoo! Weather Woeid Woeid is a number located right beside the city name, e.g. http://weather.yahoo.com/croatia/grad-zagreb/zagreb-851128/ Set Locale sets PHP locale, needed for date display localization Date Format date formatted with PHP strftime function Show 5 day forecast below current weather forecast? turn this off if you want to display compact weather widget, shows only current weather Display temperature in Fahrenheit instead of Celsius? show weather conditions in Celsius or Fahrenheit scale Hope you'll like it.
    8 points
  3. I just quickly create a new FieldtypeDimension module. https://github.com/somatonic/FieldtypeDimension Will later add a thread and to the repository. Forum Module Thread http://processwire.com/talk/topic/4081-fieldtypedimension/
    8 points
  4. Dimension Fieldtype A new fieldtype to enter 3 integer values for width, height and depth. Output You can output the values from a page like this: echo $page->fieldname->width; echo $page->fieldname->height; echo $page->fieldname->depth; Volume There's also support for a "computed" value of the volume. W*H*D. This will get stored additionally to the database and updated every time a dimension value changed, so it can also be used in selectors for querying. echo $page->fieldname->volume; Selectors for searching The dimension can be used in selectors like this: $pages->find("dimension.width=120"); $pages->find("dimension.height>=100, dimension.depth<120"); $pages->find("dimension.volume>=1000"); Integers and Formatting The values are entered and stored using integer and not float, as this makes for easier headache free usage. Treat them as integer and format them on the output if you need to. echo (number_format(($p->dimension->width/100),2)); // 538 will be 5.38 Field Settings There's field settings for the width of the inputs in pixels. There's a input setting to add a suffix string to each input like "mm" or whatever you like. The module is already on the repository ready to use http://modules.processwire.com/modules/fieldtype-dimension/
    7 points
  5. I'm not sure why it wasn't working in my case, but will try again. Good to know how the capability is provided (collagePlus), I like it so much you have me thinking this should be the default output.
    5 points
  6. I'm in the process of converting everything in the Wiki over to the main site. The Wiki is getting all kinds of strange traffic from the logs, and it's database is many gigabytes in size (when it should be more like a megabyte). Basically, I don't trust MediaWiki here, at least since I'm not an expert with it. I'd feel more comfortable having all this content on the main site, so it should be there soon.
    4 points
  7. Thanks for posing this Kyle! A few things to mention: For even more security with the activation code, you might want to use something completely random that isn't influenced by the username. We have something built-in that will do the trick: $p = new Password(); $hash = $p->randomBase64String(100); // 100=length of string See here how it works: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Password.php#L154 (code is originally from Anthony Finta's password_compat library). Make sure that you are using $sanitizer->pageName("username"); for your username sanitization. Using $sanitizer->text(); is not adequate for sanitizing usernames or any selector values. In your function that checks for duplicate usernames, check for duplicate emails as well. When you check for users or emails do $users->get("name=$username") rather than $users->get($username); as this will ensure it's checking for only the username, and not potentially confusing a numeric username with a user ID. I recommend using $input->get->var rather than $_GET['var'] because the $input->get version makes it so that you never have to worry about PHP's magic_quotes setting. Last thing to mention is that it might be good to include what type of fields the user_real_name and user_activation are. I believe these are supposed to be text fields, but wasn't sure (especially for user_activation) until later.
    4 points
  8. Changed the name to ImageInterceptor, tnx Adam
    3 points
  9. This makes a good "textbook" example of a Fieldtype/Inputfield pair that is easy to understand - maybe this should be referenced in the Wiki? Question: is it possible to extend this with support for a computed (as opposed to stored) value, such as volume = width * height * depth ... adding the computed value would be easy enough, I suppose - but getting the same name to work in an SQL query via the PW query language, is that possible?
    2 points
  10. Dive into Fieldtypes, they handle data storage/cleaning before putting in de db. Take a look at the mapmarker Fieldtype or soma's range slider. They both have an Inputfield and an own Fieldtype.
    2 points
  11. If account_status is of single page select it won't have a add() method like PageArrays have. Multiple page select $new_page->$field->name->add(1023); // like $new_page->account_status->add(1023); // and also this (which seems to append db entry) guess makes sense? $new_page->account_status = 1023; Single page select $new_page->$field->name = 1023; // like $new_page->account_status = 1023; // but not $new_page->account_status->add(ID); // wrong So the page field can have different types based on the dereference settings multiple or single and behave slightly different. Single: it will only be a value of type page and page have no method add, multiple: will be a PageArray. PageArrays have the method add() to add pages, but also the field recognizes just ID's set to it, and it will save the entry and the others already saved or doublicates remain untouched. So to clear a multiple page field you have to call field->removeAll() first. You get this error because the value is most likely not an object (yet). If it dereferences as "single page or false if none selected (!)" .. so if the field is empty it will throw an error: Error: Call to a member function add() on a non-object If you would have already saved a value you would get this error instead, same code but different message because the field now has a page object set: Error: Exception: Method Page::add does not exist or is not callable in this context Hope this shares some light.
    2 points
  12. in the templates list page, on top. open 'filters' and choose 'show system templates', the users template will be shown.
    2 points
  13. Copy the website to a local server and do the switch. If everything goes well, apply it on the server.
    2 points
  14. Hi, I just uploaded the first version of the SchedulePages module to Github: https://github.com/f...r/SchedulePages This plugin module allows you to schedule (un)publication of pages. I hope you guys will like it. //Jasper Usage: ====== Place the SchedulePages.module file into the site/modules folder and install the plugin from the admin area. Install/activate the LazyCron module (if you haven't already). This module is part of the Processwire core, but it isn't activated by default. Add the following date fields to your template: publish_from publish_until Note: the fields are already created during the installation of the module That't all. LazyCron will run take care of (un)publishing your pages that have a the publish dates set. It will run on every hour. Please note: LazyCron hooks are only executed during pageviews that are delivered by ProcessWire. They are not executed when using ProcessWire's API from other scripts. Edit: Changed the name of the module and function as Ryan suggested below. Edit 2: Updated instructions. Required fields are now automatically created and from now it runs every hour. Edit 3: Added module dependency. The updated module is on Github
    1 point
  15. Very impressive - http://sarasoueidan.com/blog/s-gallery-responsive-jquery-gallery-plugin-with-css3-animations/
    1 point
  16. 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
  17. Thanks kongondo, this idea was from mindplay.dk! Also wanted to add: - There's field settings for the width of the inputs in pixels. - There's a input setting to add a suffix string to each input like "mm" or whatever you like.
    1 point
  18. Thanks Ryan! Haven't really thought about that, so thanks for the heads up! I changed the keys and also added support for a volume property that will get calculated everytime a dimension changes and stored to DB. So it can be used for convenience if needed to get the volume, and also use it in selectors. I updated the module and readme to reflect that change, along with some cleanup and coments. If you happen to already have the module installed, I recommend to reinstall the module for the updated index in db tables.
    1 point
  19. You mean something like this? Those are 3 fields within a repeater given individual widths, in this case 30%, 35% and 35%...the rest PW does automatically. They could as well have been 60%, 40%, 100%. In this case, the former two would be lined up side by side and the latter drop down to its own row... If this is what you want: When editing the repeater field, under Details, where you add fields to a repeater, hover your mouse over the field name, click on the arrow that appears to the right of the field name, a modal will open up and set your width there..Fields given custom widths always have those widths displayed on the far right side of the field name when you view Templates->Basics Edited for clarity
    1 point
  20. Looking great Soma. One quick suggestion would be to update your getDatabaseSchema method to have separate indexes on the width, height and depth. Currently, your index would only be used if one queried width and height and depth, or width and height, or just width, as the order matters in a combined index. If someone tried to query height independently of width, an index wouldn't be used. Whereas if width, height and depth each had their own index (either to replace, or in addition to the existing index) then they would all have the potential of having their indexes used in PW queries. This is assuming my understanding of MySQL combined indexes is correct: if you query just depth or height there would be no index to use since it is not the first named field in any combined index.
    1 point
  21. I agree. Maybe we could manage to make the docs on the website semi-collaborative by creating a "docs collaboration" forum, from where some things would be added to the website after discussion and approval. People seem to be much more active here than in the comments on the website.
    1 point
  22. No just entering new dimensions.
    1 point
  23. Are you calculating volumes for shipping by any chance? Just one of the options that jumps out for me
    1 point
  24. Hi MarcC, maybe this module could be useful: http://modules.processwire.com/modules/schedule-pages/
    1 point
  25. That sounds like what I'll need for sure Ryan. I was going to try and get around this but I think the best solution is to have the default tab selected in version of PW that offer the "config.user.language variable" and otherwise maintain the current behavior.
    1 point
  26. I've been putting some thought into it here, and am thinking we need a config.user.language variable added to PW's JS config variable. I don't yet see another way for LanguageFieldTabs to identify the current user's language. Let me know if this sounds like what you'd need, or if you had another idea? Also, I just submitted a PR to you that makes the empty vs. populate state of LanguageFieldTabs work with CKEditor inline mode, and also makes makes that state a little more more useful for the page name (2.3.2+/dev branch).
    1 point
  27. uh...I've tried the Multi Page Name Core plugin again and this time I think understood it right...so no need for trees anymore, I guess. I'm still figuring out how to do the menu thing etc, but I'll report back asap *Update* Alright. I filled in all the fields, not too much since I only need title + body. Now I read up here: http://processwire.com/api/multi-language-support/multi-language-fields/ and I'm trying to follow Front End Example 2. But I get a error when trying to enter the site: "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Error has been logged." Any ideas whats wrong? Perhabs I should mention, that I'm using double subnamespaces for testing. PW site is subns.domain.com and I followd the example 2 by adding en.subns.domain.com for english and same way for spanish.. Sorry, I'm a bit in a hurry and obviously I'm trying to solve it too fast. Found the problem, I used the wrong URL in head.inc (I linked to language title instead of name; "$languages->get("spanish");" didn't work, "$languages->get("es");" works now!
    1 point
  28. I think the problem is the spaces here: eventStartDate >= $today Try: eventStartDate>=$today Also, in case you don't know about it already, check out this module for testing selectors: http://modules.processwire.com/modules/process-selector-test/
    1 point
  29. WOW! Martijn I love this idea, fantastic. I see this becoming a must-have for many of my clients. Thanks. PS: I'm ok with the name, but if we're suggesting hmmmmnnn, maybe ImageInterceptor or ImageMaster ... ImageCommander or simple ImageRules?
    1 point
  30. Ha! I had a feeling this fit better in PW. Thank you so much for the explanation! And, "parent.on_frontpage=1" that is really really nice! If I can convince the client to make the jump I'll post my progress here. I would start by simulating this setup to see what response times I'll be getting. cheers, J *ps. didn't know about the spaces thing, good to know.
    1 point
  31. I guess this wasn't a newbie question, just a dumb one. Its working now, I changed the table name END bit on that SQL table to lower case, the modx revo config php files had less settings. Thanks Ryan again for pointing me in the right direction and congrats on the CSV import module, it can speed up site production by 200%.
    1 point
  32. PW also uses $_SESSION, so there's no harm in using it. It's not going to break anything if you use both $_SESSION and $session. But one thing to note is that PW keeps $session variables in a namespace within $_SESSION. So while you can use $_SESSION or $session, you can't access the same variables from them, i.e. $_SESSION['first_name'] will not be accessible via $session->first_name, or the other way around.
    1 point
  33. The more simpler and direct way for a custom select would be: $sel = $modules->get("InputfieldSelect"); $sel->attr("name", "cms"); $sel->addOptions(array( 'pw' => 'ProcessWire', 'joomla' => 'Joomla!', 'wp' => 'Wordpress' )); // setting the value will select the option, here with coming either from post or the default $sel->attr("value", $input->post->cms ? $input->post->cms : 'pw'); echo $sel->render();
    1 point
  34. you would decide which pages need to have that tag, so for example if they were all pages of a certain template named "something" you would use this in the head: <?php if($page->template == 'something') { ?> <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> <?php } ?> or if you had a checkbox called "no_robots", then like this: <?php if($page->no_robots == 1) { ?> <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> <?php } ?>
    1 point
  35. Here we go: https://github.com/apeisa/CommentRatings
    1 point
  36. To debug this kind of things the best thing is to look at the markup without javascript to know if the problem is with php or js. Sometimes it's enough to just remove the slideshow class or ID.
    1 point
  37. Finally had a chance to test this new functionality and have been really impressed. For those wanting to try, here are the steps that I went though using the default site profile. In the following examples I am adding two languages English and German where the pages will be viewable with the language code preceding the url like /en/ and /de/ 1.Install the latest development version - here is the zip download - https://github.com/ryancramerdesign/ProcessWire/archive/dev.zip 2. Install these 3 modules - Languages Support - Languages Support - Fields - Languages Support - Page Names 3. Add a new language via the Languages setup page - I think naming here is only relevant for your code and does not affect the URL of the page 4. Open up the home page and look at Settings tab - the name (url) field should now have a field for each language you have added. Add an indicator for each language like /en and /de English /en/ Deutsch /de/ This acts as a language gateway for changing the language. Now when ever you visit the site via /de it will set the users language to German and all the pages in the site will display the correct German language url. note: I have not worked out how to redirect the default language (which is English) to /en - it always goes to the site root / 4. Add a simple language navigation switcher. This will allow users to switch the current page into the other language. Edit : Refer to WillyC and Ryans language switcher further down - http://processwire.com/talk/topic/2979-multi-language-page-names-urls/page-3#entry33537 echo '<ul>'; $lang = $user->language; $langname = $lang->name == 'default' ? 'en' : $lang->name; $user->language = $languages->get('default'); $cssClass = $langname == 'en' ? 'class="active"' : ''; echo '<li '.$cssClass.'><a href="'.$page->url.'">EN</a></li>'; $user->language = $languages->get('de'); $cssClass = $langname == 'de' ? 'class="active"' : ''; echo '<li '.$cssClass.'><a href="'.$page->url.'">DE</a></li>'; $user->language = $lang; echo '</ul>'; I think that is pretty much it. All other PW development procedes as normal. I also just switched over from the LanguageLocalizedURL module on one site - it was actually pretty easy to do - just uninstalled the module and went through the steps above - thanks soma and mcmorry for the original module - it was very useful at the time, but will be moving over this mainly so I can start using the ProCache module. I have tested the new language fields with ProCache and it also works great! Super fast, one tree multilingual sites, with the same ease as developing a regular processwire site - this is so cool!
    1 point
  38. I just moved a site from my local MAMP to the production server and could not login. I tried everything suggest here in the forum, but the "forged" message remained. Because I did not want to upload all sessions I excluded the "/site/assets/sessions/" folder when uploading the site by ftp. As soon as I created the "/site/assets/sessions/" folder by hand on the server everything worked again. Conclusion: Remember that you need these folders: /site/assets/cache/ /site/assets/logs/ /site/assets/sessions/
    1 point
×
×
  • Create New...