Sten
Members-
Posts
62 -
Joined
-
Last visited
Everything posted by Sten
-
Sorry I can't find any submit button to save my configuration on a template in the admin interface. The file is fine.
-
Hi, I change my server with the same debian version, moving my site to it. I have now a Undefined variable: view in the site. Thank you. You could save me some time. RESOLVED
-
Hi Regesh, Do you have the latest version of ProcessWire ? Did you try to install a previous version ?
-
Hell, Although I use a config on an other of my sites that works well. An error 500 is driving me nuts. Coul someone have a look on my config server { listen 80; server_name attente.xyz; rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443 ssl; server_name attente.xyz; ssl_certificate /etc/letsencrypt/live/krouus.company/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/krouus.company/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Activer le ciphers et mettre ceux autorisés (je vous laisse faire de plus amples recherches pour ça ;) ) ssl_prefer_server_ciphers on; ssl_ciphers 'DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-CAMELLIA256-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-CAMELLIA128-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256'; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; # La fameuse clé générée en dernier ssl_dhparam /etc/nginx/dhparam.pem; # Ajout d'une règle http add_header Strict-Transport-Security "max-age=31536000;"; root /var/www/attente.xyz/html; index index.php index.html index.htm; location / { # try_files $uri $uri/ /index.php?it=$uri&$args; try_files $uri /index.php$is_args$args; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffers 4 256k; fastcgi_buffer_size 128k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } location ~ \.php$ { #try_files $uri =404; include snippets/fastcgi-php.conf; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # .htaccess 10. fastcgi_param HTTP_MOD_REWRITE On; fastcgi_param X-Real-IP $remote_addr; fastcgi_param X-Forwarded-For $remote_addr; fastcgi_param Host $host; } location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf|svg|ttf|eot|woff|less|pdf)$ { #expires max; log_not_found off; ## No need to bleed constant updates. Send the all shebang in one ## fell swoop. tcp_nodelay off; ## Set the OS file cache. open_file_cache max=1000 inactive=120s; open_file_cache_valid 45s; open_file_cache_min_uses 2; open_file_cache_errors off; valid_referers attente.xyz; ##ajout ProcessWire expires 24h; #log_not_found off; access_log off; try_files $uri /index.php?it=$uri&$args; } # .htaccess 8.1 charset utf-8; # .htaccess 3. location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } # .htaccess 4. # add_header X-Frame-Options SAMEORIGIN always; # Set by ProcessWire core add_header X-XSS-Protection "1; mode=block"; # add_header X-Content-Type-Options "nosniff"; # ----------------------------------------------------------------------------------------------- # .htaccess 5. # ----------------------------------------------------------------------------------------------- # Block access to ProcessWire system files location ~ \.(inc|info|info\.json|module|sh|sql)$ { deny all; } # Block access to composer files location ~ composer\.(json|lock)$ { deny all; } # Block access to any file or directory that begins with a period (except well-known) location ~ (^|/)\.(?!well-known)|^\..*$ { deny all; } # ----------------------------------------------------------------------------------------------- # .htaccess 15. # ----------------------------------------------------------------------------------------------- # Block access to protected assets directories location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) { deny all; } # Block acceess to the /site/install/ directory location ~ ^/(site|site-[^/]+)/install($|/.*$) { deny all; } # Block dirs in /site/assets/ dirs that start with a hyphen location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* { deny all; } # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ { deny all; } # Block access to any PHP-based files in /templates-admin/ location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP or markup files in /site/templates/ location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP files in /site/assets/ location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ { deny all; } # Block access to any PHP files in core or core module directories location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any PHP files in /site/modules/ location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any software identifying txt files location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ { deny all; } # Block all http access to the default/uninstalled site-default directory location ~ ^/site-default/ { deny all; } } Thank you for any hunch.
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
Sten replied to kongondo's topic in Modules/Plugins
Thank you very Much BitPoet for your help, I was able to solve adding check_access=0 in my selector. Great! -
Module Module: RuntimeMarkup Fieldtype & Inputfield
Sten replied to kongondo's topic in Modules/Plugins
What I don't understand is that the field is displayed anyway with the right data (each language has a number) but displaying the b tag. -
Module Module: RuntimeMarkup Fieldtype & Inputfield
Sten replied to kongondo's topic in Modules/Plugins
Hi BitPoet, Here is my code $texte=""; $leslangues=array(1=>"fr", 2=>"de",3=>"en",4=>"es",5=>"he",6=>"it",7=>"pt",8=>"ru"); foreach ($leslangues as $langue => $langue_str){ $element = $pages->find("template=clef, langue=$langue, limit=1, sort=-id")->first()->title; $nombre=(int) filter_var($element, FILTER_SANITIZE_NUMBER_INT); if (!$nombre){ $nombre=1; } $texte.="<b>$langue_str</b> : $nombre, "; unset($nombre); } $texte=rtrim(rtrim($texte),","); return $texte; Thank you for your help. -
Module Module: RuntimeMarkup Fieldtype & Inputfield
Sten replied to kongondo's topic in Modules/Plugins
On the module FieldtypeRuntimeMarkup I have error according to roles. As superuser I don't have any error but as contributor I have trying to Get property on non-object and the html code in the field is displayed as source. The line pointed at is this one protected function renderMarkup(Page $page, Field $field) { //if code field is empty return early if(!$field->runtimeFields) return; //locally scope $pages to eval() $pages = $this->wire('pages'); ------> $str = eval($field->runtimeFields); //since we are dealing with custom PHP code but also want to make sure that only markup is returned //if eval() returns anything other than a string or an integer, we throw an error (e.g. if an object or array is returned) if (is_string($str) || is_int($str)) return $str; //we need to check if we are in admin. Otherwise with an error, in the frontend the name of the the Fieldtype is returned if we echo out the field elseif($this->wire('process')->className() == 'ProcessPageEdit') return $this->error($this->_('Only strings and integers should be returned by your custom code! $ } Thank you -
Sorry I found the solution.
-
Hello, An administrator on my last site has created a page with the template "home" by error and now this page is homepage and I can't find the real one. Could someone help me ? Thank you
-
Arjen Thank you very much for your answer. I will change my templates structure.
-
Hello, I have some difficulties to understand extends. How send variables through extends ? like here, may i send {{ page.title }} or {{langue_str}} to base.twig ? Base.twig is my main template with headers, footers... that extends each page. {% extends 'base.twig' %} {% block content %} <div id="titres"> <div id="titre">{{ page.title }} {{ lang }}</div> </div> <div class="hr"></div> <br> {{ include('engagement.twig') }} {{ include('lettre.twig') }} {{ intro_derniers_textes }}<br /><ul> {% for texte in derniers_textes %} <li><a href="{{ texte.url }}{{langue_str}}/">{{ texte.title }}</a></li> {% endfor %} </ul> {% endblock %} Thank you
-
Hi, I solved my problem, it was a regex problem in the template.
-
Hi, I allowed urlSegments in my config and for the template I use in this case. My page doesn't give data outside title and name. This is my template : GNU nano 2.7.4 File: liste.php <?php namespace ProcessWire; if (preg_match('/^[a-z]{2}$/',$input->urlSegment1)){ $langue=array_search($input->urlSegment1, $toutesleslangues); $elements = $pages->find("template=enseignement, langue=$langue, sort=-id"); } elseif(in_array($input->urlSegment1,$cats_slug) AND preg_match('/^[a-z]{2}$/',$input->urlSegment2)){ $langue=array_search($input->urlSegment2, $toutesleslangues); $categorie=array_search($input->urlSegment1, $cats_slug); $elements = $pages->find("template=enseignement, cat=$categorie, langue=$langue, sort=-id"); } else { // throw a 404 throw new Wire404Exception(); } $langue_str=$toutesleslangues[$langue]; include_once "../langues/".$langue_str.".php"; $cat=${"cats_".$langue_str}[$page->cat]; $view->set("posts",$elements); ?> I use twig. My page works with one urlSegment works but not with two. With two, it is a 404 page. I tested every value. I don't see what goes bad. This page displays a list of urls. Thank you for any help.
-
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@Robin S. Great I'll look at it soon. Thank you Robin, I would not have done anything without your help. -
@dragan Than you I'll look at Tracy Debugger, I did not know it. @bernhard I'll have a look in your post and keep you informed, thank you.
- 6 replies
-
- documentation
- tutorial
-
(and 2 more)
Tagged with:
-
Hello, I'd like to participate to a documentation about the page flow in PW. I am still a beginner and still have difficulties to see the big picture but I could help to the writing. What is the flow when a page is displayed or created ? It would be fine to draw a scheme with every stage in which one can add hooks. Something to describe the flow in time. May be it exists. page | fields | template What do you think ?
- 6 replies
-
- documentation
- tutorial
-
(and 2 more)
Tagged with:
-
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@Robin S Yes good idea. OK I understand why it is better haver easySlugger inside the module. Besides I have written to Javier Eguiluz to inform him about our work. -
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@netcarver Yes sure, this is the aim with help of @Robin S -
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@Robin S thank you, I tested your module, it works very well with Hebrew. I only put the Javier Reguiluz' app inside the vendor directory to be able to update it with composer. I'll test it more and tell you. Yes I saw it too. I am grateful for your work. -
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
Hello, I began by creating a simple module to slugify the page name. <?php include $_SERVER['DOCUMENT_ROOT']."/vendor/javiereguiluz/easyslugger/src/SluggerInterface.php"; include $_SERVER['DOCUMENT_ROOT']."/vendor/javiereguiluz/easyslugger/src/Utf8Slugger.php"; use EasySlugger\Utf8Slugger; class SlugifyExplicit extends WireData implements Module { public function init() { $this->addHookAfter("Pages::added", $this, "slugifyExplicit"); } public function ___slugifyExplicit($event) { $pages = $event->object; $page = $event->arguments(0); $page->name= Utf8Slugger::slugify($page->title); $event->return = $page; } } The name is OK but is is not saved in database. Someone has an idea ? -
Thank you Rick, your tip helped me much. I used $page->cat->id; Now it works ?
-
Thank you Dragan, I do that then i want to transform data to display in my template : $view->set('categorie',${"cats_".$lang}[$page->cat]); Here I have an array for each language. $page->cat displays an integer, I tested it. If I replace $page->cat with an integer to test, it works but with the expression as a key, it does not work.