Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/07/2014 in all areas

  1. https://github.com/BBC-News/Imager.js/
    6 points
  2. I have updated the class to version 0.0.5 and also have edited the first post of this thread (added some short examples and a list of available options/methods). Now per default the module sends multiple messages in a loop, (one for each TO-recipient) like the base class do. Additionaly you can call sendBulk to send larger amount of messages at once in an optimized manner, - or you can call sendSingle to set the module to allow only one TO-recipient but additionally CC-recipients. More information are now in the first post here.
    5 points
  3. Hi Zahari, $yourRegularLimit = 10; $cur = $input->pageNum; $max = intval($pages->find("$yourSelector, limit=2")->getTotal() / $yourRegularLimit); // limit = 2 so it is fast and uses less memory! $next = $cur<$max ? $cur + 1 : false; $prev = $cur>1 ? $cur - 1 : false; echo '<link rel="canonical" href="http://site.com/parent/page' . $cur . '/" />'; if(false!==$prev) echo '<link rel="prev" href="http://site.com/parent/page' . $prev . '/" />'; if(false!==$next) echo '<link rel="next" href="http://site.com/parent/page' . $next . '/" />'; Not tested, just to ge you started,
    5 points
  4. Just because that person didn't say design the site, doesn't mean they can't put their credit on the site, and that doing so is not ethical – there are a lot of other of web people out there like 'web producers' not designers; Using a template is sort of like them outsourcing the design part of the job. Sometimes being able to find the right CMS and template for a client, and then making it work (modifying) a certain way for that person's needs and budget is a perfectly respectable skill. Not all clients can afford the additional cost that a totally custom designed site demands. What would make it unethical is if the terms of purchasing the template specified that credit needed to be given to the template designer but none was. Usually those themeforest templates don't require that you maintain the credit to the design company, but it's nice to do it anyway. I've worked on sites that needed to be custom designed from the ground up, because the reputation of the company, their unique business logic, and visual branding required it, and no pre-made template would have worked; These clients come in with an expectation of the true cost of having a totally unique site; Other clients are perfectly happy to use a generic template, or themeforest template, and don't care at all that the site will always have that more generic look. I think the big issue with digitex's ex-client regards if said client fancy's themselves a web designer and yet does not possess a deep interest/understanding of HTML, CSS, JS, PHP, as well as have experience with linux, web hosts, security, apache and other emerging topics of relevance to the industry; Without those skills said individual will be useless when it comes to customizing the template, configuring backups, security, caching, asset minification and other things we all take for granted on this forum. I had a very similar experience with a large company that i was trying to pitch their corporate site to be done in Processwire; they eventually went the cheap route, used WP and a template. I recently looked at the site and it's not good, and very slow; no gzip, no asset min, no caching; plus a totally generic and not-slick look, which is sad because this is a really big company who's site should look much more pro.
    5 points
  5. Quick tip: you can also use $pages->count($yourSelector) to get the number of matching pages. That's just a shorthand though, under the hood it does exactly what @horst did earlier
    4 points
  6. I have the new version of AIOM+ uploaded (3.1.2). From this version it is now possible to disable the directory traversal filter. Also, the LESS parser was updated. Now compatible with the official LESS version 1.7.
    4 points
  7. Yes...there are modules for this here: http://mods.pw/2y - hide/unhide http://mods.pw/2U - delete http://mods.pw/2z - publish/unpublish
    3 points
  8. Yes, same with me! As a sitenote, if you like a post here in the forums (any post, not only that in your threads) you can show that by clicking the [like this] button. This is a forums internal system, not fac*bo*k. There is no harm to use it (I remember that I first realized this after 4 weeks posting and reading here)
    3 points
  9. @teppo: I think logging is mandatory, even if you throw an exception. Also doing an automated fallback from SMTP to php-mail, without the users knowing isn't good in my opinion. Per default I would raise an error (and log it), but would give a configuration setting under advanced (or something) where the user have the possibility to enable that useful behave. If he check that option, _he_ has done so and not _you_, means he has at least be informed about that behave one times. I'm a big fan of (automated) corrections for the user with missconfigurations, but with emails are a million possibilities given. Maybe on a company site they must use SMTP through a special company server to send company-internal messages, it could be that there are very restrictive settings and a mail from php-mail gets blocked and never reaching the recipients. (Sure, a rare case, but may be possible).
    3 points
  10. Ok horst and teppo... My head was spinning at first as I couldn't work out how to make my selector = child pages in the line below: $max = intval($pages->find("$yourSelector, limit=2")->getTotal() So what I did was: $currentPage = $page->id; then $max = intval($pages->find("parent=$currentPage, limit=2")->getTotal() / $maxPerPage); That got me my child pages and thus my $max value. The next problem I had was the next page link wasn't displaying a page number. This turned out to be here after some headscratching.... $next = $cur<$max ? $cur + 1 : false; When I changed the less than sign < to less than or equals <=, then that got it to work! Next thing was I didnt want to see "page1" on any of the urls. And so I set up a switch arrangment to provide me with the exact markup / structure that I wanted....a major reason why I love processWire !!! I have some ideas you see ... but not the skills like many of you great helpful guys here..... Anyway.... this is what I have come up with so far.... no coffee yet... but will have that right after posting this.... and drinks later tonight! // SEO - CANONICAL & REL SECTION: $maxPerPage = 10; $currentPage = $page->id; $curPageNum = $input->pageNum; $max = intval($pages->find("parent=$currentPage, limit=2")->getTotal() / $maxPerPage); // limit = 2 so it is fast and uses less memory! $next = $curPageNum <= $max ? $curPageNum + 1 : false; $prev = $curPageNum > 1 ? $curPageNum - 1 : false; switch ($input->pageNum){ case '1': echo "<link rel='canonical' href='$page->httpUrl'>\n"; if(false!==$next) echo "<link rel='next' href='$page->httpUrl" . 'page' . "$next" . "/'>\n"; break; case '2': echo "<link rel='canonical' href='$page->httpUrl" . 'page' . "$curPageNum/'>\n"; if(false!==$prev) echo "<link rel='prev' href='$page->httpUrl'>\n"; if(false!==$next) echo "<link rel='next' href='$page->httpUrl" . 'page' . "$next" . "/'>\n"; break; default: echo "<link rel='canonical' href='$page->httpUrl" . 'page' . "$curPageNum/'>\n"; if(false!==$prev) echo "<link rel='prev' href='$page->httpUrl" . 'page' . "$prev" . "/'>\n"; if(false!==$next) echo "<link rel='next' href='$page->httpUrl" . 'page' . "$next" . "/'>\n"; break; } So horst, thanks so much for helping out! Teppo thanks for coming in. If you guys were here I would buy you a nice cup of coffee! Cheers guys! Thanks a bunch!
    3 points
  11. Hi Bbeer, you can try the sharpening option values: $options = array( 'cropping' => 'center', 'sharpening' => 'medium' // none | soft | medium | strong ); You may also check your default setting in the site/config.php file: $config->imageSizerOptions = array( 'upscaling' => true, // upscale if necessary to reach target size? 'cropping' => true, // crop if necessary to reach target size? 'autoRotation' => true, // automatically correct orientation? 'sharpening' => 'soft', // sharpening: none | soft | medium | strong 'quality' => 90, // quality: 1-100 where higher is better but bigger ); EDIT: if you want to test out different settings, remember to use $thumb->removeVariations() before creating the new thumb.
    3 points
  12. You lost a client but you won expierence in the business. Never say a bad word about him because of 3 reasons: it will backfire at you sooner or later people won't take you serious people will see you at his level If people compare you and refer to him and his way of doing web business say that you can tell them how you are doing your web business and how it can fit their needs. Make people see your profile. Say that you studied the market and customer needs and made a choice for a specific cms/cmf. You do the templating and coding but deliver easy editable fields for the client. Mmmm what cms/cmf might that be - - - Mr. bloated goat won't be able to build decent client relation ships which is a key part in expanding a web business. Good client relations will always bring more clients.
    3 points
  13. Hello guys, long time listener, first time caller (or something like that) Night Attack is the new independant version of the NSFW show podcast hosted by Brian Brushwood and Justin Robert Young. And I'm sure you'll all be happy to hear it's powered by ProccessWire. The quick feature list: Processwire 2.4.0, nginx + php 5.5.9 with cloudflare in the front Includes 3 different quality podcast feeds (all based on the data on episode pages) Uses the alternate template filename for render, wrapper has this at the top: // Get the page content ob_start(); include "{$page->template}.php"; $content = ob_get_clean(); and then content is output with <?= $content; ?>. This way the templates can even be just html Made in less than a week (might had started 4~5 days before going live, can't remember) Modules: AIOM+, Page Edit Soft Lock, Piwik Analytics and a custom module to ensure rss feeds have correct content type when cached I mainly focused on the code side while the design was done by sebgonz.
    2 points
  14. Lance, That page has not been updated.... Here's the actual requirements (aka officially supported) https://github.com/ryancramerdesign/ProcessWire http://processwire.com/about/news/introducing-processwire-2.4/ Although, I think I read somewhere in the forums that some people have managed to use it with PHP 5.2.x... Edit: Squeeze seems to be Debian 6?
    2 points
  15. @horst: thanks for your input.. and your rare case is actually quite familiar for me, so I definitely get that Fallback I mentioned earlier was actually intended as sort of an "installation helper", so that if you install the module on a server where PHP's mail() works (but you just don't want to use it or would prefer to use something else), it won't break anything. Running start, kind of. Thinking about it now, a better solution for that might be setting the module to use Mail by default.. after that I could safely assume that if SMTP is selected but misconfigured, it's user error and exception should be thrown. This module can, after all, be used for Mail and Sendmail too, even though SMTP seems generally speaking most useful option and Mail definitely the least useful one.. Will have to give this some more thought, though. So far none of the options available seems to be clearly the best way to go. In any case you're definitely right in that it's not always possible (or even sensible for that matter) to attempt correcting mistakes user might've made.
    2 points
  16. @MikeB: no worries, this is just about as good as any other place to ask questions Great timing here, too. Just today I wrote in another thread that integers (such as 32 for version 0.3.2 or 132 for version 1.3.2) feel wrong to me because they can only handle a subset of version numbers. Integers are the default you'll see used a lot, but you can (and, when it's useful, should) use strings like '1.3.12' instead. It should work everywhere just as well as integers (and if it doesn't, that's most likely a bug).
    2 points
  17. It doesn't particularly need to be in a function, also I'm not sure why you're using wire() since in a template you can just use $page directly - anyway, you can get rid of the } else { if you start it a bit like this instead: $out = ''; // Starting with this means you don't need } else { as it's defined and empty to begin with if ($page->slider->count() > 0) { // There's no overhead in just doing this count directly instead of assigning it to another variable // ... more of your code here foreach ($page->slider as $albumimage) { // Again, you can just user $page->slider directly here // ... the rest of your code here
    2 points
  18. I hope this is not off topic, and is also not the incorrect place to ask this. I am still learning how to interact with the forums, especially for support/questions. Anyway, can someone help me with the following. I am looking to include a plugin via a module. One sticking point in my understanding of the module construction is the 'version' number. I can see and understand the way this is offered up in module 'info'. However, many of the plugins I come across have 2 digit revisions. I.e. 1.3.12 How do we handle this with the 3 digit total for version numbers. Should above be 1.3.1 giving 131 or 1.3.2 giving 132 This can lead to problems. Or am I completely wrong in my understanding.
    2 points
  19. Hi horst! Many thanks for this horst! I was looking at php's mathematical functions and the modulus operator and did come across getTotal() in the API. But couldn't workout how to arrange them to do the necessary last page check I needed. I see above that you use intval. I have never ever come across that before horst! It kinda seems to be exactly what I was looking to try and do with all the above mentioned items. Yay! I still don't fully understand how your code works just yet. But that's good! I'm going to go and have some lunch, find a good cafe somewhere where they serve both some good coffee and some good Shiraz. I shall start with the coffee, a good mechanical pencil, some paper and start to figure this one out step by step and expand my brains internal processing functions. Hopefully I can take my brain from a 386 to a 486 Then reward my self with some Shiraz! Or ask you for a little more assistance... Cheers horst!
    2 points
  20. We used to get this at the studios where one client would tell another client that they could act as producer, effectively cutting us out - it happened a few times. Every time it happened, however, the final result was dreadful, but still there was little or nothing we could do about it, other than refuse future business. But in a competitive world, that does not amount to much. As for your ex client - this is rather common with Wordpress in particular, but honest people will at least put "template by...." at the bottom. In my old job (films and productions) it was expected that everyone involved would get a credit, programme space allowing. The longer the list of credits, the more professional it looks, to be honest, though that does not work so well in the purely corporate environment where space/time is at a premium and the client has legitimate worries about diluting messages. The best version of false claiming of credit I ever came across was a turkish voice over who recorded a voice for a corporate video with a colleague of mine. Because the colleague was a little new to the job, I had a quick listen and was very surprised to hear a bit of extra voice over at the end which had no matching original English. A quick check with another voice over and we confirmed that the Turkish chap had given him self an audio credit for writing and producing the video (which he hadn't) and even gave out his phone number. Needless to say, he never worked again in the very lucrative foreign voice over field - it is a very small part of the industry and the story did get round pretty quickly. (Having a secretary with a drink problem and who could not keep her mouth shut had its advantages!)
    2 points
  21. Wire Mail SMTP An extension to the (new) WireMail base class that uses SMTP-transport This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times. The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only). Here are Ryans announcement. Current Version 0.8.0 (from 2024-09-25 -- initial version 0.0.1 was pushed on 2014-03-01) Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md Downlod: get it from the Modules Directory || fetch it from Github || or use the module-installer in PWs admin site modules panel with its class name "WireMailSmtp". Install and Configure Download the module into your site/modules/ directory and install it. In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature. You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts. Usage Examples The simplest way to use it: $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient. You may also use the object oriented style: $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire: $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients. $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array: $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working: $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; } A MORE ADVANCED DEBUG METHOD! You can add some debug code into a template file and call a page with it: $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage. The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one: Following are a ... List of all options and features testConnection () - returns true on success, false on failures sendSingle ( true | false ) - default is false sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+) to ($recipients) - one emailaddress or array with multiple emailaddresses cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses bcc ($recipients) - one emailaddress or array with multiple emailaddresses from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest dispositionNotification () or notification () - request a Disposition Notification subject ($subject) - subject of the message body ($textBody) - use this one alone to create and send plainText emailmessages bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback) addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here (only available if a signature is defined in the config screen) attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename send () - send the message(s) and return number of successful sent messages debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!) getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses, logActivity ($logmessage) - you may log success if you want logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here sentLogReset () - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter sentLogGet () - is called automaticly within the send() method - returns an array containing all previously used emailaddresses sentLogAdd ($emailaddress) - is called automaticly within the send() method Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
    1 point
  22. GitHub: https://github.com/adrianbj/ProcessMigrator This module has gone through lots of iterations with lots of new functionality each time. It is now a fully fledged content migration tool. *** Please be sure to read the GitHub ReadMe to find out what it can do now as most of the posts in this thread are no longer correct regarding its functionality Once it is release worthy, I'll create a fresh thread with all the details. This modules allows export, sharing, and import of page lists via JSON files. It takes care of replicating all the pages, as well as creating any templates and fields that are needed. I have defined "Page Lists" as page trees (parent and children) that store selector values for a Page fieldtype. An example would be a list of countries that would be used to populate a countries drop-down select field. The fields might include: Country Name, 2-digit code, 3-digit code, number code. I would like to suggest a place where we can post json files to be shared and updated - maybe a dedicated github repository? Start of a repo of lists ready to import is now available: https://github.com/adrianbj/ProcessWirePageLists It might handle migrating other simple pages trees as well, but it should not be considered a tool for migrating general pages as it does not handle associated files, nor does it handle fields which store arrays. Probably lots of other things it doesn't handle either It now handles migrating all (I think) field types, including repeater fields, page fields, all Profields fields, multi-language versions of fields etc. The only omission is the actual uploaded files and images in file/image fields. WARNING: This should be considered an Alpha module - please don't use this on a live site at the moment and be sure to back everything up before testing. Would appreciate any feedback on the concept, the code, and the idea of a shared and community edited resource of these files. Also, would love to hear what page lists would be good to share. Here are a few quick ideas: States (separate files for each country) Measurement units Languages Religions Race Academic subjects (chemistry, biology etc) Publication types (book, journal article, newspaper article, newsletter, thesis etc) Car makes and models Anyone have a better idea for a name, or how to better describe "Page Lists"?
    1 point
  23. This module integrates Swift Mailer mailing library to ProcessWire, providing support for three different "transports" or methods of sending email: SMTP, Sendmail and Mail (essentially PHP's native mail() function). WireMail is email-related base class for ProcessWire. See this post by Ryan for the details. Important thing to note here is that a) it's brand new, so as of this writing you'll need a fresh dev version of ProcessWire to use this and b) it makes integrating new ways of handling email-related tasks very easy. Getting started You can download or clone the module from GitHub: https://github.com/teppokoivula/WireMailSwiftMailer/. Using this module is as simple as downloading / cloning it to your modules directory and installing it. If you're going to use SMTP or Sendmail features, insert correct SMTP credentials / Sendmail command to module settings first. Third transport, Mail, is included simply because it's a native feature of Swift Mailer; if you're going to use it, I would suggest against installing this module. ProcessWire's native WireMail implementation handles this part just fine. Basic usage Sending emails should be done using wireMail() function -- if you use mail() directly, you're going to bypass ProcessWire's email handling features entirely. Main difference between mail() and wireMail() is the order and number of arguments: $number_of_recipients = wireMail($to, $from, $subject, $body); For more information please take a look at README. This module is released under GPLv2 (just like ProcessWire itself) with the exception of included Swift Mailer library, which is copyright © Fabien Potencier and released under the MIT license.
    1 point
  24. Hi, I have the following code in a template that lists all the child pages of that parent. I'd like to include Pagination so it would only show the title of 2 child pages per 'page'. I have completed the process here http://processwire.com/api/modules/markup-pager-nav/ however, I'm now a little unsure how to integrate this into my code below. I tried the example code in that page but to no avail. Can someone explain or point me in the right direction? Here is my current code: <?php if($page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { ?> <?php echo $child->title; ?> <?php } echo "</ul>"; } ?> Many thanks for any pointers
    1 point
  25. Hello I am playing around with the bootstrap profile. I'd like to use the carousel to display images, but only, if there are any. So I tried to write a function that I can use in the template. The function looks like this: function slider() { $albumimages = wire("page")->slider; $out =" "; if ($albumimages) { $out .= "<div id='myCarousel' class='carousel slide' data-ride='carousel'><div class='carousel-inner'>"; $i=0; foreach ($albumimages as $albumimage) { if ($i == 0) { $out .= "<div class='item active'>"; } else { $out .= "<div class='item'>"; } $i++; $out .= "<img class='img-responsive' src='{$albumimage->size(1170, 550)->url}'>"; $out .= "<div class='container'></div></div>"; } $out .="</div><a class='left carousel-control' href='#myCarousel' data-slide='prev'><span class='glyphicon glyphicon-chevron-left'></span></a><a class='right carousel-control' href='#myCarousel' data-slide='next'><span class='glyphicon glyphicon-chevron-right'></span></a> </div>"; echo $out; } else { $out =" "; echo $out; } } It works ok on pages that do have images. But on pages without images, it still is writing all the html. I don't find out, where I went wrong with the if-statement. Help is therefore very much needed and appreciated. Thanks
    1 point
  26. Ha! A couple of years ago I got a call from a station saying a client had a jingle which needed an edit on it - some old thing they had used for years. So I said to send it over. When it arrived, not only was it some thing I had composed years before for a different client and so was not licenced for them to use, but it had never been licenced for any of the stations they had been on and the singer's licence had run out ten years before. I did quite well out of the ensuing letter from my lawyer...
    1 point
  27. Hhm, sorry! With the 0.0.5 I have added a configuration option that lets you choose when an optional MailSignature should be send, but have left a boolean true somewhere in the code that overrides always these setting. Have corrected this now and committed the v 0.0.6 to GitHub. (ZIP)
    1 point
  28. I once had a marketing company tell me that they did a logo for a client of mine they had done some collateral for, when it was actually I who designed the logo. It went something like this... Me: "Oh yeah, I like the collateral you did for them. We've done work for them as well. We designed their logo, actually." Marketing: "Yes, that's right. We did their logo and all their collateral."
    1 point
  29. Yeah, in my version you don't need it to be in a function unless you are using this code on many different templates? If it's just in one template then the function isn't needed.
    1 point
  30. In a function you want to use wire('page') or $wire->page....same is true for other PW variables...Something about PHP scope whose name I always forget... If in a class (module)....there's also $this....
    1 point
  31. If I had any spare capacity I'd be interested in working with you further Nik, however I'm booked solid for several months at least.
    1 point
  32. That's very kind, thank you! Just reading most of the time and trying to get into PW...
    1 point
  33. horst thanks a lot. the more I learn about PW the more I get amazed.
    1 point
  34. If you add this line at the end of the array in public static function getModuleInfo() { 'permission' => 'page-view' it will give your other users access. You could even give it a new custom permission, like: 'permission' => 'analytics-view' then create that permission and assign it to the role of the users you want to allow access to. Of course these options are hacking the module core code and so hopefully Luis will reply soon with something along these lines. Hope that helps in the meantime.
    1 point
  35. Aaah, I understand. A variation on Pete's way might be to create a hash and save that for future comparison. Something like this to save (pseudopwcode) $page->hash = md5($myjsonUnsanitised); $page->json = $sanitizer->text($myjsonUnsanitised); $page->save(); And then use the hash as selector later $hash = md5($jsonToFind); $query = "template=whatever, hash=$hash";
    1 point
  36. GoCardless is for Direct Debits, and you don't get the money as quick as other solutions (minimum 7 days I think for the first payment whilst the DD is being set up) but it is good for certain things, especially as credit/debit cards expire but DD's are based on your bank account details - and how often do people change bank? Less often than their cards expire Stripe is really good - better fees than PayPal and better interface. You can pretty much implement their Checkout example and you're up and running in no time (relatively speaking): https://stripe.com/docs/checkout
    1 point
  37. There's also a way to add day to page on the fly. foreach($result as $res){ $res->day = strftime("%d",$res->getUnformatted("date")); } $results->sort("day");
    1 point
  38. Hi Everyone, Just launched SharesPost.com. Thoughts?
    1 point
  39. Another approach would be to have a duplicate of your template folder where you use diffferent code inside your templates. I use this a lot for development in a live site, but its an easy solution to use it for a mobile website too. When your normal site is finished (or while developing) make a duplicate of the template folder and name it "templates-mobile". The goal here is to have exactly the same template files in both folders. Paste the following code at the bottom of the /site/config.php file and change the m.domain.ext to your needs if($_SERVER['HTTP_HOST'] == 'm.domain.ext') { $config->urls->templates = '/site/templates-mobile/'; $config->paths->templates = $rootPath . $config->urls->templates; } This way when you visit your website on m.domain.ext it will use the templates out of the templates-mobile folder while it still uses the same data from the database, assets folder and the modules.
    1 point
  40. Thanks Teppo, this is great! I'm looking forward to using this one. I did try to install but ran into some troubles. I was unable to get it to save SMTPServer or SMTPPort. I tracked that down to an issue with field dependencies (in the core, not your module). I've now fixed that in the core, but you may want to remove the requiredIf condition from those two fields if possible, at least temporarily, as I need to do more testing with the core changes I made before committing to GitHub. Once I was able to save the SMTPServer and SMTPPort settings, I tried to use the module but keep getting this message: Fatal error: Class 'Swift_Message' not found in /Volumes/RyMain/Users/ryan/htdocs/cpi/site/modules/WireMailSwiftMailer/WireMailSwiftMailer.module on line 261 It looks like this condition is failing somehow: if ($this->transport != "Smtp" || $this->SMTPServer && $this->SMTPPort && $this->senderAddress) If I remove that line above (as well as the closing brace further in the function) then I no longer get errors. Following that, I configured it for Gmail per the instructions you linked to. The instructions said to choose "SSL/TLS". I chose "TLS" first, but that didn't work. So next I tried "SSL", and that worked. So SMTP setup is now working for me and it seems to work great. Some other things to mention: 1. The module should not be autoload, if possible. WireMail is intended to be loaded on demand rather than on every request. 2. The module should not be singular, if possible. When someone makes a call to wireMail(), we want to make sure we're returning them a brand new copy rather than one that might already have some email settings populated in it. That's why singular should be false, so that every time the module is retrieved a new instance is born. 3. The module version number shouldn't have preceding zeros, as this starts PHP thinking it's an octal number or something else (I don't recall). So version number should be 6 rather than 006. 4. The require() statement in your init() function should likely be a require_once(), and it should ideally include the full path, just in case another copy of of the same directory name exists elsewhere in the PHP path. i.e. require_once(dirname(__FILE__) . '/Swift-' . self::SWIFT_VERSION . '/lib/swift_required.php');
    1 point
  41. Hey Ryan. Thanks for the quick fix Now the PHP example works, but why can´t we use Hanna Code directly in our template files just by using [[name_of_hanna_code_snippet]]? Are there performance issues?
    1 point
  42. There's an example on that page you linked... Let's look, to have PW pagination module work you need to use some search $pages->find() ..children() ..siblings() with a limit selector as explained above. But this alone isn't going to cut it. You'll also need to render the pager. This, you do by using the result you get from the find() and add a renderPager() to it. So the above code is missing that. Let's add the missing part. <?php if($page->numChildren) { $result = $page->children("limit=2"); // render the pager echo $result->renderPager(); // render the children echo "<ul class='nav'>"; foreach($result as $child) { echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } echo "</ul>"; // render pager again? ok echo $result->renderPager(); } Wasn't that easy?
    1 point
  43. Did you try using "limit=2" in your selector? The following should work. <?php if($page->numChildren) { echo "<ul class='nav'>"; foreach($page->children("limit=2")as $child) { echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } echo "</ul>"; }
    1 point
  44. I'm having problems with password inputs within module config: First of all, it seems that simply inserting a Password inputfield and storing it's data isn't enough; everything seems to work fine, but password gets stored as plain text, which is obviously not a good idea. I could of course apply some custom logic here, but IMHO that shouldn't really be necessary (and it would most likely just create new security problems in the long run); am I missing something or is this a real problem? Another thing is that within module config password input get saved each time module settings are saved, which doesn't seem like correct behavior; shouldn't these only get saved when value has changed? Current behavior forces user to re-insert her password each time module config is saved (this actually applies to other inputs also, though this is probably the only situation where it causes problems.) I thought this latter problem could be avoided by setting password input value, but that doesn't seem to work either.. value is cleared at some later point, before input is rendered. So, what am I doing wrong here and any ideas how to fix it?
    1 point
  45. Antti, yes, it's certainly possible. You can hook whenever and wherever you like. It's just a matter of being certain your hook has been registered before the event you're aiming for takes place. So you only need an autoload module to hook something you don't have full control yourself, and don't want to or are not able to require some initialization being called before using the hook. Here goes. And this one I tested a little so I know it works, for me at least . function myCustomAuthentication($event) { $user = $event->arguments[0]; $pass = $event->arguments[1]; // TODO: do whatever check is needed to authenticate $user // $pass has whatever you like, a token of some kind probably // must set replace-flag to prevent the original Session::authenticate() being called $event->replace = true; // return value is boolean // true: successfully authenticated // false: authentication failed $event->return = true; } // ...aquire a user name, somewhere, somehow... // hook *before* Session::authenticate() to override it // second argument is null because we're using a plain function and not a method inside an object $session->addHookBefore('authenticate', null, 'myCustomAuthentication'); // log in the user, passing whatever needed by myCustomAuthentication() as a password - if anything $user = $session->login("some-username", "some-token-with-a-meaning-in-this-very-context"); I'll actually be using this piece of code myself as well, this week I hope.
    1 point
  46. Marc, you can see something interesting here http://processwire.c...e-nav-in-admin/ +Also Ryan still has to answer my question there You can load most modules and output them in your process module. You can use Data Table Markup module or an submit button... $dtable = $this->modules->get("MarkupAdminDataTable"); .... $out = $dtable->render(); Of course you can also output any code you like, or include a framework, a module of your own...
    1 point
  47. Process is just an abstract module designed for extending. Its behavior is pretty simple in that it calls a method in the module matching the first URL segment. If there is a URL segment, it calls execute[urlSegment] in your Process module (if it exists), with the first character of the url segment in uppercase. For example, if your URL segment was "new", it would call executeNew(). If there is no URL segment, then it just calls execute(). So it is just a basic mapping of URL segments to methods with execute() being the default. I suppose this is kind of similar to code igniter except for the naming (with execute… being part of it) and PW doesn't pass any arguments to the execute() functions... rather you can retrieve them from $input->urlSegment($n) if you want them. All of those execute[?] methods just return the content (markup) to be output. It is output directly in the #content div of the admin template. Unless the call was initiated by ajax, in which case just your output is sent (without the HTML document). Another differentiating point of Process modules is that if you have a .css or .js file in the same directory as the .module, with the same name as the module, it will be automatically loaded. Lastly, if you edit any admin page, you'll see it lets you select what Process module to execute on that page. This logic can be applied beyond just the admin template if you want it to. It's a bit late here and I may be forgetting some things, so let me know if I'm not making sense or can provide any more info. But just wanted to reiterate that Process modules are very simple and there's not much to it.
    1 point
×
×
  • Create New...