Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/17/2018 in all areas

  1. This week we take a look at a couple of reasons why you might want to choose InnoDB as your MySQL database engine when installing ProcessWire— https://processwire.com/blog/posts/using-innodb-with-processwire/
    9 points
  2. Hello All, I've been working on a new Fieldtype + Inputfield combination that handles street addresses. I've been using it now for about 3 months on my latest administration system for a charity and, so far, it seems to be working really well for them. It's based on the meta-data from Google's LibAddressInput project and uses the data feeds from that to build a cache of address formats used by various countries. My initial testing was aided by @Macrura and @adrian - and they were later joined by @mel47 and @BFD Calendar - so a big thank-you to them all. You can access the repository on GitHub and the Module Repository. Here's a few images from the project. First up: config screen. Here's an early version... ...and a more recent update... Here's a UK-based address. The module can integrate with my tag parser, if installed. Note that the output is formatted according to the output meta-data from the feed - which should match the preferred postal preferences of the destination country. Which subfields are required, and their regex expressions (if any) are also pulled from the feed and used as validation rules on the input side. Here's an address in the Netherlands - inputfield layout is currently adjusted on save - if you've configured it to adjust based on the destination country. Hopefully this will eventually be ajax driven. Use of the address preview is configurable and the HTML output can include micro-format data. Address sub-fields can also be used in selectors... Back with inputs, if you prefer a table-based input - you can have it... Format hints (unfortunately, I've found that many users need these)... Let me know if you find any issues or if you have any feature requests. So far, I have this from the previous testers... Allow multi-lingual address input for countries that support a multi-lingual postal system (like Canada.)
    6 points
  3. This profile can be used as a business card or very simple blog. Requires the latest version processwire 3.0.101 !!! Milligram Site Profile For Processwire 3x with include functions like: MarkupRegions FunctionsAPI wireIncludeFile | wireRenderFile Essentially, this structure uses minimalist CSS framework Milligram and the Flexbox Grid System Gridlex Live Example CAN DOWNLOAD FROM THIS LINK ( Basic Version and simple Blog Version ) https://github.com/rafaoski/site-milligram https://github.com/rafaoski/site-milligram-blog Screenshot: If you want to use Laravel Mix you must first ensure that Node.js and NPM are installed on your machine. Basic example to Debian and Ubuntu based Linux distributions: Node.js curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs See more installation options LINK npm is installed with Node.js just check in linux terminal like below: node -v npm -v Set BrowserSync inside folder /templates/webpack.mix.js and change your dev url proxy: 'http://localhost/mix/', to your installation processwire folder like: proxy: 'http://localhost/your-processwire-installation-folder/', Next install npm packages in your templates folder with command npm install Now, boot up the dev server npm run watch, and you're all set go! On completion, use the command npm run production to build styles and scripts in the dist folder Simple Usage ( Basic Command ) Run npm install Watch npm run watch Build npm run production All files to Webpack build steps is inside file ( webpack.mix.js ) Folder With all SCSS files is inside templates/src/scss All build styles and scripts is inside the ( dist ) folder References: Milligram Gridlex Laravel Mix Feather Icons Web Font Loader Verlok Lazy Load Cookie Consent Particles.js
    6 points
  4. I would like to just show my appreciation to ProcessWire and all the guys that have put work in to make it what it is now. I have use many, many CMS's in my time. Statamic, Drupal, WordPress, ConcreteCMS, CraftCMS etc... And they all have their strengths and weaknesses. But I can honestly say, ProcessWire is by FAR the best Content Management System I've ever, EVER used. I can honestly say the only weakness ProcessWire is the lack on eCommerce. But, that isn't even a weakness of ProcessWire. The tools are there for us to create an eCommerce system. I'm a front-end developer but with ProcessWire it empowers me to realise anything. Honestly, when one of the designers asks "Can we do this?" it feels so great to say YES! I, with very little backend experience built a real-estate system that completely runs on ProcessWire pulling in from an external feed (Vebra) and I did it with ease! I just wanted to say thank you, thank you for creating a framework in which, people like myself, who love front-end but find back-end daunting can pick it up and literally do anything with EASE. ProcessWire gives me so much confidence and makes me feel so good about myself. I've recently been working on an WooCommerce website, and I can't tell you how much I've been missing ProcessWire. Thank you @ryan for making a system that is so simple, even simpletons like myself can dream big. Lots of love, Tom Edit: Interestingly I feel like it would be easier to build an eCommerce system using ProcessWire than it would trying to completely reskin WooCommerce, like seriously, WooCommerce stop injecting markup and putting them in core functions.
    5 points
  5. I've just issued a PR to the main repo for a reworked diagnostics panel for Tracy. This... Adds a "Dedicated" server switch via cookies. Adds colour coded cells. Displays file permission flags. Adds checks for existence, ownership, readability by process user, writability by process user, world-accessibility, execute/traversal. Detects installation of the PW Upgrade module. Detects use of non-file session handling. Adds basic checks of the debug, chmodFile and chmodDir config settings. Unifies the colour scheme with the new Tracy constants. Supplies formatted suggestions for chown, chgrp and chmod commands (on non-Windows servers.) Adjusts severity of issues reported based on Local vs Production server and/or Dedicated vs Shared server. Adds links to documentation for some assets. If you want to try it out and let me know any problems you find, please consider using my temporary Fork of Tracy on github until Adrian has had a chance to consider merging the PR.
    4 points
  6. Little offtopic and self-promotion here, but you should definitely give RockGrid a try. It's such a great way to list all kinds of content, style it properly, add additional functionality. In the example below you get instant filtering, properly formatted currencies, referenced pages and some hover-action-icons that open that page in a panel or open the PDF invoice directly. The pagetree is great for websites, but it's definitely not for other more complex content management applications ? So true ? (y)
    4 points
  7. The main reason I prefer ProcessWire over Craft is down to simplicity. ProcessWire's API is head and shoulders over the competition. Statamic and Craft both have templating systems, which I know is to combat the whole, PHP in HTML, but I don't believe using a templating system is any better. Often its more confusing as you have to use modifiers to get anything done and even then you can't do everything PHP can do. Sure it's cleaner but not by much. I also really didn't like the user interface for creating fields on Craft, it seemed way out of place. We did a few tests and found clients actually understand everything being in the page tree more than Taxonomies, Page Types and Post Types. Initially I thought it would be neater to have them separated out. If you feel like something needs it's own section you can use Lister Pro but it's rarely needed. I was building an eCommerce system for ProcessWire, which all the product related things is complete. Such as product variations etc. It was an R&D project at work in which I was going to complete in my spare time. I predicted to complete it at the start of the year, well, have Beta ready. As work started to pick up again, I haven't been able to work on it and I've been way more busy than usual, which is great! But also means projects like this sadly have to take the back burner. I would like to start it up again soon, but would like an extra pair of hands on it to get it done in any decent time frame.
    4 points
  8. Yep, not much activity in this forum so as a new Padloper user, thought I'd share my feedback on this module here, originally posted in the Padloper forum:
    3 points
  9. @Tom re ecommerce stuff...I've used WooCommerce and come out blue, battered & beaten at the other end. I've also integrated the BigCommerce API with PW. Am now working on site with the PW premium module Padloper. IMHO: WooCommerce is horrible on every level BigCommerce and any other SAAS platform, eg Shopify, are easy enough to integrate into PW and while they dont always have the perfect workflow solution, suit bigger shops Premium ecommerce PW module Padloper is raw, pure PW, takes a bit of getting used to and is great for smaller shops
    3 points
  10. The diagnostics panel will need more follow-up work in the days to come, but hopefully it's a useful first step. I've just noticed how bad the permission model for my current shared host is *sigh*. Looks like I'll be moving this site to a VPS sooner rather than later.
    3 points
  11. Busy morning ? Firstly, a huge thank you to Steve (@netcarver) for his epic rework of the Diagnostics panel - take a look at the diff https://github.com/adrianbj/TracyDebugger/pull/24/commits/8604a683ef408b4106f7b7237b3eae6c24de315a - he's put in a huge amount of time on this. I have merged his changes and bumped up Tracy's version to 4.11.0 - it deserves a major point bump for this ? If you haven't used this panel much in the past, you really should take another look and give it a thorough go - it's really useful for new and experienced devs alike! I also also added @tpr's blue for the icon color. Not sure about the inverted scheme just yet - any strong thoughts on it? I do think that the background color of the bar (the light version) could be made to look a little less dirty though. BTW, as a reference, take a look at the default Tracy bar: https://nette.github.io/tracy/tracy-debug-bar.html - be sure to check out the panels as well - we have @tpr to thank for our version looking considerably better than that ? Regarding the automatic dumping of both full object and debugInfo versions, it could be as simple as this - just one version, and then the other. Perhaps some visual indicator so you know it's from one call or something. Any ideas/thoughts? @szabesz - you mentioned wanting the page ID shown without having to open the object - I don't think is any simple approach to do that, especially given that not all dumped objects are pages. Of course you can do: d($page, $page->id) but that's only useful if you are dumping multiple pages at once so you know which one is which. If you have any more specific thoughts on how to implement what you are looking, let me know. Regarding the memory limit error - not sure what can be can about that - I guess Tracy can't handle that error because the error broke Tracy ? Seriously though there is just so much output when you have all panels toggled on that it's not surprising that these come up occasionally - I haven't seen one, but I up the PHP memory limit on my dev machine to 128M. Hopefully I answered everyone's questions, and please don't forget to test the new Diagnostics panel and give @netcarver your feedback.
    3 points
  12. If you only need a simple map you can still integrate it as simple iframe (example https://www.hrdiamonds.com/kontakt/ ) Openstreetmap has been a very good and reliable solution for several years. Sometimes their data is even better than google's. It's also a great project for collaboration in case of desasters where everybody can help to digitalize the current situation. There are also lots of different tile providers based on openstreetmap data having customized renderings, like https://www.opencyclemap.org/ Leaflet on the other hand is a very good JavaScript library to DISPLAY this data. Another one is OpenLayers (really powerful but not so light-weight). Lots of options ? Didn't know about here.com, thx @zoeck
    3 points
  13. DEPRECATED If you are interested in the new version (commercial module launching in 2023) write me a PM --- Some of you might have followed the development of this module here: https://processwire.com/talk/topic/15524-previewdiscussion-rockdatatables/ . It is the successor of "RockDataTables" and requires RockFinder to get the data for the grid easily and efficiently. It uses the open source part of agGrid for grid rendering. WHY? ProcessWire is awesome for creating all kinds of custom backend applications, but where it is not so awesome in my opinion is when it comes to listing this data. Of course we have the built in page lister and we have ListerPro, but none of that solutions is capable of properly displaying large amounts of data, for example lists of revenues, aggregations, quick and easy sorts by the user, instant filter and those kind of features. RockGrid to the rescue ? Features/Highlights: 100k+ rows Instant (client side) filter, search, sort (different sort based on data type, eg "lower/greater than" for numbers, "contains" for strings) extendable via plugins (available plugins at the moment: fullscreen, csv export, reload, batch-processing of data, column sum/statistics, row selection) all the agGrid features (cell renderers, cell styling, pagination, column grouping etc) vanilla javascript, backend and frontend support (though not all plugins are working on the frontend yet and I don't plan to support it as long as I don't need it myself) Limitations: While there is an option to retrieve data via AJAX the actual processing of the grid (displaying, filtering, sorting) is done on the client side, meaning that you can get into troubles when handling really large datasets of several thousands of rows. agGrid should be one of the most performant grid options in the world (see the official example page with a 100k row example) and does a lot to prevent problems (such as virtual row rendering), but you should always have this limitation in mind as this is a major difference to the available lister options that do not have this limitation. Currently it only supports AdminThemeUikit and I don't plan to support any other admin theme. Download: https://gitlab.com/baumrock/FieldtypeRockGrid Installation: https://gitlab.com/baumrock/RockGrid/wikis/Installation Quikckstart: https://gitlab.com/baumrock/RockGrid/wikis/quickstart Further instructions: https://gitlab.com/baumrock/RockGrid/wikis/quickstart#further-instructions German Translation File: site--modules--fieldtyperockgrid--fieldtyperockgrid-module-php.json Changelog: https://gitlab.com/baumrock/FieldtypeRockGrid/raw/master/changelog.md Module status: alpha, License: MIT Note that every installation and uninstallation sends an anonymous google analytics event to my google analytics account. If you don't want that feel free to remove the appropriate lines of code before installation/uninstallation. Contribute: You can contribute to the development of this and other modules or just say thank you by testing, reporting issues and making PRs at gitlab liking this post buying me a drink: paypal.me/baumrock/5 liking my facebook page: facebook.com/baumrock hiring me for pw work: baumrock.com Support: Please note that this module might not be as easy and plug&play as many other modules. It needs a good understanding of agGrid (and JavaScript in general) and it likely needs some looks into the code to get all the options. Please understand that I can not provide free support for every request here in the forum. I try to answer all questions that might also help others or that might improve the module but for individual requests I offer paid support (please contact me via PM). Use Cases / Examples: Colored grid cells, Icons, Links etc. The Grid also has a "batcher" feature built in that helps communicating with the server via AJAX and managing resource intensive tasks in batches: Filters, PW panel links and instant reload on panel close: You can combine the grid with a chart library like I did with the (outdated) RockDataTables module:
    2 points
  14. @bernhard only thing what seems not as good with OSM as it is from g**gle, is the routing planner. At least, it wasn't for a long time. (?) My personal workaround for that is to use OSM with a link to g**gles routing planner. ? For example, on https://wein-coop.de/ I use OSM with Leaflet and a link to the Routingplanner ( https://www.google.de/maps/dir/50.7823,6.0759/@50.7823,6.0759,15z ).
    2 points
  15. As I wrote that was an experiment only but wanted to share to you to check. The current latest is more consolidated if you ask me.
    2 points
  16. Looks nice. But I would remove the negative margin @ [class~=grid] - it causes horizontal scrollbars (at least here, on Chrome)
    2 points
  17. Thanks to @Pixrael ... I have already added this profile, but as usual, it will take some time before the profile is approved ?I think that in a few hours the profile should be in the module catalog
    2 points
  18. Excellent! Thanks! Please add this profile to: https://modules.processwire.com/categories/site-profile/
    2 points
  19. Added support for joining multiple finders. You can even join finders on columns of previously joined finders ? In this example I'm joining projects (finder1) and their related clients (single page reference field of project) and then I join the referral contact of the project's client based on the "camefrom" id of finder2:
    2 points
  20. I think non-grey default icons would look nicer, eg. a darker blue like #354B60 (borrowed from the Uikit admin theme). It's just a quick devtools preview but for me the current grey is too pale, and rather suggests that those icons are in an "off" state. To further complicate things, here is an inverted version where the whole bar is blue and icons/texts are white: I'm not sure this would be better but wanted to share. The biggest advantage would be that it would pop out more from the rest of the page. Orange and red icons would require some brightening to be more visible though.
    2 points
  21. Just switch to Here ? https://developer.here.com/plans 250k transactions per month for free....
    2 points
  22. New website design for HealthCARE Express. Used UIkit3 for the front end look. Jquery Store locator for the locations page. PW Modules used: Hanna code, google map marker, Inputfield Ace Extended, MarkInPageTree, Video embed for YouTube/Vimeo, and an in house asset minification module. Backend is pretty unique. Basically, I use the processwire templates for UIKit items instead of pages. ie. card.php, container.php, section.php. navbar.php, grid.php, slideshow.php. I also add some extra things like page.php, inner_page_heading.php, image.php, page_snippet.php, text.php. (Page snippet is if I want to run php.) Most of the root pages in the admin page tree use the page.php template. Their children are either detail pages or layout rows for that page. I also have a blog.php that uses the page.php file, just because that lets me force the children to be blog posts. The page and blog templates have fields like meta page title, meta page description, selected page layout, css, js, images, files. All markup is added through admin as well through things like the selected page layout. I have one page in my page tree for page layouts and I add children for the markup. ie. I can add a "Service" page layout to the backend, and add a "page heading" child, an intro "section" child, a service "grid" child, etc. You can check out screenshots. It basically gives me a page builder! The children of the grid page are forced to be cells, and have gui to select the columns and such. I have a css field and a js field attached to almost everything. On page save, if that page has one, it pulls them all and merges them all into one css file and saves it to the server with a timestamp as filename. That way all php, css, and js code is done through backend.
    1 point
  23. We recently finished a relaunch of the website of the consulting firm Engfer Consulting: engfer-consulting.de. Built with ProcessWire 3 and Bootstrap 4. Features Bilingual website (UPDATE: The English page is now available! the English page is inactive at the moment, as the content is not ready yet) A strong, simple data structure for job offers and news, allowing for a custom search page and fulltext search Sectioned content-blocks built with a Repeater Matrix (ProFields) Reusable components available as page reference fields Automatic generation of open graph-tags, with manual overrides available on each page Contact forms with a custom recipient depending on the current page Modules used: ProFields ProForms Sitemap Cookie Management Banner Duplicator Tracy Debugger Wire Mail SMTP Admin Links in FrontEnd Technical insights Most of the content is built using a Repeater Matrix field. Each section has an optional heading and a select-field for background colors. Some of the sections available include: Text blocks (a repeater-field for multi-column text) Feeds / listing of the latest job offers or news (with a field to control the number of entries shown) Displaying a team member or quote (selected through a page reference field) Downloadable files (a multivalue field for file uploads) Those sections can be combined and stringed together arbitrarily, so any number of page templates showing different contents can be built. The job offers template, in contrast, features fixed fields for taxonomy assignment, description, contact person, preview image and so on, making the job offer pages uniform and easily accesible. The (technically) most interesting part of the site is the job overview page, which contains custom filters that are automatically generated from the available taxonomy terms. The stylesheets are written in SASS, built with Bootstrap 4. Only the base and grid SASS files of Bootstrap are included, along with the Bootstrap components that we ended up using. Using Bootstrap 4 as a framework in this way makes development & styling blazingly fast, once all the utility classes are commited to muscle memory ... > Our Agency. Screenshots
    1 point
  24. Wow, this is great news to me. I didn't even know you could do $database->beginTransaction(); stuff in the first place. I mean, being able to use this method with PW's API methods. I thought it could be used only with native / raw SQL.
    1 point
  25. Thanks to @dragan ... It looks like it's okay now after adding the margin auto to the grid /* eliminate horizontal scrollbars */ .grid { margin-right: auto; margin-left: auto; }
    1 point
  26. yep, one theme is absolutely fine for me. looks great already! ?
    1 point
  27. Just trying the latest version on a shared host and found a bug regarding the config->debug setting. Will fix.
    1 point
  28. Thanks for the hint, Bernhard. Until now, I haven't had time to look at it. So, will add it to the list of things to explore / try out. ?
    1 point
  29. Definetly can confirm that with the PageTree and the rare cases where additionally a ListerPro page is needed. ?
    1 point
  30. Making it optional means more work and maintenance. However if svgs are well prepared colorization can be easily added with something like .tracy-invert-bar svg * { fill: white; } As for inverted colors I often use the editor theme called Son of Obsidian as a reference. For example my file manager (Double Commander) colors are set up using that and it's beautiful ? https://www.google.hu/search?q=son+of+obsidian&prmd=ivn
    1 point
  31. Maybe this is the better forum for it. Crosslink:
    1 point
  32. A bit OT, but related to Githubs notifications and issue repos in general. Today I found a nice app, that shows all new GitHub Notifications in a nice way. All previously read comments in a thread are minimized. I found it together with other tools here: https://dev.to/maestromac/tools-i-use-to-stay-on-top-of-githubs-notifications-56mo Screenshot:
    1 point
  33. Hello gingebaker, in that situation, until the issue will be resolved, you can copy core module to site/modules and there change it to get working temporarily solution. If you want to do that, here are steps: 1) copy core ProcessPageSearch module from wire/modules/Process/ProcessPageSearch to site/modules/ 2) after it configure PW to use that variant (administration, Modules->Configure->PageSearch...). 3) inside ProcessPageSearchLive.php, execute() do small changes: public function execute($getJSON = true) { /** @var WireInput $input */ $input = $this->wire('input'); $liveSearch = $this->init(); if((int) $input->get('version') > 1) { // version 2+ keep results in native format, for future use $items = $this->find($liveSearch); } else { // version 1 is currently used by PW admin themes $items = $this->convertItemsFormat($this->find($liveSearch)); } $result = array( 'matches' => &$items ); // --- START if(count($result['matches'])){ foreach($result['matches'] as $key => $match) { if($match['template_label'] == "templateX" || $match['template_label'] == "templateY") { // add vorname and nachname to title $matchPage = $this->pages->get($match['id']); $result['matches'][$key]['title'] = $match['title'] .' - '.$matchPage->get('nachname').' '.$matchPage->get('vorname'); } } } //--- END return $getJSON ? json_encode($result) : $items; } Regards.
    1 point
  34. Very nice site and well done write up with good insights! ? Also nice to see, that someone other, besides me, is using Admin Links In Frontend these days. ?
    1 point
  35. Hello, I had used comments fieldtype and it works perfect. Just right now compared what I had used and there are few differences, but first please check did you have on page Comments css and js files: <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->FieldtypeComments;?>comments.css" /> <script type='text/javascript' src='<?php echo $config->urls->FieldtypeComments;?>comments.min.js'></script> And call: <?php echo $page->comments->render(array( 'headline' => '', 'commentHeader' => '<span class="comment-by">{cite} <span class="date">{created}</span> {stars}{votes} </span>', 'useVotes' => 1, 'useStars' => 1, 'upvoteFormat' => '<span class="rate-review"><i class="sl sl-icon-like"></i> Helpful Review {cnt}</span>', 'downvoteFormat' => '<span class="rate-review"><i class="sl sl-icon-dislike"></i> Dislike Review {cnt}</span>' ));?> Please check and Comments settings inside admin where you can define stars rating (need to fill form or not). Regards.
    1 point
  36. @Hajosch Looks like something wrong with CSS. Make sure that you load CSS file from comments module and it actually gets loaded and not conflicting with other styles.
    1 point
  37. Pushed a little Update for basic support of options fields (using the same sql queries as file fields). But I want to share something I needed today to keep my requests simple and my code clean: You can quite easily join two finders where manipulating the SQL would maybe quite complex: $this->rg->assets->add($this->config->paths->siteModules . 'FieldtypeRockGrid/lib/moment.min.js'); $this->rg->assets->add($this->config->paths->siteModules . 'FieldtypeRockGrid/lib/currency.min.js'); $efforts = new RockFinder('template=effort', [ 'title', // fields ]); $projects = new RockFinder('template=project', [ 'title', // fields ]); $sql = 'SELECT efforts.*, projects.id AS projectid, projects.title AS projectname, projects.project_status AS projectstatus FROM (' . $efforts->getSQL() . ') AS efforts LEFT JOIN field_project_efforts AS ef ON ef.data = efforts.id LEFT JOIN (' . $projects->getSQL() . ') AS projects ON projects.id = ef.pages_id /* projectid */ '; $this->setData($sql); Result (with RockGrid and some JavaScript, of course):
    1 point
  38. This week the focus has been on fixing various issues in the queue at our GitHub processwire-issues repository. So while there aren't any new/exciting features to write a blog post about, there are a lot of commits in ProcessWire 3.0.110 that fix various minor issues. If you are running on the dev branch, the upgrade is definitely worthwhile. You can review this week's commits in our commit log in the date range from August 6 to August 10. Also a big thanks to @netcarver who is now helping to administer the processwire-issues repository.
    1 point
  39. Hello Soma and everyone else who helped me to solve my problem. SOMA: Thanks for your suggestion, which also works well and which I took as standard because of the shorter code. It's amazing how many different solutions Processwire has to offer. I've learned a lot. Thanks again to everyone and best regards Hajosh
    1 point
  40. This is the shortest method using implode(): if($page->authors->count) echo $page->authors->implode("; ", "<a href='{url}'>{title}</a>") . ".";
    1 point
  41. Hello, here is example using HTML "li" tags for list, and CSS pseudo-classes for styling HTML. <?php if (count($page->authors)) { $out = ''; foreach($page->authors as $authors) { $out.= "<li><a href='{$authors->url}'>{$authors->title}</a></li>"; } echo '<ul class="author-list">'.$out.'</ul>'; } ?> And CSS part: .author-list { list-style-type: none; } .author-list li { display: inline; } .author-list li:after { content: "; "; } .author-list li:last-child:after { content: "."; } This example provide few options to style list inside CSS file only (inline or not, without bullets or not, various dividers etc.). Codepen demo Regards.
    1 point
  42. Hello @Hajosch, you could also do something like this: <!-- Query of the authors --> <?php if (count($page->authors)) { echo "<u>AUTOR/EN</u>:&nbsp"; foreach($page->authors as $authors) { echo "<a href='{$authors->url}'>{$authors->title}</a>"; if ($authors === $page->authors->last) { echo "."; } else { echo "; "; } } } ?> Regards, Andreas
    1 point
  43. You can also use some function like substr / str_replace or rtrim. https://stackoverflow.com/questions/5592994/remove-the-last-character-from-string You would have to build up a variable instead of echo-ing instantly to achieve this. i.e. use something like $output .= .... inside the foreach loop, then do the str_replace() and finally echo() it.
    1 point
  44. There are various ways you can achieve this, including plain PHP and even plain HTML+CSS (depending on your use case you might be able to convert this to a list and add those delimiters as ::after pseudo-elements – it might even make more sense semantically), but probably the easiest way would be the implode() method of the WireArray class. Since $page->authors returns an instance of PageArray and PageArrays inherit the methods of the WireArray class, you can do something like this in your code: <!-- Query of the authors --> <?php if (count($page->authors)) { echo "<u>AUTOR/EN</u>:&nbsp"; echo $page->authors->implode("; ", function($item) { return "<a href='{$item->url}'>{$item->title}</a>"; }); echo "."; } ?> A plain PHP solution using a counter variable would look something like this – this is probably the easiest method to understand for a not-so-experienced developer: <!-- Query of the authors --> <?php $author_count = count($page->authors); if ($author_count) { $count = 0; echo "<u>AUTOR/EN</u>:&nbsp"; foreach ($page->authors as $author) { ++$count; echo "<a href='{$author->url}'>{$author->title}</a>"; echo $count < $author_count ? ";&nbsp" : "."; // note: this is a ternary operator, see http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary for details } } ?>
    1 point
  45. Hi, I've updated language pack to version 1.0.5. This version is fully compatibile with the latest master version 3.0.96 and the DEV version 3.0.108. This version contains translated all new features introduced since release of the latest master version + full translation of the new UIkit admin theme. Download driectly at github: https://github.com/sevenstudio/polish-wire/archive/1.0.5.zip or from the official modules directory: http://modules.processwire.com/modules/polski/ Tomasz
    1 point
  46. @gizomo Here are a few other options for your consideration, in case this is not ready for sharing. In no particular order (and I haven't used any yet - so no recommendations)... https://github.com/nicoknoll/ProcessNewsletter https://github.com/pmarki/ProcessSendNewsletter https://github.com/rolandtoth/pwnl https://github.com/justb3a/processwire-newslettersubscription https://github.com/dauni/processwire-newslettermanagement Hope that helps. </redirect>
    1 point
  47. The textformatters attribute is defined/set in FieldtypeText::___getConfigInputfields and its value is used in FieldtypeText::___formatValue.
    1 point
  48. The module source is below. Example usage: a checkbox on a contact form (using Form Builder) for the user to subscribe. It's used on https://ricardo-vargas.com/contact/ EXAMPLE A method on _hooks.php. If you don't use Form Builder, use this code on your form page. $forms->addHookBefore('FormBuilderProcessor::emailForm', function($event) { $processor = $event->object; if ($processor->formName == 'contact-form') { $formData = $event->arguments(1); $contact_name = $event->sanitizer->text($formData['contact_name']); $contact_name = substr($contact_name, 0, 30); // limit length further $contact_name = $event->sanitizer->emailHeader($contact_name); $contact_email = $event->sanitizer->text($formData['contact_email']); $contact_email = $event->sanitizer->emailHeader($contact_email); $processor->emailFrom = $contact_email; //reply to $processor->emailSubject = 'Message from '.$contact_name; $form = $event->object->getInputfieldsForm(); $subscribe = $form->get('receive_updates'); $list_id = $form->get('sendy_list_id')->attr('value'); // check to see if they subscribed if ($subscribe->attr('checked')) { $success_url = '/contact'; // $fail_url = '/contact?error=1'; $ProcessSendyAPI = wire('modules')->getModule('ProcessSendyAPI'); $ProcessSendyAPI->subscribeInSendy($contact_name, $contact_email, $list_id, $success_url); } } }); MODULE https://gist.github.com/sjardim/2d834ebb0bd66d4da1ac16072f4075cd <?php namespace ProcessWire; class ProcessSendyAPI extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => __('Process Sendy API'), 'summary' => __('Handle API calls to a Sendy installation'), 'author' => 'Sérgio Jardim', 'version' => '001', 'singular' => true, 'autoload' => false, 'icon' => 'envelope' ); } /** * Data as used by the get/set functions * */ protected $data = array(); /** * Default configuration for module * */ static public function getDefaultData() { return array( "sendy_api_key" => '', "sendy_installation_url" => 'http://www.example.com/sendy' ); } /** * Populate the default config data * */ public function __construct() { foreach(self::getDefaultData() as $key => $value) { $this->$key = $value; } } public static function getModuleConfigInputfields(array $data) { $data = array_merge(self::getDefaultData(), $data); $wrapper = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldText'); $f->attr('name', 'sendy_api_key'); $f->label = __('Sendy API Key', __FILE__); $f->description = __('Further instructions at https://sendy.co/api', __FILE__); $f->notes = __('Get your key at http://your_sendy_installation/settings.', __FILE__); $f->value = $data['sendy_api_key']; $wrapper->add($f); $f = wire('modules')->get('InputfieldURL'); $f->attr('name', 'sendy_installation_url'); $f->label = __('Sendy instalation URL', __FILE__); $f->description = __('Your Sendy installation URL without a trailing slash', __FILE__); $f->notes = 'http://www.example.com/sendy'; $f->value = $data['sendy_installation_url']; $wrapper->add($f); return $wrapper; } /** * [subscribeUserOrGuest description] * @param [type] $name [description] * @param [type] $email [description] * @param [type] $list_id [description] * @param [type] $success_url [description] * @param [type] $fail_url [description] * @return [type] [description] */ public function subscribeInSendy($name, $email, $list_id, $success_url = null, $fail_url = null) { $api_key = $this->data['sendy_api_key']; $sendy_url = $this->data['sendy_installation_url']; $postdata = http_build_query( array( 'name' => $name, 'email' => $email, 'list' => $list_id, 'boolean' => 'true' //set this to "true" so that you'll get a plain text response ) ); $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata)); $context = stream_context_create($opts); $result = file_get_contents($sendy_url.'/subscribe', false, $context); //check result and redirect if($result) { $this->wire('log')->save("newsletter", 'A new user subscribed to the site mailing list: '.$email); if($success_url) { header("Location: $success_url"); } } else { $this->wire('log')->save("error", 'Error occurred on subscribing '.$email); if($fail_url) { header("Location: $fail_url"); } } } }
    1 point
×
×
  • Create New...