Leaderboard
Popular Content
Showing content with the highest reputation on 07/29/2017 in all areas
-
This week's version of ProcessWire on the dev branch is 3.0.69 and it includes several minor bug fixes. This week's post focuses in on a new module released today called Login for Facebook, which I think many might find useful, and we've got all the details here: https://processwire.com/blog/posts/pw-login-for-facebook/4 points
-
I built this module because I needed a versatile solution to replace tags and simple if-blocks in some E-Mails and PDF documents. If you only need to replace static tags (no if-conditions), then you can use default PW api and need no module: $str = "My favourite color is {color}."; $texttools = $sanitizer->getTextTools(); echo $texttools->populatePlaceholders($str, ['color' => 'red']); // output: My favourite color is red. Usage: See the two example Files in the folder /replacements Methods: replacementsTable() Renders an overview of all available replacements (see the example in the Module's config file: Create new Replacements: Simply copy the sample file and adopt to your needs. Download: https://gitlab.com/baumrock/RockReplacer3 points
-
one more complex example: in the pdf creating module: $mpdf->WriteHTML(modules('RockReplacer')->replace($block->body, ['report' => $this->report])); the users edit-screen: the users help-section: the resulting pdf: and the replacementfile: <?php namespace RockReplacer; class dataoverview extends Replacer { public function desc() { return $this->_('Fügt eine Tabelle mit einer Zusammenfassung über alle Feedbacks + Rollen ein'); } public function replace($vars) { $report = $vars['report']; $project = $report->closest('template=project'); $fn = $report->fn; ob_start(); ?> <div class="dataoverview"> <h3><?= $this->_('Feedbackübersicht'); ?></h3> <table class="size-psmall striped"> <tr> <th class="text-center"><?= $this->_('Rolle'); ?></th> <th class="text-center"><?= $this->_('Eingeladen'); ?></th> <th class="text-center"><?= $this->_('Abgegeben'); ?></th> <th class="text-center"><?= $this->_('Rücklaufquote'); ?></th> </tr> <?php foreach($report->getRoles() as $role): ?> <tr> <td><?= $role->title ?></td> <td class="text-center"> <?php $invited = $this->wire->pages->count( "template=feedback". ",has_parent=$project". ",fn=$fn". ",fbrole=$role" ); echo $invited; ?> </td> <td class="text-center"> <?php $done = $this->wire->pages->count( "template=feedback". ",has_parent=$project". ",fn=$fn". ",fbrole=$role". ",fbdone=1" ); echo $done; ?> </td> <td class="text-center"><?= $invited ? round(($done/$invited)*100, 0) : 0 ?>%</td> </tr> <?php endforeach; ?> </table> [...] </div> <?php return ob_get_clean(); } }3 points
-
Sure, it does work, however there are some shortcomings, some of them are (nothing serious, but still...): $config->userAuthSalt will always stay the same if working with a "new" server (new environment you have not yet tested PW with) it is best to run the installer first to see if all goes well... you might want to pick a different database storage engine (innodb vs myisam) and a collation and the installer provides that that is why it is best to export a site profile and install it afterwards instead of simply cloning the site: Simple clones can be good for moving the site though, of course. It depends on the database storage engine (innodb vs myisam) and the collation used, I guess. I do not remember recent db related changes.2 points
-
I'm not sure if you have seen the profile export module but it has been a great addition for me when setting up initial sites.2 points
-
Probably the last report of it: https://processwire.com/blog/posts/pw-3.0.62-master/ I guess it is put aside a little bit since UIkit 3 is still in beta and seems to be changing here and there. It is wise to wait for the first "stable" v1 version in the case of something as complex as the ProcessWire admin.2 points
-
I find it a bit annoying that on https://chrysemys.nl/habitats/ the link is only in the center of the image, while on other pages (e.g. https://chrysemys.nl/habitats/brak-water/) the click-area is the entire image (green overlay when hovered). I would increase the click-area to cover the whole image everywhere.2 points
-
2 points
-
Hello, I want to showcase my website made in processwire. https://chrysemys.nl/ Goal of the website There are quit some websites with information about turtles. Most of them are very limited in information. This website main goal is to be very complete in information. Information about turtles, there natural behaviour, detailed descriptions. Next is also associations ( (bi-)directional links) with caresheets, books, food, illnesses, etc... Second goal is to learn PHP as I started an education for application engineering 4 months ago. Setup It is build on the latest version (3.0.61) and makes use of the latest template strategy. I use the pw-append, pw-replace classes in combination with _main.php and several template files. Most of the rendering is done from custom functions in _functions.php. In the back-end the pages are styled with the options for visibility and group in logical blocks. This is a very nice feature with processwire and makes the pages easier to fill. Next to the core modules I have used the following extra modules: AIOM+ - obviously Connect Page Fields - This module is very important. The whole site is considered a relational database. The base is the enity turtle. This entity has bidirectional associations with books, caresheets, locations (voor google maps), regions (to group locations), the different classifications of the animal taxonomy, food, etc. To make these kind of associations it greatly simplified the output on the other templates. This module was a mandatory feature for being able to create a site as I wanted to. Otherwise it would it would be very inefficient to keep everything up to date. Now I can add a new book and connect it to one ore more turtles. After the save you can see the book also on the turtle page. This goes for all the bidrectional links. This page is about a species - https://chrysemys.nl/schildpadden/emys-orbicularis/ This species has several sub species (basicly the same turtle but live in another country/region and has some different charasteristics). I have decided to make no distinction between species and sub species (on a template level) and use this module to connect them to each other. One reason was that this way the url would not be too long. This turtle lives in several different habitats. These are also bidirectional associations. The same goed for food, books, food to mention some. The biological taxonomy is also build this way as entities that have no parent/child relation. They are connected to each other with page reference (in this case). Both methods (page reference or parent/child) have their pro's and cons, in the end this setup seemed to work best for me. Map Marker - This is used for the map marker field for the locations (verspreiding). Everyt turtle can live in one ore more locations and the will show up on the google map. Also I have the possibility to add location specific information about the climat on the pages (missing on almost all other websites). Map Markup (Google Maps) - For the output of the google map. The js script for this is only outputted on the pages where it is used (template strategy). Markup Sitemap XML - obviously Social Share Buttons - Added this as it is recommended for a better SEO score. Get Video Thumbnails - The blog story can have a youtube link. This module automatically grabs an image and places it as the image for the blog. No more extra steps needed. Video embed for YouTube/Vimeo - I slight changed the output for this module so it always is placed under the body. Datamaps.js - Also I had some very important help from @adrian with help of using datamaps.js. This page is a datamaps script that read all turtles that live in the US and shows them in the correct state. https://chrysemys.nl/kaart-verenigde-staten/ A php function renders the output for the script and fills the variables. These are added to te script on rendering the page. The website is not finished and probably never will be as new information and functionality will be added all the time. But it is finished enough to serve as a showcase. Roadmap There are several things I want to add in the future: A find selector for overview pages (select by size, region, family, etc). Worked on this but, could not get it working. Datamaps.js for all regions (also with a selector to select another region). Optimize the queries to make the site faster. Several front-end improvements (marging/padding/font-size, etc...)1 point
-
Thanks. I fresh installed 3.0.42 on my local system. I then exported the database from a previous site running on 3.0.42. Next, I imported the database, deleted templates/fields that I not re-occuring across projects, installed my modules, setup my custom ckeditor .js and .css files. Finally, I ran the ProcessWireUpgrade to upgrade the local site to 3.0.62. It all looks good. From here out, I'll run ProcessWireUpgrade, then use the profile export module when setting up a new site. Thanks for the help! Btw, when I set up on a remote site, I always use the PW installer. After that I import JUST the db from my local install, ftp upload the templates folder and lastly use the api to set a new password for the admin account for login. - never had an issue.1 point
-
1 point
-
Me and I'm quite happy with it so I was just wondering here... So, if shortcuts work well this way then just forget about my silly ideas.1 point
-
Maybe, but on my Mac keyboard, the ALT key is closer to Enter than the CMD or CTRL keys, so for me that is the easier thing to use to clear and run. How many people out there are using the actual "Run" button instead of the shortcut? I know I do occasionally on page reload when the console isn't in focus, but it's not often. I guess my reasoning for a "Clear Results" button, rather than clearing by default is to keep it a little similar to the behavior you see with a regular terminal/command line where you have to explicitly clear what has been returned. Any strong feelings on this? PS - if we had two radios then we need to decide whether that status should be remembered or reset - sounding unnecessarily complicated to me1 point
-
Maybe default should be to clear it while ALT+Enter not to? If it's "almost always" then it would make sense, wouldn't it?1 point
-
1 point
-
I'm happy to adapt if needed, but to be honest I almost always use the ALT+Enter option to run the code which automatically clears before running: "Enter PHP code, then use CTRL/CMD+Enter to Run, or ALT/OPT+Enter to Clear & Run." Does this work for you, or do you still think we need a change?1 point
-
The one module I didn't uninstall because it was so simple it could not possibly break anything was causing the problem. Added a name space to the module, and everything works like magic. I think the module compiler just had an issue that that module for some reason. Thanks for suggestions.1 point
-
@szabesz , yes.. some problem with <pw-region> in _main.php <pw-region id="something"> ... </pw-region> in basic-page.php <p pw-append="something"> 12123123123 </p> and you get: Settings: $config->useMarkupRegions = true;$config->prependTemplateFile = '_main.php'; ProcessWire 3.0.69 PHP VERSION 7.0.181 point
-
@Neeks Did you try changing PHP/MySQL version of the site? v3 might choke on something that was ok with your current server setup.1 point
-
1 point
-
1 point
-
1 point
-
@adrian, what do you think of changing the "clear results" button in the console to a "don't clear results checkbox" meaning that every console submit clears the log unless the checkbox is checked. i find myself having to clean the console a lot while developing those days...1 point
-
Can you please provide some descriptive information about what version of ProcessWire you upgraded from and what version you upgraded to? Also information about how you did the upgrade process, to include your platform and PHP Version, would be very helpful?1 point
-
Hi @pandaman For one of my customers I made some basic experiments to connect the both systems together. Your arguments are valid. I also told him to combine the best of two worlds and let each system do what it's best for. What I can say right now, it is possible, but there might be pitfalls, that I didn't discover yet. One problem was the session management which caused conflicts so you have to modify it. Right now I have the following working solution (PW 3 and Magento 2.1): I installed Magento 2.1 in a "store" directory that lies right beside site and wire directories. I made a magento2-bridge.php in site/templates/ <?php namespace ProcessWire; require $_SERVER['DOCUMENT_ROOT'] . '/store/app/bootstrap.php'; use Magento\Framework\App\Bootstrap; class StoreApp { private static $instance; public static function get_instance() { if ( ! isset(self::$instance) && ! (self::$instance instanceof StoreApp) ) { self::$instance = new StoreApp(); } return self::$instance; } public $helper; public $quote; public $session; public $cart; public $customer; private function __construct() { $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $state = $obj->get('Magento\Framework\App\State'); $state->setAreaCode('frontend'); $this->customer = $obj->get('Magento\Customer\Model\Session')->getCustomer(); $this->quote = $obj->get('Magento\Checkout\Model\Session')->getQuote(); $this->helper = $obj->get('\Magento\Checkout\Helper\Cart'); $this->session = $obj->get('Magento\Checkout\Model\Session'); $this->cart = $obj->get('\Magento\Checkout\Model\Cart'); } } I had to modify the session management in Magento, so it stores its session variables in ProcessWires directory. I hope I remember this correctly: Change the Cookie Path in Magento @ Stores -> Configuration -> Web -> Defaut Cookie Settings to "/" (without the quotes) Change the save_path for sessions under store/app/etc/env.php 'session' => array ( 'save' => 'files', 'save_path' => $_SERVER['DOCUMENT_ROOT'].'/site/assets/sessions', At some point I changed the sessionAllow parameter of ProcessWire, but I don´t know if this is needed anymore. But for completeness, here is the code I used: $config->sessionAllow = function () { if (strpos($_SERVER['REQUEST_URI'], '/processwire/') === 0) { return true; } return false; }; Then in my site/templates/home.php I have the following code, to get data from Magento (like Customer data, what is in the cart, product information): require_once __DIR__ .'/magento2-bridge.php'; $store = StoreApp::get_instance(); $quote = $store->helper->getQuote(); $quoteitems = $quote->getAllItems(); $customer = $store->customer; bd($customer->getName()); foreach ($quoteitems as $item) { // Code to get contents per product bd($item->getName()); bd($item->getQty()); } If you are wondering what bd() means. It is a debugging output from Tracy Debugger for ProcessWire (recommended install). Why do I share this information here although it was very time-consuming and expensive to figure this out? Because I had great support from the PW community and want to give something back. If you make any progress with this, please try to do the same and share your findings with our lovely community.1 point
-
What @Alxndre' is suggesting is something like the below... First you get your category pages, then you loop over the categories, for each category finding pages that have that category selected in the Page Reference field. If there are some matching pages, output the category heading and the list of posts. $categories = $pages->find("template=category"); foreach($categories as $category) { $posts = $pages->find("template=article-post, category=$category"); if(count($posts)) { echo "<h3>$category->title</h3>"; foreach($posts as $post) { // whatever markup you want for the post echo "<p>$post->title</p>"; } } } This is fine for a lot of circumstances, but note that you do a database query to get the categories and then for each category you do a database query. If you have a lot of categories this would mean a lot of database queries. There is another approach that is more efficient: get all the posts sorted by category (as you are already), then for each post check if the category is different from the previous post's category. If it is different then output a heading. $posts = $pages->find("template=article-post, sort=category"); $category_title = ''; foreach($posts as $post) { if($post->category->title !== $category_title) { $category_title = $post->category->title; echo "<h3>$category_title</h3>"; } // whatever markup you want for the post echo "<p>$post->title</p>"; }1 point
-
Hey @bernhard - I just PM'd you with a new version that should work as expect with ready.php and hooks inside it. If you can test for me, hopefully I can get a new version released. Thanks!1 point
-
1 point
-
Update: Menu Builder Version 0.1.9. Changelog Added support for multi-lingual menu items (both PW pages and custom ones)! Thanks @Michael van Laar for 'reminder'. Note Multilingual feature only applies to multi-lingual sites. You have to choose the languages you want for your menu items (in menu settings). Multi-lingual feature only applies to menu items. This means menu titles themselves remain as normal. The feature only applies to menu item title and URL If other language's item title or URL are left empty, in the frontend, these fallback to default language's title or URL respectively. This means, for other languages, you can have, for example, a German menu title but leave the German URL blank. In that case, assuming the default language is English, the German menu item will get the English URL. Currently available in dev branch only. Please test and let me know, thanks. Screenshots Backend Frontend1 point
-
Howdy @bkno, and welcome to the forum. ProcessWire itself is very secure, in that there have been few, if any, security related updates. In fact, I am not aware of any such update in the couple of years I have been using ProcessWire. Consequently, there isn't a security mailing list like what you have become familiar with in other platforms. As far as an upgrade regiment is concerned, if you stick with the latest master version you should have no issues. For those times that you do wish to upgrade, the procedure is very simple and as a result, not anywhere close to being tiring as with the other cms/cmf you have worked with. And the only real reason you might upgrade is when new functionality becomes applicable to your site. The modules that you can install are created by the community, and should be treated as any user-defined content. As with any publicly accessible resource, it is up to the developer to guard against malicious intent. ProcessWire provides a number of tools to assist you, such as sanitizing data submitted by your users. That being said, the community members here are very knowledgeable and very experienced, and again, I am not aware of any security issues with the modules they produce. The previous security issues you experienced is why I also left those other environments. I have had no disappointments or regrets moving to ProcessWire. In addition, you can browse any topic in this forum and see the quick and accurate support provided by the community members. I don't intend for this to sound like a sales pitch. I'm only stating the facts as I have come to know them. There ya go. @LostKobrakai is one of those community members. He beat me to the post. Again.1 point
-
I purchased PHPStorm a month ago. It would be great if someone could post some tricks or hacks on how to integrate it with the PW API, so you can just use PW code directly without having to copy and paste from the reference site. I'm new with both, so anything that helps it's a nice addition. Both PHPstorm and ProcessWire seem to match great together and while PHPStorm has support for some frameworks out of the box, PW would be a great addition.1 point
-
Hello guys. Just released new version of Czech Language Pack (for PW 3.0.61). Fully translated. Ready for testing. https://github.com/PavelTajdus/ProcessWire-Czech-Language-Pack/releases Bylo by fajn, pokud by to mohl někdo projet a zkontrolovat. Ze začátku mi to překládání dvakrát nešlo, než jsem se chytl. Sice jsem to pak opravoval co jsem našel, ale i tak by bylo vhodné to projet. Prosím, udělejte si čas a nahlašte mi chyby, aby čeština pro PW byla co nejlepší. Díky.1 point
-
Tak v nové verzi se toho dost změnilo, takže některé věci znovu překládám. Takže to ještě chvíli potrvá. Aktuálně se mi nedostává příliš prostoru pro překládání, takže počítám, že mi to ještě nějaký ten týden zabere. Takže prosím o trpělivost. Pokud by měl někdo zájem pomoct s překladem, tak mě prosím kontaktujte.1 point
-
Hi guys, I am pretty close to finish with translation, and i will release new version for processwire 3.0 in a week or two. Yet I am thinking about waiting for stable PW 3.0.58. Anyway, it will be soon Stay tuned.1 point