Jump to content

spoetnik

Members
  • Posts

    76
  • Joined

  • Last visited

Everything posted by spoetnik

  1. Inspired by this reading? https://htmx.org/essays/template-fragments/#known-template-fragment-implementations
  2. What you describe @bernhard would be what i'm looking for. It would even be more ideal if I could expose a component via a HTMX-api. That way I don't have to maintain a separate htmx component. What I mean bij JSON api, is the AppApi integration with Twack I would be cool if the output could also be just html, and preferably a part of the template, or component.
  3. I am looking for good way to implement htmx, and creating some sort of API for this. The API should return 'parts' in HTML to replace parts in the DOM. These returned parts could be components. As Twack works with components, and has (JSON)API support, would Twack be the ideal base to build a HTMX frontend on? And how would i do this? Any suggestions?
  4. Thanks for you answer. Actually I don't need the count, but don't want any "Brands" without references. This is my final code: <ul class="list-inline"> <?php $brands = $pages->find('template=brand'); $brands = $brands->sort('-numReferences'); $brandCount = 0; foreach($brands as $brand): if($brandCount > 5) break; if ($brand->hasReferences) { $brandCount ++; echo "<li class='list-inline-item'><a href='/auctions/?brand=$brand->id'>$brand->title</a></li>"; } endforeach; ?> </ul>
  5. I have products referencing to brands using a page reference field. Now I want a list of brands, ordered by number of references. I found the function $page->references(), but how do I sort this? <?php $brands = $pages->find('template=brand'); $data = ''; foreach($brands as $brand) { if ($brand->references()->count()) { $data .= "<li class='list-inline-item'><a href='/auctions/?brand=$brand->id'>$brand->title</a></li>"; } } echo $data; ?> Thanks for any suggestions!
  6. I once build e recurringEvents modules myself. https://github.com/spoetnik/ProcessRecurringEvents maybe it could inspire you? recurrence are ‘fictional’ and calculated, and only made to real Processwire pages when needed.
  7. When browsing the form, the 'Shop link' in the top right, doesn't have the link to Login Register Pro module.
  8. Sorry for bumping an old topic. I have made a GitHub repo for my dev, and production setup. https://github.com/spoetnik/apache_php-fpm_mysql
  9. Tracy Injects the 'Font Awesome 4.7.0' css into the frontend. This fucks up my layout, as I am using v 5.0.13 in my frontend. Is there an easy way to prevent tracy from injecting this css?
  10. Any Nginx guru out there that can translate those enhancements to a nginx-config?
  11. Thanks @LostKobrakai. Looked into the 'Dynamic Roles' Its looks like an abandoned module from Ryan, but the up-to-date fork from @matjazp works. I saw your comment, , and that's exactly the same problem I have with this module. I would love to use this module as a base, or write a pull-request to have this functionality, but I am not skilled enough to do that. The hook into 'PageFinder::getQuery' scares me to add the selector ```saas_id=user()->saas_id``` to my Saas module.
  12. See my module: https://github.com/spoetnik/SaaS On all selected templates, a 'saas_id'-field is added, and populated. I would like to add a selector to all selectors in to filter by saas_id. I could add the selector in all my templates, but that's error-prone, so I prefer to have a hook to add it. Maybe this post could be a starting point?
  13. I am building a module, to restrict access based on a saas_id. I would like to add a selector to all page listings like: saas_id=user()->saas_id what would be a good hook to use?
  14. What would be needed to get this module to work with Processwire 3? I get the error 'FieldtypeRangeSlider: Default value should be in format [int,int]. (1,100) if range is checked'
  15. Here is my setup: My Dockerfile: # # PHP Dependencies # FROM composer:1.7 as vendor COPY web/ /app RUN composer install \ --ignore-platform-reqs \ --no-interaction \ --no-plugins \ --no-scripts \ --prefer-dist # # Frontend # FROM node:latest as frontend COPY --from=vendor /app /app WORKDIR /app/site/templates RUN npm install --global gulp-cli && \ npm --prefix /app/site/templates install gulp /app/site/templates && \ npm --prefix /app/site/templates install /app/site/templates && \ gulp build # # Application # FROM php:7.2.7-fpm-alpine COPY --from=frontend /app /var/www/html WORKDIR /var/www RUN apk add --update $PHPIZE_DEPS \ freetype-dev \ libjpeg-turbo-dev \ libpng-dev \ && docker-php-ext-install iconv pdo pdo_mysql mysqli opcache zip \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install gd \ && rm -rf /var/cache/apk/* \ && chown -R www-data:www-data . # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php RUN { \ echo 'opcache.memory_consumption=128'; \ echo 'opcache.interned_strings_buffer=8'; \ echo 'opcache.max_accelerated_files=4000'; \ echo 'opcache.revalidate_freq=2'; \ echo 'opcache.fast_shutdown=1'; \ echo 'opcache.enable_cli=1'; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini \ My dev_docker-compose.yml: version: '3' services: web: image: nginx:alpine volumes: - ./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf:delegated - ./etc/ssl:/etc/ssl:delegated - ./web:/var/www/html:delegated - ./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template:delegated - ./logs/nginx/:/var/log/nginx:cached ports: - "8000:80" - "3000:443" environment: - NGINX_HOST=${NGINX_HOST} command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" restart: always depends_on: - php - mysqldb php: build: ./ image: app:latest restart: always environment: MYSQL_HOST: ${MARIADB_HOST} MYSQL_PORT: 3306 MYSQL_DATABASE: ${MARIADB_DATABASE} MYSQL_USER: ${MARIADB_USER} MYSQL_PASSWORD: ${MARIADB_PASSWORD} volumes: - ./etc/php/php.ini:/usr/local/etc/php/conf.d/php.ini - ./web:/var/www/html:delegated - ./assets:/var/www/html/site/assets:delegated composer: image: "composer" volumes: - ./web:/app command: install --ignore-platform-reqs myadmin: image: phpmyadmin/phpmyadmin container_name: phpmyadmin ports: - "8080:80" environment: - PMA_ARBITRARY=1 - PMA_HOST=${MARIADB_HOST} restart: always depends_on: - mysqldb mysqldb: image: mariadb:${MARIADB_VERSION} container_name: ${MARIADB_HOST} restart: always env_file: - ".env" environment: - MYSQL_DATABASE=${MARIADB_DATABASE} - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} - MYSQL_USER=${MARIADB_USER} - MYSQL_PASSWORD=${MARIADB_PASSWORD} ports: - "8989:3306" volumes: - ./data/db/mysql:/var/lib/mysql:delegated my prod_docker-compose.yml version: '3' services: web: image: nginx:alpine volumes: - ./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf - ./etc/ssl:/etc/ssl - ./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template - ./logs/nginx/:/var/log/nginx - webroot-volume:/var/www/html ports: - "80:80" - "443:443" environment: - NGINX_HOST=${NGINX_HOST} command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" restart: always depends_on: - php - mysqldb php: image: app:latest restart: always environment: MYSQL_HOST: ${MARIADB_HOST} MYSQL_PORT: 3306 MYSQL_DATABASE: ${MARIADB_DATABASE} MYSQL_USER: ${MARIADB_USER} MYSQL_PASSWORD: ${MARIADB_PASSWORD} volumes: - webroot-volume:/var/www/html - ./assets:/var/www/html/site/assets mysqldb: image: mariadb:${MARIADB_VERSION} container_name: ${MARIADB_HOST} restart: always env_file: - ".env" environment: - MYSQL_DATABASE=${MARIADB_DATABASE} - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} - MYSQL_USER=${MARIADB_USER} - MYSQL_PASSWORD=${MARIADB_PASSWORD} volumes: - ./data/db/mysql:/var/lib/mysql volumes: webroot-volume:
  16. So, I have build a form, and I can call this in my template like: <?=AddPostForm/> After submitting this form, the data is passed to a function with all the input values to add the post. Where do you sanitize your data? Is that the responsibility of the form, before passing the data to the function, or do you expect the function to sanitize the data before handling it?
  17. Why?? Why not just php-fpm and nginx as a proxy? That's a more know architecture with blogs explaining the setup, and google-hits when it's not working...
  18. I am playing with the setup in a sandbox. Do I understand it right? For each private group, I create Role, and a Template. Then on the Temaplte of the Parentpage I set Role permissions, so only people in that Role (Group) can view and create Children? So Group -> Role -> Template Access?
  19. I was thinking about a page reference from the user's profile to a group-page, and restrict access by restricting all content by filtering on this reference in all selectors... Would that work?
  20. How would you handle this: A site with private groups. Only members of these groups can see the content posted in these private groups.
  21. I am using Bootstrap3 for my one page template. I would like to be able to open a link in a bootstrap modal. I can't find a CKeditor modal plugin or something. Tried using the 'ProcessWire Edit Link Process' module, and add target="_modal", so I could strreplace something, but this gets stripped by CKeditor. Any suggestions how I could open a link, created in CKeditor, in a modal?
  22. Thanks Lisandi for the recommendations. I had nginx serve the static files, but this wasn't the fastest option. Now Apache serve the static files, and ik enabled gzip, caching etc. I am familiar with cloudflare for another site I am building. That client has his customers all over the world, so a CDN release benefits. This is all Dutch, so I don't see anly real benefits of cloudflare here. I will look into the SEO module, thanks.
  23. A clean, Basic Foundation website, build using Processwire. Team Training For Professionals The client is happy with the site, and using Repeaterfields and Hannacode makes adding FAQ's piece of cake! This was am "in between" hobby project, but as always took much longer estimated.
  24. I think this is an amazing setup. It was a bit of a steep learning curve for me, it was my first experience programming MVC. I must say it works sweet, changing layouts is a breeze with the logic in the controllers. I love it and thinks this deserves way more attention!
×
×
  • Create New...