-
Posts
701 -
Joined
-
Last visited
Everything posted by Christophe
-
Do you have $config->debug = true; in /site/config.php and/or TracyDebugger installed in order to help you? What about using data-fancybox='images-single' instead of data-fancybox="images-single"? galerie is a simple image field, isn't it? Isn't the img tag missing? Shouldn't it be something more or less like: <?php foreach($page->galerie as $image) { echo "<a href='{$image->url}' title='{$image->description}' data-fancybox='images-single'>"; echo "<img src='{$thumbnail->url}' alt='{$image->description}' title='{$image->description}' />"; echo "</a>"; } ?> But you could also use $thumbnail->description. I guess you have defined $thumbnail... (NB: not sure the {} are needed in this case as there is only one -> used.)
-
By default PHP's bundled GD 2 library is used. If you're using a recent ProcessWire 3 version, ImageMagick is also supported (if you can have it installed on your server of course). Perhaps you could have better results. https://processwire.com/blog/posts/processwire-3.0.10-expands-image-resize-options/ NB: in /wire/config.php you can also see some settings, copy them to /site/config.php and modify them...
-
Hello, A more advanced user will certainly help you. But this module by @tpr perhaps already allows it: Which version of ProcessWire are you using? (Have you tried with a css rule added if the admin user is not a superuser? Or do you prefer a non-css solution - because it is not enough?)
-
Access child pages / auto redirect to parent page
Christophe replied to Manalishi's topic in Getting Started
You could hide the children/child pages and use the include=hidden selector: children("include=hidden") You could use http://modules.processwire.com/modules/batch-child-editor/ (or http://modules.processwire.com/modules/process-batcher/) to hide them quickly. If needed, you could create a checkbox field named redirect_to_the_parent_page, redirectToTheParentPage, parent_redirect, parent_page_redirect or whatever, add it to the template of the children pages, and add something like this to the bottom of the children pages template file (I have never used it but have just converted it from the code in the NB:, so I haven't tested): <?php if($page->parent_redirect) $session->redirect($page->parent()->url); // Parent redirect if the checkbox is checked ?> If needed, you could perhaps also use something like (haven't tested): <?php if($page("template=children_template")) $session->redirect($page->parent()->url); ?> <Last edit>: I guess <?php $session->redirect($page->parent()->url); ?> // I can't find the code button... would be enough if you put it in the childen pages template file. </Last edit> NB: sometimes I use <?php if($page->first_child_redirect) $session->redirect($page->child()->url); // First child redirect if the checkbox is checked ?> in a parent template file. PS: you also have http://modules.processwire.com/modules/process-jumplinks/, in case. -
Try with TinyJPG... NB: posting the images on the Forums compresses them, doesn't it? PS: I use more TinyPNG than TinyJPG.
-
Hello, You can add the Italian language pack as the "default" one, then create another English language without having to install any language pack.
-
Hello, Just to be sure, did you read this?: https://processwire.com/api/modules/multi-site-support/ Can you give more details on your installation so that you can receive better help? But perhaps the Warning message will be enough for the experts...
-
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
In fact prixAuMetreCarre doesn't have thousands, but it has floats, so I'll leave it in the code. It doesn't seem to work (changing decimals and thousands separators)... I'm trying with this in _init.php (and also in tarifs.php): $code = $pages->get(1)->localName($user->language); switch ($code) { case 'en': $number = number_format($page->superficie|$page->tarif|$page->prixAuMetreCarre, 2, '.', ','); // or $number = number_format($page->superficie|$page->tarif|$page->prixAuMetreCarre); as I want commas for thousands in English break; case 'fr': $number = number_format($page->superficie|$page->tarif|$page->prixAuMetreCarre, 2, ',', '<span style="font-size: 0.3em;"> </span>'); // I'm keeping this in case during tests but default should be enough break; default: $number = number_format($page->superficie|$page->tarif|$page->prixAuMetreCarre, 2, ',', '<span style="font-size: 0.3em;"> </span>'); } echo "$number"; In English, I see this at the top left of the page: 0.000.00 In French I see 0,000,00 I also tried, in case, adding ->children. Perhaps I should create a template file for the children (and copy or not the code there). I've tested with return, by curiosity, when the code is in _init.php, nothing, when it is in tarifs.php the table disappears. Perhaps it comes from settings in ProcessWire...(?), for these fields. I'm starting to think it's better to give up (for now). We are wasting too much time for this detail (even though it would be nicer)... I'd like to understand why setlocale didn't work for thousands. Edit: thanks anyway for your help @kixe! -
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
Thank you @kixe I have to go now, I'll look at it when I come back. Yesterday I continued a little trying to figure it out. I tried, for example, if I remember well, with things like $number($l->prixAuMetreCarre)... in the foreach directly but it didn't work and I would perhaps have had to change the way if was structured (without <?php endforeach; ?> for instance) without any garanties. _init.php already exists so I'll put it there. I need it also for superficie and tarif, so I'll see if something like this works: $number = number_format($page->superficie|$page->tarif|$page->prixAuMetreCarre, 2, '.', ''); -
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
I'm trying to replace the setlocale... parts with some number format code but all I'm having is "Server Error" messages. I'm not advanced enough in php. Edit: trying to find a solution starting from here: http://php.net/manual/fr/function.localeconv.php Edit 2: there's also http://php.net/manual/fr/function.nl-langinfo.php, and others... Edit 3: forget all this. I'll find it one day. A lot of the solutions (examples) I'm seeing assume that we assign a specific number to a variable. I have to find out how to assign any number (integer, float...) to a variable. -
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
Trying to find how to merge in the best way possible, this and this (http://php.net/manual/en/function.number-format.php) <?php $number = 1234.56; // english notation (default) $english_format_number = number_format($number); // 1,235 // French notation $nombre_format_francais = number_format($number, 2, ',', ' '); // 1 234,56 $number = 1234.5678; // english notation without thousands separator $english_format_number = number_format($number, 2, '.', ''); // 1234.57 ?> -
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
About this one @adrian: https://processwire.com/talk/profile/1601-martijn-geerts/ I was adding @Mart... when I saw both. -
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
@kixe It's all good for the decimal part, and simple to add. I've just inserted it at the top of tarifs.php, under <?php namespace ProcessWire; ?>. How can I modify this piece of code in order to also have the formatting applied - for thousands - to French (little space) and English (dot) please? @Martijn Geerts You (still) have 2 accounts apparently? Isn't it possible to merge them? Edit: the other one doesn't seem to have data... Edit 2: looking at how to change the code with the information here: http://php.net/manual/en/class.numberformatter.php Have all a nice week! Edit 3: the "formatting applied - for thousands -" should normally work with setlocale, shouldn't it? -
Float field type: a way to convert commas into dots?
Christophe replied to Christophe's topic in Multi-Language Support
Internet connection problems yesterday night... and again now. From time to time it happens, more and more... even with the "stability" option. Some reasons surely being that households now have several hardwares connected to (the) Internet (YouTube, etc.), Internet TV, illegal music and files downloads... (I'll remove the 2 lines above later.) http://php.net/manual/en/class.numberformatter.php ""12 345,67" in France and "12.345,67" in Germany." Reading this I thought, "But in France, we use both...". I'll read the page more carefully. In usage, sometimes I usually (a bit of contradiction) write 1000 for example (but I wouldn't put (or less often) 1.000 or 1 000 - or perhaps with a smaller space). But for 1000,64 I would rather write 1.000,64 (or 1 000,64 with a smaller space). For 1000000, for sure I would write it 1.000.000 or 1 000 000 (with a smaller space if possible). For 1000000,64, same... I guess it depends also (on) if you write it with a pen, a keyboard... and on other conditions/reasons (readability, etc.). Perhaps, I often can't stick to one way of doing things, or I am too "international" for some things... At the same time, I always wrote cursive letters with a pen (nice if not too quick), then one day for a job, in order to be more readable to another person I started writing sometimes the other way. From then on, it happens (quite often) that I (still) mix both... But in French I can also write it in Roman characters (small, big, or tiny)... I have to find (out) how to create a smaller space (again ?) with a keyboard. Perhaps if I select the numbers, there is a Ctrl + Alt + something for that. A bit like telephone numbers (sometimes with or without spaces, or with dots). I'm going to eat a bit... Where is the preferred place(s) to put your piece of code @kixe please? -
Page Table data on a multilingual website (frontend)?
Christophe replied to Christophe's topic in Multi-Language Support
Thanks again Adrian for your modules. Indeed. I was expecting to see this option in BCE's edit mode, but as the superuser's language was French (default) at that moment it wasn't displayed (which seems normal) and I didn't think of checking it with English. As for Admin Actions, I didn't think of going there after to see if there was an action that could do the job, even though (I think) I felt (a bit) it could be the case. Perhaps it seemed too good to be true, or after not finding it (logically) via BCE I just thought of doing it manually as quickly as possible. -
Hello, I have everything ok now here: But I'm wondering if there is a way to convert commas into dots automatically? For exemple for the field prixAuMetreCarre (float), 166,66 (French) into 166.66 (English). Is it possible via a setting in the backend or via a hook? Not especially for now, but I also have the field tarif (integer) for exemple, 115000. This format is ok as it is I think. But if, in the future, I ever need to use (something like) 115.000 (French) instead -> 115,000 (English). Is it possible via a hook or in any other way?
-
Page Table data on a multilingual website (frontend)?
Christophe replied to Christophe's topic in Multi-Language Support
Thank you so much @kixe! The solution was "right in front of me" but I wasn't seeing it. I imported the data from a csv file (before a LibreOffice Writer table that I copied/pasted in a Calc Spreadsheet) with the help of Import Pages from CSV files (first time using it also). And later used Batch Child Editor (perhaps first time also) to hide them all at once and do another operation. But the children pages are only hidden, not unpublished. If not hidden, by default with the site profile used, I have them all displayed as links, so I just hide them. And hidding them also rapidly makes them less "emphasized" in the backend. I've just had to activate the English language now manually for the 27 pages, one by one... I wonder if I still need the language-checking pieces of code already in place, but as it works I won't try it now and remove them for this project. -
Page Table data on a multilingual website (frontend)?
Christophe replied to Christophe's topic in Multi-Language Support
Thank you @kixe for your help. Which settings tab are you referring to please? Edit: if it's the one in the Tarifs page, it is already checked. I have already tried with <?php foreach($page->grilleTarifaire as $l): ?> and have just retried but when doing so there is no data for the French version/page also on the frontend. I probably have to find a way to check for the language like I "succeeded" in doing so (but after some hours and variations testing). But here it is different, I almost know nothing about the different methods to retrieve data from a Page Table (with also multilingual data), and there seems to be even less information about it than for repeaters in the forums (even less with the multilingual aspect). I had to put include=hidden in order for the data to be displayed in French as the children pages are hidden... And I've put template=grille-tarifaire in case other (children) pages, not used for the Table Page field, are added later. Edit 2: for the labels I "just" had to use $label = "label{$user->language}"; and some other pieces of code, as a possible solution. But for the fields' language-specific values I don't currently know how to "call" them. -
Page Table data on a multilingual website (frontend)?
Christophe replied to Christophe's topic in Multi-Language Support
I'm trying to find out if something in the backend is preventing it. For the Page Table field, in grilleTarifaire -> Access, View is not checked by default for guest (everyone), but checking it doesn't seem to change anything. I'm not sure what difference it makes. Also, I've just changed the superuser's language to English for testing purposes, and now in the page Tarifs, for the Page Table field, I see the label and data translated when it is text. Is it "normal", for this type of field, that there aren't tabs to switch languages in the Tarifs page? It's not really necessary but I am wondering if there's a (small) relation between this fact and the one that the English page version doesn't display the data on the frontend. I'm seeing that for the superuser role I don't have lang-edit checked. Checking it doesn't seem to change anything, so I'm unchecking it. As I'm using a Page Table field, ProcessWire 3.0.54, and @ryan's new "regular" profile for the first time (so, for the first time also, all together with multilingual functionality, otherwise I've already created multilingual websites), there could be many reasons why it's not working. There's probably a way to make it work in the frontend but I'm not good enough for the moment to find the solution right now. -
Hello, I'm using a Page Table field for the first time. With ProcessWire 3.0.54 and the new "regular" profile (first time with both also). The default language is French (title: fr) and the second language is English (name: en, title: en). English pages have /en/ added after the domain name, French pages nothing... I've eventually managed to have this added piece of code (almost) working in tarifs.php (at first a copy of basic-page.php): <div class="uk-overflow-auto" pw-append='content-body'> <table class="uk-table uk-table-hover uk-table-striped uk-table-small uk-table-middle"> <?php echo "<caption>"; $label = 'label'; if ($user->language->name != 'default') { $label = "label{$user->language}"; } // Output label in correct language echo $page->fields->grilleTarifaire->$label; echo "</caption>"; echo "<thead><tr> <th>{$fields->lot->$label}</th> <th>{$fields->superficie->$label}</th> <th>{$fields->faces->$label}</th> <th>{$fields->tarif->$label}</th> <th>{$fields->prixAuMetreCarre->$label}</th> <th>{$fields->etat->$label}</th> </tr></thead>"; ?> <tbody> <?php foreach($page->children("template=grille-tarifaire, include=hidden") as $l): ?> <tr> <td><?=$l->lot?></td> <td><?=$l->superficie?></td> <td><?=$l->faces?></td> <td><?=$l->tarif?></td> <td><?=$l->prixAuMetreCarre?></td> <td><?=$l->etat?></td> </tr> <?php endforeach; ?> </tbody> </table> </div> What is working (now) when changing the language to English: the caption changes to the English translation of the Page Table field's label, the English translations appear in the header cells (th) of the table (if there is a translation, otherwise nothing appears...) What is not working when changing to English: in French, all the data entered in the backend via the Page Table field is displayed in <td>s, but in English nothing is generated between <tbody> and </tbody>. The fields' types: 1 TextLanguage, 4 integers (2 are required, 1 has the option "Number (HTML5)"), and 1 float. I'm stuck now. So any help is welcome... Thanks in advance! NB: I have Tracy Debugger installed in case... Edit: the website is developed online for this project.
-
Shouldn't it be with quotes around pages? Be it in blog/ or talk/, it seems to always be wire("pages") or wire('pages'), wire("page") or wire('page').
-
PW 3.0.52: Optimizing 404s in ProcessWire
Christophe replied to ryan's topic in News & Announcements
Out of curiosity, are you using Apache or Nginx? And which version of PHP? Are you using MySQL or MariaDB? And which version? Edit: From which version did you update/upgrade (and how: upgrade module, directory and file replacements via FTP...)? Or is it a direct installation? Are you using it on Linux, Windows, Mac? Is it on a "localhost" or an online server? Is it via virtualization? How did you install it: direct download, git, hosting (c)panel...? Have you imported the database from another installation in a different environment? -
Another solution At http://modules.processwire.com/modules/process-page-delete/, Ryan commented: I remember this fact now. Edit: Kongondo, are we talking about the same thing?
-
Hello, If you go to "Edit", you should have a tab where the user can delete the page.
-
Page reference fields.