All Activity

This stream auto-updates   

  1. Past hour
  2. Out of curiosity, would this work? $articles = $pages->find("template=project, sort=-date "); foreach ($articles as $article) { // from https://processwire.com/api/modules/select-options-fieldtype/#outputting-selected-options-on-a-page $n = $article->number->title; // <<<< the value of the selected option $thumbs = $article->images->slice(0, $n); foreach($thumbs as $thumb) { echo "<img src='$thumb->url' >"; } }
  3. Hi all! I have ProcessWire 3.0.42 installed with a lot of content. How can I install this bootstrap profile over it? Cheers Fred
  4. Didn't know it was that simple, I really overcomplicated it with apache configurations and so. You made my day!
  5. Module

    Thumbs up for 3.x branch!
  6. PW doesn't use latest version of the PHP SmartyPants, it uses 1.7.1 while latest is 1.8.1 Maybe updating that would fix your issue? You can try it by updating that module by yourself and maybe creating github issue or PR for Ryan to update it in Core too (shouldn't be in the core at all imo). Here you can find the llibrary pw uses: https://michelf.ca/projects/php-smartypants/
  7. Not sure I understand what you are trying to achieve. You need PHP to use PW, you cannot use it from html only. Why don't you install processwire on www,yoursite.com/api/ subdirectory? There your /index.html could be static html/js and then /api/* would go for pw.
  8. The problem is I don't use php except for calling the API. My guess is if I go to website.com/pw_api/some_template/, Apache first looks for the file index.php, processwire is initialized and handles the route. Without the index.php the url /api/some_template doesn't have any meaning for the server.
  9. Yes, you can include processwire from any path: https://processwire.com/api/include/
  10. Today
  11. <random-silliness> Tools: RM; Countable JS and circleChart Approach: Include one main.php , JS and CSS using RM render file option. main.php conditionally requires_once 'some-php-file.php' depending on the page being edited. </random-silliness>
  12. Hey, I'm using processwire as a backend service (as a REST API to be more specific). I would like to let my server point at my index.html file (It is not possible to change this to a php file for many reasons), but without the index.php processwire won't work. Can processwire be used if I for example move the index.php file to a subdirectory? Kind regards, Bram
  13. Yep, it does not. Maybe because config.php is already included? I should check it Anyway, because of such issues I recently switched to using __DIR__, eg: require_once __DIR__ . '/./creds.php';
  14. You're right. require_once("creds.php"); // this works require_once("./creds.php"); // this doesn't No idea why.
  15. Hey @evan, thanks for your time and patience. My content-blocks aren't stored as subpage on the particular page. I collect them in an unpublished page (called Views, due to menu reasons). Is there a chance to search in the content of the blocks referring to the linked page? This will of course return the one unpublished page where all blocks are stored (Views) <?php $q = $sanitizer->text($input->get->q); $input->whitelist('q', $q); $q = $sanitizer->selectorValue($q); //selector normal content $selector = "title|headline|summary~=$q, limit=50"; // selector content blocks $views_query = [ 'template=Text|ParallaxBanner', // Template 'textfield|parallaxtext*="'.$q.'"' // Fields ]; if($user->isLoggedin()) $selector .= ", has_parent!=2"; // normal pages $matches = $pages->find($selector); // Find parent pages of content blocks $views_results = new PageArray(); foreach ($pages->find( implode(', ', $views_query) ) as $p) { $views_results->add($p->parent); } // Combine results $matches->import($views_results); ?>
  16. include_once "creds.php" and similar do work for me. Maybe is it something about your setup?
  17. the missing '}' was a incomplete copy/paste however i found another solution which works fine: $n = $article->view; $thumbs = $article->images->find("limit=$n");
  18. Did you set autoload to true? I was getting the same problem with a module and I read somewhere that it will only invoke the ready method if autoload's true.
  19. Module

    Does anybody know how to solve with Pages2Pdf second page content top margin?, I attach an image so you can see that the paragraph hasn't got any padding or margin although is set.
  20. Hi, @skovar! In the end, I decided to not use the module on the project I was working on because some requirements changed, but I think it's working, but I didn't try it with the latest version of PW. What I mean is that with my pull request, the module can upload the image variations.
  21. Some good suggestions, thanks. Just gonna crack on with a test site and see if I can put this together. Can I just clarify something, when we talk of creating new users, are we saying all users will be listed at '/access/users/'? Or do they sometimes get created in the page tree? (I'm talking generally, not edge case) Also, (in @LostKobrakai's approach) if having minimal fields in the user template means having a second template, wouldn't deleting a user in the admin (when logged in as superuser) mean also having to delete the associated profile page manually? Everything seems to be doubled up. I'm sure my preferred method will become clear once I've played around with it.
  22. I can only see a missing '}' at the end to close the first loop (presuming an incomplete copy/paste), the rest looks ok to me. I just tried slice in something similar and works fine. // home.php with images field called 'images' <?php $toRender = $page->images->slice(0, 2); // 2 of 4 available images foreach($toRender as $image) { echo "<img src='{$image->url}' />"; } ?> Be interested to see what's wrong here.
  23. To me, saving database credentials to a Git repository, even if that repo is private, is a big no-no. So I've been tinkering with different ways to deploy sites to production environments without saving the database credentials to the repo. I know that there is a the config-dev.php option. But that hasn't worked for me, as I will explain later. I added this to my config.php: $config->env = "dev"; if($config->env == "dev") { $config->dbHost = 'localhost'; $config->dbName = 'processwire'; $config->dbUser = 'root'; $config->dbPass = 'root'; $config->dbPort = '3306'; } else { require("./{$config->env}.config.php"); } So if $config->env = "production", production.config.php should be loaded: $config->dbHost = 'localhost'; $config->dbName = 'processwire-production'; $config->dbUser = 'username'; $config->dbPass = 'productionPassWord'; $config->dbPort = '3306'; I can't see anything wrong with the syntax of this at all - but for some reason, if that file is added with require() or require_once(), ProcessWire never loads. If it's loaded with include(), I get an error about the page not being found, and there being no install.php present. So it seems like for some reason, there is no way to include a file in config.php, which confuses me immensely. How my brain works I'll try to explain my thought process behind this a little more. I think it's a good idea for dev environments (especially those that come with a Vagrant box and a defined database already installed) to include dev-level database creds. It should just work. If someone works on this site after me, they shouldn't have to spend a ton of time getting a config file set up. Secondly, having a config.php file and a config-dev.php file frustrates me because for the developer that comes after me, they could really use the config-dev file! But if it's in the repo, it gets deployed. If it gets deployed, it gets called on the staging/production server, and that is no good! Also, config.php and config-dev.php would in most cases pretty much completely mirror one another with the exception of database creds, and maybe debug or a few other things. That is why I want to have all the configs in the repo within config.php except for the tiny bits that are environment-specific. They should be able to be included, right?
  24. Module

    I ended up here because I searched for a solution. I would like to see such a page-edit-lock feature built-in the core as well. Go ahead and vote: https://github.com/processwire/processwire-requests/issues/23
  25. @Robin S ah I see, I've never used that. Thanks for the info.
  26. just wanted to share a screencast of one old website with a kind of widget-visibility-ui that could serve as inspiration. it's not good enough to share as a module, maybe someone wants to take it further -> pm
  27. Hi! I got a little issue with this really great module: I wan't to use the "smart description" option for a field that contains pretty lot of text. Is there a way to shorten/strip this text down to 160 characters? Otherwise the "smart description" make not much sense for me ... Or is there a workaround for this issue? Thanks!
  1. Load more activity