Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/28/2017 in all areas

  1. 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/
    9 points
  2. 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.
    6 points
  3. Hi @franciccio-ITALIANO There are several ways to do that. 1. Use ProField Multiplier https://processwire.com/api/modules/profields/multiplier/ 2. Use repeater field 3. Use MultiValue Textformatter https://modules.processwire.com/modules/textformatter-multi-value/
    3 points
  4. Hi @webhoes You can do it in several ways $arr = $pages->find()->getArray(); $result = array_unique($arr); or $arr = $pages->find()->unique(); https://processwire.com/api/ref/wirearray/unique/ $pages->find() method returns a filtered PageArray unless an include mode is specified.
    3 points
  5. more ideas: https://modules.processwire.com/modules/fieldtype-yaml/ https://modules.processwire.com/modules/fieldtype-matrix/ ProFields: Page Table in the core.
    2 points
  6. You could achieve this by using a repeater with the url field in it. https://processwire.com/api/fieldtypes/repeaters/ Once you have that set up you do something like: <?php foreach($page->url_repeater as $url) { echo "<a href=\"{$url->url_field}\">" . "{$url->url_field}" . "</a>"; } ?>
    2 points
  7. Thanks, it's a bug, will be fixed soon.
    2 points
  8. hi tpr, seems that the move up/down icons overlap the delete icon making it impossible to click on it. do you need more information to reproduce this? aos 1.5.0 and pw 3.0.68
    2 points
  9. 2 points
  10. This week we've got more to tell (and show) you about our upcoming page export/import feature, along with several screenshots of the progress: https://processwire.com/blog/posts/processwire-3.0.68-and-more-on-page-export-import/
    1 point
  11. This week we’ve got lots of details on our successful migration to Amazon AWS services for the processwire.com network of sites. We've also got updates on the current core and ProDrafts status. https://processwire.com/blog/posts/amazon-aws-now-powering-processwire.com-sites/
    1 point
  12. 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
  13. is there still a bug? Same problem here on Processwire 3.0.69 $config->useMarkupRegions = true; $config->prependTemplateFile = '_main.php'; in _main.php <?php namespace ProcessWire; include_once("./_init.php"); ?> .... <region id="dummy"> <h1><?php echo $title; ?></h1> <?php echo $teaser; echo $content; ?> </region> in basic-page.php <?php namespace ProcessWire; ?> <p pw-prepend="dummy"> 123 </p> Voila:
    1 point
  14. 1 point
  15. i have one type of button that submits via ajax so does all of the processing without opening a new window; some of my more primitive versions just open a new window to run the action...
    1 point
  16. Sorry, I'm half asleep . Nope, POST, should not work (a redirect has occurred, the POST is gone). A GET works because it is always there. As a workaround, JS can listen to 'submit_save.'
    1 point
  17. Maybe our wires are getting crossed somewhere . I thought the current solution meets both your and other people's/scenarios' needs. I still don't understand why users should be forced to save files in one location (/fields/). EDIT: In addition, what if I have several RM fields (either in the same or different templates) and wanted those fields to share some base JS and CSS? That's not possible if we force users to name their JS and CSS after their fields. Maybe I am missing something. Maybe if I saw a graphic/mock-up of how the RM field settings (Details Tab) would look like in your suggested solution, I would get it . For now, I will let the changes I've made stay as I believe they cater for different scenarios. If you mean within RM, the reason is that $input is not scoped locally. Have a look at this post downward. If that's not it, please let me know. Thanks. Edit: Silly me. No, POST should not work. By the time the page is reloaded (a redirect), the POST is gone. GET, on the other hand, is 'always' ther. For POST, you can JS as a workaround (to listen to 'submit_save').
    1 point
  18. Just a quick note - the "Page Delete" module is obsolete - that functionality has been in the core for quite some time now.
    1 point
  19. I can't thank you enough @jmartsch !!! These are the kind of problems I'm sure I would encounter doing this job. It's a great start! If I find any problem dealing with this job, I'll let you know... Thank you again
    1 point
  20. $title is defined in _init.php in the "templates" folder, isn't it? $title = $page->get('headline|title'); // headline if available, otherwise title Are you modifying the headline field or the title field? Edit: ... in the admin/backend? The browser page title, the header (h1...) page title, the parent page title...? Which "title" (field(s)) exactly doesn't change? Because you are using several ones in your code...
    1 point
  21. How/where do you change it? What is it before/after the change? What does this mean? Nothing shows up or do you get some error? <title><?php echo $title; ?></title> In your code you don't define $title anywhere. Maybe you want $page->title?
    1 point
  22. Maybe Magento 2 in conjunction with ProcessWire will fit your needs. Take a look at the post where I contributed a possible solution to get this working. If there are more people who are working with this approach, we get a nice bridge between the two systems.
    1 point
  23. Problem solved. My bad. In my source code I had commented out the following line: $numSent = $mail->send(); That was the case because a little time ago when I was developing the submit form, I must have tried to test something. What made me so confused was the fact that the activity log still said "mail send" so I never looked into this part of the code again. Now that's a really stupid thing, sorry that I bothered you with it.
    1 point
  24. Would be great to see a working example. An exported site profile maybe? Thanks advance!
    1 point
  25. Hi, The short answer is that you can't. The long one is that ProcessWire site profiles are not like themes you can just simply replace. You need to refactor your current template files. Or am I misunderstanding your question perhaps?
    1 point
  26. You should try to uninstall WireMailSMTP and try sending with native WireMail. This should work, as it uses the PHP mail() function. If WireMail works, and WireMailSMTP don't, it might be firewall restricted by your hosters settings. Native PHP mail function is controlled and allowed by your hoster, other (foreign) connections (other IPs or only Ports) maybe blocked by firewall settings of your hoster. (?)
    1 point
  27. We aren't using a load balancer for this processwire.com server (just a single Amazon instance). But for the sites where we are (and running PW), there is a shell script that syncs /site/assets/ and /site/templates/, across the instances. I don't know exactly how it works, but can find out more. I know it runs every 30 minutes (cron job) and whenever a change is detected. Note that it also specifically excludes /site/assets/cache/ and /site/assets/sessions/, as those vary between the instances. Also important, is that when it comes to using the PW admin, we setup a separate hostname for that purpose (admin.domain.com) that always hits the same instance (which we call the "A" instance). This is the instance that the shell script considers the master when it comes to syncing files. That way, any changes that occur to the synced files always originate on the A instance. There is a setting in AWS that lets you lock a hostname to a specific load balanced EC2 instance. Then we keep any editing locked to that hostname by adding this to /site/templates/admin.php: if($config->httpHost != 'admin.domain.com') { $session->redirect('https://admin.domain.com/processwire/'); } And we keep non-authenticated requests out of the admin hostname by having this in the /site/templates/_init.php file ($config->prependTemplatefile setting): if($config->httpHost == 'admin.domain.com' && !$user->isLoggedin()) { $session->redirect('https://www.domain.com' . $page->url); } This ensures search engines don't get in and start indexing another copy of the site on the admin hostname.
    1 point
  28. Quick workaround... in _main.php add <region id="dummy"></region> in basic-page.php add <region id="dummy"></region> Seems PW needs a region in the page template to kick-start the process.
    1 point
  29. Hi, just stumbled over a little module that i built for my last project. it helped me to test performance of my rockdatatables module to generate 3000 random json datasets and i want to share it with you. maybe it saves some time for someone. https://gitlab.com/baumrock/RockDummyData/ easy example: $rdd = $modules->get('RockDummyData'); for($i=0; $i<15; $i++) { // this has to be inside the for-loop to always get a new dummy $dummy = $rdd->getDummy(); echo date("d.m.Y H:i:s", $dummy->timestamp) . "<br>"; } more advanced: $json = new stdClass(); $json->data = array(); $rdd = $modules->get('RockDummyData'); for($i=0; $i<3000; $i++) { // this has to be inside the for-loop to always get a new dummy $dummy = $rdd->getDummy(); $obj = new stdClass(); $obj->name = $dummy->forename . ' ' . $dummy->surname; $obj->position = $dummy->job; $obj->office = $dummy->city; $obj->color = $dummy->color; $obj->start_date = new stdClass(); $obj->start_date->display = date('d.m.Y',$dummy->timestamp); $obj->start_date->sort = $dummy->timestamp; $obj->salary = rand(0,10000); $json->data[] = $obj; } echo json_encode($json); you have to store your random datasets on your own into the /data folder. there are several services for creating all kinds of random data on the web - if you know one service that allows sharing those datasets let me know and i can include common needed data into the module
    1 point
  30. The nifty code: $base = wire('config')->urls; $cssUrl = $base->InputfieldPassword."InputfieldPassword.css"; echo '<link rel="stylesheet" href="'.$cssUrl.'">'; $jsUrls = array(); $jsUrls[] = $base->InputfieldPassword."complexify/jquery.complexify.min.js"; $jsUrls[] = $base->InputfieldPassword."complexify/jquery.complexify.banlist.js"; $jsUrls[] = $base->JqueryCore."xregexp.min.js"; $jsUrls[] = $base->InputfieldPassword."InputfieldPassword.min.js"; foreach ($jsUrls as $jsUrl) { echo "<script src='$jsUrl'></script>"; }
    1 point
  31. This feature is amazing. Just installed it and our clients were amazed! I didn't even expect anyone to notice. Thanks a million.
    1 point
  32. @ryan, I want to let you know I really admire the way you get things done! Every time you solve a problem it is an example of a perfect engineer solution. Spot a chance to create a feature everybody wants but few have, examine existing solutions present, learn from them, build on them, make them work better than before, deliver a working feature within a reasonable time frame, provide comprehensive docs right there in the code for tech people, write a press release for the end users, move on to another task. Way back I once started a topic called "What is "Reiska". I think now I can feel what @apeisa and others at Avoine meant by this title. There is such a word in every language, and all of them fit you and your type of people (of which there is quite a few here in forums, luckily). I sometimes find myself questioning some of your marketing and organizational decisions, but I always applaud to and try to learn those problem solving skills and mindset from you. ProcessWire is unique thing, that inspired my way from "anykey clicking" web development to managing to read and write some relatively complicated code. I try hard to provide my clients with the best engineer solutions they can get based on ProcessWire. Because I can, and because it so exiting to do with PW, and because this is the way real stuff should be done. Thanks for the inspiration.
    1 point
  33. Yes, that would work. Even without Soma's module there is a checkbox for clearing the cache in the config of the PageRender module. Or use a simple function/module/snippet to clear just the pages that use the particular templates you worked on, e.g. function clearCache($tpls) { $p = new \ProcessWire\Page(); $pgs = wire('pages')->find("template=$tpls"); wire('modules')->PageRender->clearCacheFilePages($pgs, $p); } clearCache('basic_page|home');
    1 point
  34. Aah, did we intend to post a link to the module maybe?
    1 point
  35. This is such a great module; recently I used it to create custom action buttons on my calendar/futuremail app; Send or preview the email message for the future mail: send or preview a calendar event, which is typed by a chosen template (e.g. event, lesson reminder, etc.)
    1 point
  36. If you are version controlling your entire /site/ dir then you'd definitely want to exclude cache and sessions. My opinion is that if you version control this stuff, just do it on /site/templates/, and let each module be under its own version control (or use Modules Manager). I don't think it's worth versioning /site/assets/files/ for instance, because any change of versions would disconnect it with your database, which is something you wouldn't want.
    1 point
  37. Another option, if you want something you can reuse anytime: 1. Create a new field and call it 'redirect_url' or something like that, and use the 'URL' fieldtype. 2. Add that field to your template where you'd want to use it, or create a new template just for the purpose, like a template named 'redirect'. 3. Edit the page that you want to be a symlink and populate the 'redirect_url' field with the URL you want it to redirect to. 4. In your nav-generation code that links to the pages, do something like this: <?php $url = $subpage->get("redirect_url|url"); // use redirect_url if there, otherwise use url echo "<a href='$url'>{$subpage->title}</a>"; 5. You might also want to add this to your template that has the 'redirect_url' field: just in case there's anything linking to it directly. That way it'll send people to the right place either way: <?php if($page->redirect_url) $session->redirect($page->redirect_url);
    1 point
×
×
  • Create New...