Jump to content

Sergio

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Sergio

  1. You're right! I didn't know that.
  2. Instead of $pages->count you may prefer to use $pages->findOne, so you can search for pages hidden or unpublished. See: https://processwire.com/api/ref/pages/find-one/ So: <?php $firstname = $sanitizer->text($input->get->firstname); // firstname should be the name of the input field $lastname = $sanitizer->text($input->get->lastname); $fullname = $firstname . $lastname; $sitetocheck = strtolower($fullname); $p = $pages->findOne("name=$sitetocheck"); if ( $p->id ) { echo "Sorry, seems you 're already registered"; } else { $p = new Page(); $p->template = 'basic-page'; // set template $p->parent = wire('pages')->get('/about/'); // set the parent $p->name = '$fullname'; $p->title = '$fullname'; $p->save(); echo "Thanks for registration"; } ?>
  3. Maybe you can try http://modules.processwire.com/modules/auto-smush/ But I'm thinking about using Cloudinary for my next project: http://cloudinary.com/ One of the greatest features of their service is to auto detect and serve .webp files if the browser supports. This format has a better compression that jpg or png.
  4. Cool site, Ben! Seems it was very fun to work on it. The css / js file sizes are minimum which is very good, congrats! But I noticed that some images could be more compressed and save a lot of bandwidth on mobile, like clouds.png. I used https://tinypng.com/ to compress it and it went from 278kb to 91.1kb. Their tool also compresses JPGs. I reckon you didn't have the time to do it yet.
  5. @Soma wrote about his solution related to your problem, take a look:
  6. @ian has a site about moths, maybe he can help you.
  7. There's this thread:
  8. Yes if you expect the user to translate it by him/herself. But if it's your job, just wrap the string in code and translate it in the language settings page, loading the PHP file there. Although, I've found the use of a single file to handle all strings, like a _translations.php much easier. I just include it within my _init.php. I have one here with 225 phrases and counting.
  9. I'm curious, why didn't you use PW's translation capabilities, in this case, to avoid the code repetition?
  10. I think the textarea fields are configured as MediumText on the database, so you'll have to change that if your needs exceed its maximum length. Check this page for a reference (this is using InnoDB engine, BTW): https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html#data-types-storage-reqs-strings
  11. Try to print the entire $input array to show what's inside it: <?php print_r($input); ?> And have you tried the use of regex on the allow url segments field? regex:^category/[a-z]+$
  12. hahaha pretty expensive I guess.
  13. Hello to all female friends here at ProcessWire. I received today 3 tickets to tickets for Collision (Websummit) 2018 , but I can give them only to women, and I decided to post here first. Is there anyone interested? This is the message I got:
  14. My main 2011 15" Macbook Pro had serious graphic problems and stopped working couple weeks ago and I decided to build a Windows machine for the same reason. I also have a 13" that I use to travel. Here in Brazil, a Macbook Pro cost is outrageous, a powerful Mac setup can cost up to 3 or 4 months of salary of an experienced developer. A default 15" Macbook Pro costs here R$ 18.499,00 which converts to US$ 5,581.00!!! So, after 10 years of using only Macs, I built a PC that cost me about $1,700 and it's a beast of a machine for developing and video editing (and some games): Processor: Ryzen 7 1700 - Octa core, 3GHz RAM: 16GB 2133 MHz Motherboard: Gigabyte B350 Gaming 3 HD/SSD: 1 Kingston 250 GB SSD + 1 Western Digital 1TB 7200 rpm GPU: Asus Radeon RX 460 - 2GB RAM Monitor, keyboard, and mouse I already had. They cost about US$270 together. I installed Ubuntu through Windows WSL but I'm not using it like I thought I would. I installed Laragon and it works perfectly for running ProcessWire and other PHP projects. Windows 10 Pro is a very good OS, but I miss some good software like SequelPro and Transmit. The Windows equivalents are not as polished.
  15. You just need to add the Russian language pack to the admin and set the Russian language on each admin user profile. A language pack is a zip containing many files that will translate the admin pages, fields etc. Download the package: http://modules.processwire.com/modules/russian/ After that, go to /admin/setup/languages/, edit Russian and upload the file on the "Core Translation Files" section.
  16. Did you try the http://modules.processwire.com/modules/fieldtype-secure-file/ module?
  17. I think this is a job for Pro Field Repeater Matrix: https://processwire.com/api/modules/profields/repeater-matrix/
  18. I confirm that this version is working on Windows 10, using https://github.com/cretueusebiu/valet-windows If yours doesn't work, maybe enabling developer mode on Windows is required. Thanks @LostKobrakai !
  19. Good idea, but I think they are handpicking those, I don't see a submission form. Do you?
  20. You don't need to change anything in the database. The only change needed in this case is the httpHosts array: $config->httpHosts = array('testing.com'); in the config.php file.
  21. Oh yeah, it can be done such way. I used this approach to create a dark version in the past.
  22. Check these methods: $p->prepend($page) Prepend the given page to the beginning of the PageArray. $p->append($page) Append the given page to the end of the PageArray. More: https://processwire.com/api/arrays/page/
  23. I agree! I was playing around with the styles the other day for about 20 minutes to create a "calm" version, not yet finished, but see the screenshots.
  24. A page does not have an icon, its template does, so if you are creating the template programmatically, use: $template->setIcon($icon); And about the sort order, do you wish to set the sort of the children or just append the page at the beginning of the list of its siblings?
×
×
  • Create New...