Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/12/2015 in all areas

  1. 9 points
    This is a new version of Yahoo! Weather module for ProcessWire, old version of the module can be found at this link. The module has been rewritten, new options have been added alongside with caching from the API (Yahoo! API allows 20.000 calls per hour when using free version, so it comes in handy if your site has a lot of page hits). I've also updated icons in the package (you can easily swap them with yours in module icons folder). You can grab the module from the Modules page or directly from Github link. Update 1.0.1 Yahoo changed their forecast API URL (http://xml.weather.yahoo.com/ instead http://weather. yahooapis.com/), tiny update in Github repo. How to use You can call the module in two different ways: This is a basic call that renders the module, use this if you want only one instance of the module shown with WOEID set in the module settings. <?php echo $modules->get('MarkupYahooWeather')->render(); ?> If you want to show multiple instances of the module, call it this way: <?php $weather = $modules->get('MarkupYahooWeather'); $weather->woeid = 12587912; // Decatur, USA echo $weather->render(); $weather->woeid = 44418; // London, United Kingdom echo $weather->render(); ?> Options This module has the following options: Yahoo! Weather WOEID WOEID (Where On Earth ID) is an unique identifier for each city, you can easily find WOEID by using this site: http://woeid.rosselliot.co.nz. Default = Zagreb Set Locale Sets PHP locale, needed for localized date display. Default = en_US.UTF-8 Set Encoding Converts international date names to right format. Default = ISO-8859-1 Date Format Sets desired date output, formatted with PHP strftime function. Default = %A, %d.%m.%Y. Cache Time Cache time in minutes, caches .xml file(s) retrieved from Yahoo! API and pulls the data locally. Default = 5 minutes Display temperature in Fahrenheit instead of Celsius? Show weather conditions in Celsius or Fahrenheit scale (temperature: C/F; wind speed: km/h, mph; sunrise and sunset: 24h, am/pm). Show 5 day forecast below current weather forecast? Shows extended 5 day forecast, if unchecked, only current weather will be shown. Default = Checked Show wind direction and speed? Shows wind direction and speed. Default = Checked Show sunrise and sunset time? Shows sunrise and sunset time. Default = Checked Autoload script and stylesheet? Renders script and stylesheet during page render, if you prefer to include them manually, turn this option off. Default = Checked Load script in the bottom of the page? If "Autoload script and stylesheet" option is checked, you can select where script should be rendered automatically, before the end of head or body tag. Default = Unchecked Delete Weather Cache Deletes locally stored and cached .xml file(s) from Yahoo! API for all instances of the module.
  2. 9 points
    Hi, i just launched my litte blog orkork.de It's a german blog about nerdy topics like IT, development, photography, games, movies and more. Responsive design, built on top of bootstrap. Different teaser types and widgets are configurable in the backend, for every category node. I use require.js for the internal js stuff and use gulp as a building tool for less compilation and css/js minification. unveil.js manages lazy loading of images, including retina versions. Though, it's not heavily optimized yet, but you have to start somewhere I would love to get some feedback, if you have any! Cheers
  3. 6 points
    I made this into a blank site profile. Download and instructions here. Tested on a new PW install and it is working fine. Maybe some of you want to test it in other environments and let me know if I need to amend the README. Thank you.
  4. 6 points
    Made my own ProcessWire T-shirt: http://i.imgur.com/FBWb59Q.jpg
  5. 5 points
    You want to display pdf files as pages in frontend? Go here: Create a template file 'showpdf.php' <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="' . basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); Create field 'pdf' of type file and add it to your template. Create a page using the template 'showpdf.php' Add pdf to page field 'pdf'. Done. To get save option instead of display use 'attachment' instead of 'inline' like header('Content-Disposition: attachment; filename="' . basename($file).'"');
  6. 2 points
    Pete would definitely know...so let's wait for his input
  7. 2 points
    Hi, I'm still learning about PW but I have had a little experience of Concrete5. Whilst I liked C5's editability and readiness of templates/themes, I found many Concrete5 sites were invariably slow (and sometimes very slow) to load.... something which Google doesn't like, so it was fairwell C5. I now have to figure out front end development to get a PW site up and running as I am not a developer (Joss has been my inspiration here), but the example PW sites all load quickly. Regards.
  8. 2 points
    Nice! The latest additions to the dev branch add support for content types on the template level. http://processwire.com/blog/posts/processwire-core-updates-2.5.26/#content-type-support-added-to-templates
  9. 2 points
    New testing FrontendUser module could be replace FrontendUserRegister and FrontendUserLogin module. It requires FormHelper (0.7.1+) Repo: https://bitbucket.org/pwFoo/frontenduser/src FrontendUserLogin Details: https://processwire.com/talk/topic/8001-frontenduserlogin/?p=92538 Simple / basic login / logout module error handling default and custom styles / scrips extendable with plugins (PW hooks!), examples: login with email address instead of username, PersistLogin and ProcessForgotPassword integration FrontendUserRegister Simple / basic user register module (username, email, password) error handling default and custom styles / scrips extendable with plugins (PW hooks!), examples: further down FrontendUserRegister (simple usage) Only use basic fields and features. $fu = $modules->get('FrontendUserRegister'); $content = $fu->render($redirectAfterRegister); AddRole plugin Really simple plugin / hook to add a default role before user will be saved $fu = $modules->get('FrontendUserRegister'); $form = $fu->form(); $fu->addHookBefore('saveUser', function($event) { $user = $event->object->attr('userObj'); $user->addRole('superuser'); }); $content = $fu->validate()->process()->renderForm(); Display name plugin Username will be sanitized as username, but you could add a field "nickname" to the user template with username value sanitized as text instead of username. // Dispay- / Nickname $fu->addHookBefore('saveUser', function($event) { $fu = $event->object; $form = $fu->attr('form'); if(!count($form->getErrors())) { $fu->attr('userObj')->nickname = $form->fhValue('username', 'text'); } }); Pre-validate email address plugin A more complex plugin to add a additional register step. It removes the password field and adds an validation code input field. After submit username and email address you'll get an email with a validation code. Second step enter the code and a password to register a PW user. The code includes some debugging information / output because it needs more testing... $fu = $modules->get('FrontendUserRegister'); function validationCodeField() { $validation = wire('modules')->get('InputfieldText'); $validation->attr('id+name', 'EmailPreValidation'); $validation->placeholder = 'Email validation code'; $validation->skipLabel = 4; $validation->required = 1; return $validation; } // modified / extended register form $form = $fu->form(array('username', 'email', validationCodeField(), 'password'))->attr('form'); $form->addhookBefore('processInput', function($event) { $form = $event->object; var_dump(wire('input')->post); echo "<hr />"; if (empty(wire('session')->get('registerStep'))) { $form->get('password')->required = false; $form->get('EmailPreValidation')->required = false; } }); $form->addhookAfter('processInput', function($event) { $form = $event->object; $user = $form->get('username'); $email = $form->get('email'); if (!empty(wire('session')->get('registerStep')) && wire('session')->get('registerEmail') !== $form->fhValue('email')) { wire('session')->remove('registerStep'); $form->get('EmailPreValidation')->value = ''; $form->fhSubmitBtn->error('Validation broken by email address mismatch!'); wire('session')->redirect(wire('page')->url, false); } elseif (empty(wire('session')->get('registerStep')) && !count($user->getErrors()) && !count($email->getErrors())) { echo "SET Session values!<br />"; wire('session')->set('registerToken', md5(uniqid(mt_rand(), true))); wire('session')->set('registerUsername', $form->fhValue('username')); wire('session')->set('registerEmail', $form->fhValue('email')); wire('session')->set('registerStep', 1); // Send validation code email wireMail($form->fhValue('email'), null, 'Email address pre-validation', "Validation token: " . wire('session')->get('registerToken')); } elseif (!count($user->getErrors()) && !count($email->getErrors())) { if ($form->fhValue('EmailPreValidation') != wire('session')->get('registerToken')) { $form->get('EmailPreValidation')->error('Email validation code NOT match!'); } } }); $form->addhookBefore('render', function($event) { $form = $event->object; if ($form->fhState === null) { wire('session')->remove('registerStep'); } elseif (wire('session')->get('registerStep') === 1) { $form->fhSubmitBtn->getErrors(true); } if (empty(wire('session')->get('registerStep'))) { $form->remove($form->get('password')); $form->get('EmailPreValidation')->attr('disabled', true); $form->fhSubmitBtn->value = 'Send email validation code'; echo "RESET Session values!<br />"; wire('session')->remove('registerToken'); wire('session')->remove('registerUsername'); wire('session')->remove('registerEmail'); } echo "RegisterStep: " . wire('session')->get('registerStep') . "<br />"; echo "Username: " . wire('session')->get('registerUsername') . "<br />"; echo "Email: " . wire('session')->get('registerEmail') . " == " . $form->fhValue('email') . "<br />"; echo "Token: " . wire('session')->get('registerToken') . "<br />"; }); $content = $fu->validate()->process()->renderForm();
  10. 2 points
    Guys, that was not meant to be an analogy between php/(other languages) vs sql/(other DBs). What I meant is that PW is built to work with PHP and MySQL, and it does it very well. I don't think Ryan felt at any time that these two are limiting the functionality of PW, and as a big bonus, these are the easiest conditions to find in any hosting. IF there was an analogy, than that's the one I used. Exactly! I think we all agree with this. At this point, Ryan filters and rewrites any piece of code that enters the core. Until now he's proved that this is the best way of keeping the reliability of the code https://processwire.com/talk/topic/9254-dev-and-master-versions/
  11. 1 point
    Update: version 0.0.9 Fixed the issue whereby 'current_class_level' was not being correctly applied in cases where 'current_class' is applied beyond included children into native MB menu items. In dev branch for now.
  12. 1 point
    Maybe...tried with Blog and now it works...
  13. 1 point
    I've tried this before as well, and it didn't work...gave up quickly ...
  14. 1 point
    I think it has nothing to do with staff or member status. On your screenshot you see kongondo also without a badge and he belongs to staff. My own experience is that, everytime I tried to get such a modules badge into a post of mine, IP.board doesn't do it for me. (But I'm staff, too) I think I haven't done it right or IP.board is a bit weird here. And there are other examples where members (not staff) have badges of request in the subject. I will try to update one of my modules first posts without a badge to get a badge displayed and come back here to tell you what happened. EDIT: now I was able to get a module badge in the subject of WireMailSmtp. Before it wasn't shown. Also I saw Module-Threads from Ryan without badges. Maybe this badge thing is an addition that once came along with an IP.Board upgrade as the forum allready contained a lot of threads.
  15. 1 point
    Thanks Adrian, finally it should be: $file = $page->pdf->filename; It doesn't work with url here. Don't know why? Got it: readfile() needs fullpath! Added filesize-header. To force download it should be 'attachment' instead of 'inline' <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="' . basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file);
  16. 1 point
    Hey guys - sorry for the migrator issues here. I know that Macrura did a migration of pages with a page field that linked to users (I think that is correct). As I mention a couple of posts above, I think this is because of the way I have migrator grab and recreate the content of page fields on the destination site. Usually this isn't a big deal, but I need to change some behavior so it doesn't mess things up when linking to system pages like in this case. It's on my list to sort out!
  17. 1 point
    Just a thought on this. It looks like this will result in URLs like: mysite.com/documents/mydocument/ that will directly display a PDF. Correct? Maybe it's just me, but I always like to know when I am about to open up a PDF - it gives me the option to save instead, or open in a new tab, or decide not to open because I am on mobile don't want to wait for a potentially huge PDF file to open. Maybe this is becoming less of an issue now that browsers are directly rendering PDFs themselves, or sites are using mozilla's pdf.js etc. Anyway, just my two cents worth PS, given that you are using a file field, shouldn't: $file= $page->pdf; be: $file= $page->pdf->url;
  18. 1 point
    Thx for this Kixe.Looks like a tutorial to me. Shall I move it there?
  19. 1 point
    nice! gonna need one of those soon
  20. 1 point
    Just bumped into this nice little article from last year. I, too, would like to share PW with fellow South Africans, which I'll be doing when I release my new website in the coming months. Here's the article: jansieblom.co.za/perfect-cms/
  21. 1 point
    A quick test shows it works fine for me with GD if I use 24bit PNG with transparency as overlay. I used this code for the final image: $img->crop("width=300, height=200, quality=100")->pimLoad('graywm')->setQuality(90)->grayscale()->watermarkLogo($wm, 'c', 0)->save()->url original image cropped via pia + = using Pim to grayscale + transparent png overlay with colored area the result looks good to me ---- Going one step further and using a pure grayscale overlay (with gray area, not a blue one) enables to change the color on the fly and produce different outputs: $color1 = array(100, 100, 0); $wmColor1 = $wm->pimLoad('color1')->setQuality(100)->grayscale()->colorize($color1)->save(); $img->crop("width=300, height=200, quality=100")->pimLoad('color1')->setQuality(90)->grayscale()->watermarkLogo($wmColor1, 'c', 0)->save()->url original + grayscaled using Pim + overlay in gray final image with yellow colorized overlay ------- @Pierre-Luc: maybe there are parts I'm not aware of in your case, but GD isn't that bad in many regards. So, it is very bad in regards of transients and smooth transparencies when it comes to dynamically create and overlay parts. EDIT: Ah, sorry, I have not looked / read very thoroughly your post. You want use composites with modes and that isn't handled at all by GD. It is not a simple overlay with transparency.
  22. 1 point
    I definitely go with PWs API first. I always follow the strategy that the original uploaded image never gets outputed as is. Therefore I'm able (and it is highly recommended) to upload images with full quality! (Photoshop JPEG: Quality = 12) You need to keep full quality (PW: quality = 100) for every intermediate step. Only with the last step, that produces an image for output, you need to apply a lower quality setting, e.g. 80. Example manipulation with watermarking, (using PW API with PageimageManipulator): // create ImageObject from fullsize WatermarkImage $wmPng = $pages->get('/mytoolspage/')->watermark; // create a fullsize image with watermark and quality 80! (the global $config->imageSizerOptions quality is set to 80, so don't need to set it here again individually) $image->pimLoad('full')->watermarkLogo($wmPng)->pimSave(); // create a medium sized image with watermark and quality 75! $wmPngMedium = $wmPng->width(960, array('quality'=>100)); $image->width(960, array('quality'=>100))->pimLoad('medium')->watermarkLogo($wmPngMedium)->setQuality(75)->pimSave(); // create a small sized image with watermark and quality 68! Now we first apply the (full) watermark and scale down afterwards: $image->pimLoad('small')->watermarkLogo($wmPng)->setQuality(100)->pimSave()->width(480, array('quality'=>68)); . If you want apply those or other manipulations direct on upload, you can go this way: // is called on hook: addHookBefore 'InputfieldFile::fileAdded' public function prepareUploadedImage($event) { $inputfield = $event->object; if ('images' != $inputfield->name) return; // we assume images field !! name of the field is: images !! otherwise change it $p = $inputfield->value['page']; // get the page if ('album' != $p->template) return; // don't do it on other pages than albums $image = $event->argumentsByName("pagefile"); // get the image // do the image manipulations $image->size(900, 600); $image->size(600, 400); $image->size(300, 200); ... } If you want to apply the watermarks on uploading, you have to use the identical API calls in the autoload module than you do in the templates: // is called on hook: addHookBefore 'InputfieldFile::fileAdded' public function prepareUploadedImage($event) { $inputfield = $event->object; if ('images' != $inputfield->name) return; // we assume images field !! name of the field is: images !! otherwise change it $p = $inputfield->value['page']; // get the page if ('album' != $p->template) return; // don't do it on other pages than albums $image = $event->argumentsByName("pagefile"); // get the image // do the image manipulations $image->size(900, 600); $image->size(600, 400); $image->size(300, 200); // create ImageObjects from WatermarkImage $wmPng = wire('pages')->get('/mytoolspage/')->watermark; $wmPngMedium = $wmPng->width(960, array('quality'=>100)); $wmPngSmall = $wmPng->width(480, array('quality'=>100)); // create variations with watermark $image->pimLoad('full')->watermarkLogo($wmPng)->pimSave(); $image->width(960, array('quality'=>100))->pimLoad('medium')->watermarkLogo($wmPngMedium)->pimSave(); $image->width(480, array('quality'=>100))->pimLoad('small')->watermarkLogo($wmPngSmall)->pimSave(); } . You can also use Pia within those chains if you like to use one of her shortcuts: $image->contain("square=1200, quality=100")->pimLoad('max1200')->watermarkLogo($wmPng)->setQuality(75)->pimSave(); . Summary: upload quality = 100% every intermediate quality = 100% final quality = is the only quality lower than 100% This way you produce very fine images, even with GD-lib.
  23. 1 point
  24. 1 point
    I used neo4j for two projects in my studies. One of them was to visualize the GitHub network with User/Repository nodes and their connections over edges like "follows", "stars", "contributes", "owns" etc. I do like neo4j and the cypher query syntax and it was the right choice for this project. However, for ProcessWire I don't see any advantage in using this database, simply because 99% of the apps written in Pw are fine with the tree. With page references you have endless power in modeling other relations than parent-child. For me, a graph database makes sense if you need queries like this: Shortest path between two nodes Get me all common nodes over at most 4 hubs Fire a query from a known start node and return an (unknown) amount of target nodes of type X over edges Y ... If the underlying data structure is a graph and I must answer those type of questions, I would not choose ProcessWire to handle the job. Another problem of neo4j is that it's not that fast, at least in my experience. And they recommend 16-32 GB RAM, this is simply too much for a "normal" web app Cheers
  25. 1 point
    Not sure your exact scenario, but I have made use of: $this->addHookBefore('InputfieldPassword::processInput', $this, 'removeRequired'); public function removeRequired(HookEvent $event) { $event->object->required = false; //hack to remove required status on password field } From memory it's not possible to set the status of the password field directly to not required. I know this is not the same as disabled, but now you should be able to disable or hide it and should work as expected I think. One thing to keep in mind, the system password field is actually named "pass", not "password" like you have there.
  26. 1 point
    At this point it's a bit like asking to drop php in favor of go. PW is a php/(my)sql framework by nature, and that's what it will continue to be. I would love to see other projects assumidely inspired by pw but built in other systems popping up.
  27. 1 point
    There isn't even support for things like sqlite oder postgree, even though there where requests for it, so I'll doubt others will be adopted in a near future. One has to keep in mind, ProcessWire is developed by Ryan only. He really has to put his work into the meat and by now it really does not make sense for a cms to support an other database than mysql if there isn't the time to support multiple databases.
  28. 1 point
    Hello, PageTable is described as a leaner way to enter large amount of repeatable data into the admin backend, possibly with different sets of fields (think different templates). The main advantages compared to the Repeater are: 1. PageTable can save new pages where you tell it to. Repeaters are saved deep down the Admin pages and are given cryptic names. 2. One PageTable field can make use of several different templates. Repeaters play according to the "One repeater = one template" rule (roughly put). PageTable is a PageArray, so relevant methods are applicable. For example, here is how to add and remove items from a PageTable field using the PW API: // create a new page // IMPORTANT: your PageTable field must be configured to use template 'basic-page' in the field Setup tab $newpage = $pages->add('basic-page', '/about/', 'address', array('title' => 'Write to us')); $page->of(false); // add the newly created page to 'pt' which is a PageTable field $page->pt->add($newpage); $page->save(); Here is how to remove the first item from a PageTable field: $page->of(false); // 'pt' is a field of type PageTable $page->pt->get(0)->delete(); $page->save(); That's a quick overview of this new field type. Give it a bit of your attention, it's quite promising. Cheers, Valery.
  29. 1 point
    The way I see it, ProcessWire is designed for this sort of thing as it's a CMS framework. One can pretty easily build a CMS on top of it and that CMS can have a ready-to-go starting point for just about everything you could want at the lower level. Page, field, data management, API, hooks, access control, etc. One never even has to use database queries (though there's a database API var too called $db, if you want it). All of this is driven around an accessible API, and all the complex stuff happens behind the scenes. The front-end Admin that you use in ProcessWire is basically just a web site/application that's built using that API. ProcessWire is a more flexible framework than most in that it doesn't try to force you into anything. If you don't want to use some part of it, you don't have to. You can put your files where you want to. If you want to use MVC, great. If not, no problem. ProcessWire is not your mom. It's meant to be your friend like jQuery. If another project picks up ProcessWire as a back-end CMF, I think that only benefits both projects. It's also a good opportunity to actively maintain a separate pure-framework version of ProcessWire, which is something that I've wanted to do, but didn't think folks would be interested. ProcessWire was a framework long before it was a CMS. The framework is already there (by using the include/bootstrap), so the framework version would basically be a blank version with nothing but a root, 404 and trash page (no admin pages). The only issue I see from the framework perspective is namespace. ProcessWire was originally designed with PHP 5.3 namespaces in mind, so it has some pretty generic class names like "Database". Such class names could very well conflict with another application. So we'd likely rename our classes to be more PW specific, or we'd make PHP 5.3 a requirement and bring namespaces back into the fold.
×
×
  • Create New...