Leaderboard
Popular Content
Showing content with the highest reputation on 06/18/2024 in all areas
-
Fruitcake has been using ProcessWire for a while now but I didn't get around to posting any of the around 30 sites we did so far. But let me start off with our own new website which launched earlier this year. Our new brand website had the goal to be modern and simple and uses a minimalistic approach. The centerpiece of the page of course is our portfolio which most of the effort went into. It uses a playful and seemingly random (it's not!) layout. The portfolio detail page uses a vertical slider which from a technical point of view was the most challenging part. As for modules we are using, we like to do most of the stuff ourselves so it really only boils down to the Repeater Matrix Fieldtype from @ryan's ProFields package and SEO is done using SeoMaestro by @Wanze. Here you can have a look yourself: Die Kommunikationsagentur | fruitcake.ch Here is a preview of the masthead: Let me know what you think ?9 points
-
Now I have finally switched from Laragon (Windows) to DDEV (WSL2). My first attempt some time ago was not very successful, but this time everything worked straight away. However, I need a "special" feature for my project: sqlsrv/pdo_sqlsrv as a PHP extension for the connection to an MSSQL server That was a minor challenge at first, then i found some older scripts on Stackoverflow, but unfortunately they no longer worked. Here is a short guide on how to use sqlsrv (incl. msodbcsql18) with DDEV: Create a "Dockerfile" and a "install_sqlsrv.sh" inside of the .ddev/web-build folder Dockerfile: ARG BASE_IMAGE FROM $BASE_IMAGE COPY install_sqlsrv.sh /var/tmp/ RUN apt-get update && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests gcc make autoconf libc-dev pkg-config php-pear php-dev RUN /bin/bash /var/tmp/install_sqlsrv.sh install_sqlsrv.sh: #!/usr/bin/env bash export DEBIAN_FRONTEND=noninteractive # Install sqlsrv drivers. export PHP_VERSIONS="php8.1 php8.2 php8.3" # Note: Only works for PHP 7.0+. export PHP_SUFFIXES="8.1 8.2 8.3" OS=$(grep -P '(?<=^ID=)' /etc/os-release | cut -c 4-) VERSION=$(lsb_release -rs) if [ ! -f /etc/apt/sources.list.d/mssql-release.list ]; then curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg curl https://packages.microsoft.com/config/debian/12/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list fi sudo apt-get update sudo apt -y update for v in $PHP_VERSIONS; do sudo apt-get install -y "$v" "$v"-dev "$v"-xml done if [ ! -d /opt/microsoft ]; then sudo ACCEPT_EULA=Y apt -y install msodbcsql18 mssql-tools sudo apt -y install unixodbc-dev echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >>~/.bash_profile echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >>~/.bashrc fi for v in $PHP_SUFFIXES; do sudo pecl -d php_suffix="$v" install sqlsrv sudo pecl -d php_suffix="$v" install pdo_sqlsrv # This does not remove the extensions; it just removes the metadata that says # the extensions are installed. sudo pecl uninstall -r sqlsrv sudo pecl uninstall -r pdo_sqlsrv done for v in $PHP_SUFFIXES; do sudo bash -c "printf \"; priority=20\nextension=sqlsrv.so\n\" >/etc/php/\"$v\"/mods-available/sqlsrv.ini " sudo bash -c "printf \"; priority=30\nextension=pdo_sqlsrv.so\n\" >/etc/php/\"$v\"/mods-available/pdo_sqlsrv.ini " sudo bash -c "chmod 666 /etc/php/"$v"/mods-available/*sqlsrv*.ini" done sudo phpenmod sqlsrv pdo_sqlsrv ddev start -> Aaaand BAM! Everything is working ? DDEV is simply great to use once you know how.3 points
-
While you are optimizing images, don't forget this one: view-retro-looking-personal-computer-2-1-1.png (on https://fruitcake.ch/projekte/40-jahre-fruitcake/) which is 14.7 MB :)2 points
-
Not at once, but in 3 rounds, first by = then ? then : But I guess you are hitting 80 chars limit anyhow, so maybe something like this would be better?1 point
-
@poljpocket Thanks for posting that. Looks good, but I'm experiencing extremely slow page loads on the "Meet the team" page. Some of the staff images have been loading for well over a minute. (Chrome or Firefox, both the same.)1 point
-
1 point
-
@Purple your question is more related to php as to processwire. You better search in stackoverflow for these kind of question. Anyway, you could use a for loop. This code gives you the first images of the first five category children. for ($i = 0; $i <= 4; $i++) { foreach($categories as $category) { $image = $category->children->eq($i)->images->first; } }1 point
-
Cool yeah I agree re: cast vs loose comparison. I'm not entirely sure why it is getting stored/pulled as a string in my install, but it is. In terms of PageField vs field, this comes up if you have a braoder library of RepeaterMatrix types and need to iterate over the fieldgroup for the RepeaterMatrix - that field list gets a bit unwieldy (since it includes all fields for all matrix types for the given matrix). If I have an operation that iterates through the fields list, I've found it useful to test certain operations where Page content is being used to test for instanceof PageField - but that is probably a niche case limited to page builder assemblies... I don't think under normal circumstances it makes much of a difference.1 point
-
@netcarver Figured you may be familiar but added some recommendations here for the Linux curious!1 point
-
Thanks @FireWire, @Andi Actually, that dependency problem broke both timeshift and pacman - so I had to resort to... # SKIP_AUTOSNAP=1 pacman-static -Syu to skip timeshift snapshots (I'm using BTRFS) and use the staticly linked version of pacman. Also removed the offending AUR install of cutycapt-qt5-git and qt5-webkit, and now all is good.1 point
-
@netcarver I keep a backup drive connected when I'm at my desk and also use Timeshift as well as Back In Time. Timeshift, as @Andi recommends, is set up to snapshot the system as often as hourly when needed and every time I execute a package command including install/update/uninstall with timeshift autsnap. I keep snapshots for X number of hours/days/weeks/months. If you're running EXT4 it's all done easily with an external drive. Back in time for user file snapshots at 30min intervals. Being able to grab a file at an earlier version with pretty granular diffs is great. Samsung 990 Pro internal + T9 external, fastest snapshots ever ?1 point
-
Sorry to hear that @netcarver- glad you found a solution. One thing I would strongly suggest when running Manjaro on a production machine is to choose BTRFS as file system during installation, and then make sure timeshift-autosnap-manjaro is installed. This way you get an automatic BTRFS snapshot of your system files on every update, that you can restore or directly boot into from GRUB.1 point
-
Manjaro here as well - though I have had a few issues with updates due to an AUR dependency on an obscure qt5 package that left things broken and pacman non-runnable. Had to use a staticly linked version of pacman to fix things.1 point
-
+1 for Manjaro from me ? I decided to make the jump to Linux again during Covid, with Windows 7 reaching EOL. Did some distro-hopping for a while and landed on Manjaro Cinnamon Community Edition. You basically get the stability of Mint with the rolling release model of the Manjaro / Arch ecosystem with this one. Manjaro Gnome is very polished, but during my time with it I got really annoyed with extensions breaking on every update, and some other qol issues. Cinnamon is just solid as a rock. Nemo is a fantastic file manager with tons of extensions, ddev-bin from the AUR works right out of the box. If there's issues with system updates, you pretty much always find the answers in the official announcements. Also the Manjaro forums and Arch Wiki are great places to find help on pretty much anything. Also, if you're doing a lot of RAW photo editing, darktable is a great option once you get past the initial confusion. It runs ten times faster than LR and I couldn't imagine ever going back at this point. Lots of options! Good luck and and yay for FOSS! ? P.S. Attaching a screenshot with Code OSS and DDEV running on a dual head setup. Don't forget you can CSS your actual desktop environment ?1 point
-
Hey @Spinbox, thx that makes sense ? Could you please try the latest commit of the dev branch? You can now hook into RockFrontend::loadTwig1 point
-
Thank you for your reply. First of all, I'm more of a frontender, which could lead to not providing all the things you would like too. Sorry if this leads to unclear questions. Learning each day though. I'm happy to provide a PR but the problem is I'm not sure if I'm right or what I'm doing is the right 'way', or let's say I'm not that confident. What I want to achieve This is what I'm trying to achieve, by adding functions/extensions/filters to twig. <h2>{{translate('Articles','General')}}</h2> <p>{{page.article_date|format_datetime(pattern="d MMMM yyyy")}}</p> Suggestion My suggestion is to have a separate function to load twig (just like Latte is loaded right now), like mentioned in my previous post. This hook would then be able to add these extensions etc. $this->wire()->addHookAfter('RockFrontend::loadTwig', function (HookEvent $event) { /** @var \Twig_Environment $twig */ $twig = $event->return; // Adding custom Twig extensions, functions, and filters $twig->addExtension(new IntlExtension()); $twig->addFunction(new \Twig\TwigFunction('translate', function ($text, $context = "General") { return _x($text, $context, config()->urls->templates . 'language/translations.php'); })); $twig->addFilter(new \Twig\TwigFilter('html_entity_decode', 'html_entity_decode')); $twig->addFilter(new \Twig\TwigFilter('base64_encode', 'base64_encode')); $twig->addFilter(new \Twig\TwigFilter('base64_decode', 'base64_decode')); $twig->addFunction(new \Twig\TwigFunction('bd', function ($dump) { bd($dump); })); // Return the modified Twig environment $event->return = $twig; }); I'm not sure how this would work. My first thought are that I have to copy the contents of this function into a hook and then change the part where it was going to call the renderFileTwig(). That seems like it's prone to errors if the module gets updates but I could be wrong. Any pointers in how to approach this would be welcome.1 point
-
It is actually not that wild. Once you got the hang of the terminology, config file structure and basics of nix lang, it is fun setting up your machine. And in the case I had to move to a different machine quickly, all is setup exactly as I need it with copying over the config files and issueing one command.1 point
-
It looks to me that the post above was generated by ChatGPT. It begins with "In ProcessWire,..." and ends in "Keep in mind that...". I doubt that copy/pasting ChatGPT results is a good way of discussion.1 point
-
Thanks Wanze. I didn't noticed I can actually see system template and fields.1 point
-
Hi LeiHa and welcome here! Pw is also great to learn some basic PHP, so I'm sure it's the right choice for you. Back to your question. You can add any fields to the User like to other templates in ProcessWire. In fact, Users are also Pages (like everything) and have their own template called "User". In your admin-panel, go to Setup > Templates. Click on "Filters" and show the System Templates. Now you can edit the User-Template and add your custom fields. In your frontend, you output them the same way as other fields. For the current user and the email-field, this would be: echo $user->email;1 point