bora

Members
  • Content Count

    33
  • Joined

  • Last visited

Community Reputation

35 Excellent

About bora

  • Rank
    Jr. Member

Profile Information

  • Gender
    Male
  • Location
    Leiden, Netherlands

Recent Profile Visitors

2,054 profile views
  1. Any ideas on topic or should I give more details?
  2. Hello, I'm migrated a few hundred users from an old system to PW via API. I created users, they can log in etc but only one thing is not working. Users have repeater fields. After I create users I also create those repeaters but I cannot get their value from front-end of the website. But if I go to users editing page from admin I see the values in place correctly. And when I save the user from editing page (without changing anything just saving), it starts to work normally. What am I missing here, what should I do to achieve this by API? Thanks
  3. That was actually what I did, disable templateCompile from config.php after running this script. Added this recommendation to gist as well to help anyone willing to try it. Adding namespace to all files and disabling templateCompile is, as far as I understand, is the cleanest state for PW3. By the way FileCompiler worked for modules flawlessly, except two small exceptions (one was my fault one was 3rd party module). This week I'll test further before migrating to PW3 on production as well. So far on my local copy I enjoy the perks of PW3 already On the other hand, adding namespace to every little view partial doesn't look like very ideal and practical. I will look into other possible ways of using partials instead of wireRenderFile. Error generally occured due to using global functions like wire() or functions from _func.php on non-namespaced files. Out of habit from Laravel, CakePHP etc. I assumed that global functions would continue working without a namespace but then I realized I should be thinking everything within Processwire.
  4. Yes, I use wireRenderFile method extensively. Now I tried again by changing all calls to wireRenderFile function to absolute from the wrapper function I use. I only put namespace on root folder of templates. But even though I use full paths on wireRenderFile, the .php files in templates/partials still throws errors like Fatal error: Call to undefined function getCatalogues() in /var/www/dev.com/pw3/site/templates/partials/main.php on line 9 (it's defined in _func.php)
  5. Hello everyone, Last night as a "saturday night shitty weather stay at home" project I attempted to migrate a project that was on PW 2.7.x to PW 3.x I use a lot of partials on the project so I have around 200 php files that needs to be namespaced. Compiler was giving me trouble with "Call undefined function" errors. Being the lazy developer I attempted to wrote a script after getting bored over pasting the namespace Processwire; line into around 10 files. Below you can find the script, that is very basically adds <?php namespace Processwire;?> as the first line of every .php and .module file in the given directory and shows you the results. Of course it checks for namespace Processwire first By default it assumes ./site/templates folder but I tried it with a module which is giving errors due to namespaces and worked fine. Be careful and remember to take backups first https://gist.github.com/borantula/e41c4b6ba36f78b1110d400a16754691
  6. bora

    Hello, Any of you also get "upstream sent too big header while reading response header from upstream," error and site went down with 502 while trying ChromePhpLogger? I found out it's a problem with nginx. https://github.com/ccampbell/chromephp/issues/10 I couldn't find a solution but in case anyone else has this, nginx is to blame :/
  7. bora

    Thank you for the tip I put the main email that collects all form submissions of the site in TO and rest of them in CC. This solves the problem fine for now, if it's needed I'll extend the class And thank you for compliment, the old one looked like a mafia guy in deed
  8. Hello, When I try to mail via wiremail, using an array of email addresses to send I always receive them as if only sent to me. ( What I mean is, I only see one address on to field when I receive mail) $mail = wireMail(); $to = ['myemail@email.com','otheremai@email.com']; $mail->to($to); Is there any way to send them together? Thanks ahead
  9. In the site we are developing we noticed a bug. If we save a page with already existing name in the secondary language it skips the "Already in use" check. (It uses latest dev version) I can open 2 pages under the same parent with the same url with the second language. To be sure I did another clean installation to see if it is a core bug or result of an extra module, it works well on the clean install. Where or which hooks should I check for this to find out which code might be causing this during save process? Thanks ahead
  10. bora

    Great design work, I love the layout and colors. Without using absurd and heavy javascript effects you managed to create a very much alive site.
  11. bora

    To prevent open in new window or save link as by user.
  12. bora

    I just coded this functionality with updated methods of PW. I use it to give all the images of the news page as a package for press release purposes. This is triggered by a button on the page like below, so the link above does not change, page is stable but download starts. <button onclick="window.location.href='<?= $page->httpUrl; ?>?download=images'"> if ($input->get->download == 'images') { if ($page->images->count() > 0) { //collect images $imagesArray = []; foreach ($page->images as $img) { $imagesArray[] = $img->filename; } //zip images //TODO: in a function $zipPath = $config->paths->files . $page->id . DIRECTORY_SEPARATOR . $page->name . '.zip'; wireZipFile($zipPath, $imagesArray, [ 'overwrite' => true ]); $options = array( // boolean: halt program execution after file send 'exit' => true, // boolean|null: whether file should force download (null=let content-type header decide) 'forceDownload' => true, // string: filename you want the download to show on the user's computer, or blank to use existing. 'downloadFilename' => $page->name . '.zip' ); wireSendFile($zipPath, $options); exit; } }
  13. bora

    Hello, When I try this, it downloads the files (in my test case a docx file). It works but two things happen. 1- It renames file to download.doc 2- It converts the extension from docx to doc Any idea why that happens? Ok just after a second later figured it out. Setting forceDownload to false causes both of them. Works perfectly fine now, many thanks Soma.
  14. bora

    This is a sample website configuration for that works under domain.com/tr subdirectory (for historical reasons). Though it is a WordPress site, I think it might be similar (location /tr/ part) code is: server { root /usr/share/nginx/html/blog/; index index.php index.html index.htm; server_name domain.com; location / { # try_files $uri $uri/ =404; try_files $uri $uri/ /index.php?q=$uri&$args; } location /tr/ { try_files $uri $uri/ /tr/index.php?$args; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
  15. bora

    And as an additional advice, for creating dynamically, you may include a global option for all pages like "include in the menu" and you can use this option for filtering pages that you want to or don't want include in the tree