Jump to content

spoetnik

Members
  • Content Count

    64
  • Joined

  • Last visited

Everything posted by spoetnik

  1. 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?
  2. Any Nginx guru out there that can translate those enhancements to a nginx-config?
  3. 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.
  4. 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?
  5. 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?
  6. 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'
  7. 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:
  8. 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?
  9. 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...
  10. 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?
  11. 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?
  12. How would you handle this: A site with private groups. Only members of these groups can see the content posted in these private groups.
  13. 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?
  14. 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.
  15. 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.
  16. 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!
  17. spoetnik

    vs Drupal 8

    D8 has Twig as the template-engine, which is a big plus over the old phptemplate engine. The default html-output will suffer less from div-itus and useless classes. D8 is OO programmed, and uses the Symfony framework for some of its functions. D8 looks to become a bit more complicated to program for than the previous versions. D8 Some good modules a in core now (Views, Configuration management...) Expect D8 version 1 in the first quart of 2015. Don expect to many contrib modules in the first 6 months after this release.
  18. Thanks, I think that I will go for option 1: A new install for each client. There will be no custom instances, so a deployment on based on a Git Pull will work nice. Second question. How would you handle agile development? Not all development takes place in File. Field are created, and added to templates. All in Database. How would I deploy new features to running installs, and not destroy the data in the database?
  19. A "Batch" function, or "background" function would be nice given the following use-case. Process the files from an upload field, and index the processed values in your indexing server. There is no need for the webuser to waith for this processing, it could perfectly happen in the background using shell_exec
  20. I am building a SAAS solution based on Processwire. For example it's an intranet hosted on the internet (just for example) I have the following deployment strategies: 1 Processwire install per client. With separate Databases, Assets folder, and maybe ElasticSearch instances in the future. 1 Processwire install for all clients. A reference field on all templates to a "Client" field, so I can relate content to a client. Set the clientID in the $session for all loged-in users, so I can check their permissions. I am considering the first option for the following reasons: All results from a search action are for the correct Client. Strong separation of confidential content Arguments for the second option would be: Maintenance is much easierAny insights, tips??
  21. Thanks both for the quick answer!
  22. I give up. I can't find out why this isn't working: // display sidebar navigation, except on homepage, projects, posts, and partners pages if($page->template->name === 'home'|'project'|'projects'|'posts'|'partners'){ echo "no sidebar"; }else{ echo "sidebar"; } Can someone help?
  23. Hey Ryan, Thanks for your help. The problem is that I want the default language to be determined by the domain. This part works great. I have added the language-determination code via a common include. There is one catch: i want a language selector so the visitor can overrule the determined language. I was thinking to store this overridden language in a session. So, if there is no chosen language (in the users session), use the language determined by the domain. If a user has chosen an other language via the language selector, this must overrule the language determined by the domain. I hope this is clear? I think i need to adjust this snippet to store the choice in the users session, but I don't know how. <?php echo "<ul class=\"languageselector\">"; foreach($languages as $language) { if(!$page->viewable($language)) continue; // check if page not published for this language $class = "$language" == "$user->language" ? "active" : ""; $url = $page->localUrl($language); echo "<li class=\"$language->title hide-text \"><a href='$url'>$language->title</a></li>"; } echo "</ul>"; ?>
  24. I am developing a multilingual website. This website has 3 languages, and two domain. Languages: English (default), Dutch, and Chinese. It has a .com domain, and a .nl domain. The idea is to serve the default language (English) on the .com-domain Serve the Dutch language in the .nl domain. Have a language switcher to switch to the preferred language on any domain. For the default by domain switching I have included this snippet on the homepage: // grab the topleveldomain, i.e. "com", "nl", "ch", etc. (wont work for .co.uk... sorry) $domain = rtrim($config->httpHost, '.'); $languageName = end(explode('.', $domain)); // sanitize it just for good measure $languageName = $sanitizer->pageName($languageName); $language = null; // attempt to find a language with the same name if($languageName) $language = $languages->get($languageName); // if no language matches, then we'll assume 'default' language. if(!$language || !$language->id) $language = $languages->get('default'); // set the language to the user $user->language = $language; For the language switcher I have included this snippet on every page of the site: echo "<ul class=\"languageselector\">"; foreach($languages as $language) { if(!$page->viewable($language)) continue; // check if page not published for this language $class = "$language" == "$user->language" ? "active" : ""; $url = $page->localUrl($language); echo "<li class=\"$language->title hide-text \"><a href='$url'>$language->title</a></li>"; } echo "</ul>"; Everything works fine, except for the homepage! The language switcher doesn't work on the homepage, because of the snippet loading the default language, and thus overruling the language switcher.. I would like to set the default language on the initial load of the site. Set the initial language in the session or something, and the let the language switcher overrule this setting. Any suggestions??
  25. Thanks! The first request I did was to http://mywebsite.com/sitemap.xml and that redirects to http://mywebsite.com/en/sitemap.xml/ "/en/" is the site's default language.
×
×
  • Create New...