Jump to content

virtualgadjo

Members
  • Posts

    336
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by virtualgadjo

  1. hi, can't agree more, so many ways..s and it's exactly why processwire is so special, it offers you a lot of ways to do things, including when it exists a simple php piece of code i must admit i often go for pure php when possible and not to verbose and thank you so much pw for letting me do so... well and for so many other things like custom page classes, hooks, i have to stop here else the list will be far too long 🀣 have a nice day
  2. Hi @ai_slop if you knew how much i agree with this, of course my very first website with pw was made with my usual includes of header and footer php files but as soon as i decided to try and understand the various output strategies and tried the markup regions it was a no return back path πŸ˜€ what you describe about your homepage is somthing i often run into too, my solution varies from the things i need for the hom page, sometimes i can even be e script tag with various things far easier to deal with in the template and that would be a bit too much in the website general js file in this case i use the trick i spoke about, my script tag surrounded by a simple if page id is 1 but when i'm a little less lazy i sometimes even use something pw allows me to do, when i need ereally specific heavy css for example based on some pages parent, ids or even a variable value, i add the type i need to the config, i.e $config->contentTypes = array_merge($config->contentTypes, array( 'css' => 'text/css' ) ); this way you'll have a new header type added to the Content-type combo box choice in the template and a php file with a css type header but having access to pw api, this allows you some pretty acrobatic things πŸ™‚ but well, to be honest, i more often use the old php if to load some files or even output script tags keeping in mind that the _main.php file is appended at the end of the template files, you can also submit content, script, files and so on output or not, relying on a var you define in the template itself, actually, the kind of things you could do even in a not pw structure but taking advantage of pw api have a nice day
  3. Hi, as i stongly agree with @monollonom about this checkbox to use a different, say frame, than the usual _main and the fact that in general you don't need a specific config, there are ready, init and so on for this i'd like to add a few things change your _main frame would useful for rss feed, sitemap; well xml files πŸ™‚ but also for modals for example (and sometimes for dynamic css or js files) as you often need a lighter when not totally different html head and quite often too far less js files to the bottom of the file but not at all for the home page if you have a closer look to what this _main file allows with marlup regions you'll see that it goes far above a main div with an id you can use in every template with totally (or not) diffeerent html content and around, above and below, div (or else) you will have (or not) on every template/page even before diving deep into the markup regions world, first thing first, as this _main.php file is a php one let's take a simple example, the homepage quite often you have a section name hero (i still don't know why...) with a big image, carrousel, or any gsap animated witchcraft πŸ™‚ and on top of this other page a simpler and horter image with or not a title sometimes a breadcrumbs... well, before that main div/section you will (or not) use everuwhere, why not simply use php... if page id is 1 (or template == home) hop, your big whatever it is and else what you need in the other page of course, is there are some pages, say, in your case your futur shop, for which you need a different head part, well you see where i'm going... and you may have noticed i quite often said "or not", this is processwire way of life πŸ™‚, nothing is compulsory it is all about your logic, its own logic is just here to help you do things faster than if you had to write every single thing by yourself but you can think exactly the same way as if you did and now if you dive a little deeper into markup regions, its optional attributes, you'll see how powerful it is have a nice day (and a great pw journey :))
  4. hi @lpa actually the save ready event is a "funny" one, it happens when you're saving the page but before the saving if done, this way what you launch is in a way prepared and done juste before the cms really saves the page it's an event i really like as instead of field events that may charge the server each time you change your mind about a field value/content, this one happens when you're done and... ready to save the page and, of cours, you see the result as soon as the page is saved but, of course, we're speaking pw here and you have a lot of events to choose from, have a look at the hookable event of a field https://processwire.com/api/ref/process-field/ the important thing being always to be careful with the cms and server charge πŸ™‚ have a nice day
  5. hi, that sounds like a good call for a three steps hook on page save ready step one, get the value (id) of the refpage step two $pages->clone(the id) and then get the id of the page newly created setp three yourreferencefield->set() of course, this will be easy with a single page reference field for a multiple pages one, a foreach will be necessary and for step three i must admit that having played a lot with ref field i would probably go for an sql query to update your ref field table (field_fieldname) and set data = new page id where data = former page id hope it may help πŸ™‚ have a nice day
  6. hi totally agree width @Krlos i continue to get some pro module renewed even if i don't use them a lot for some of them, giving back being the least i can do and i may add something, the first time i see something i need to understand in the docs, module, pro module, api and so on, hop, singlefile and i save the page, this way i can use it offline but well, maybe it's because of my advanced age 🀣 have a nice day
  7. @taotoo avec grand plaisir πŸ™‚
  8. Hi, well lets'assume that if your first piece of html generates a slider/markup or whatever you'd like to name it you probably have some css and js to do so if the second snippet which generate the same kind of html but with the images enclosed inside a tags, the problem could be your js settings that assume the slider elements are images and not the a tags, something with an unwanted !important in the css breaking the slider css grid, flex or even the evil floats πŸ˜€ etc etc honestly hard to say further without knowing what generates the sliding behaviour as there are so many libraries like the ones @Jan Romero quotes above without speaking of all the custom things you can make with gsap... have a nice day
  9. Hi, I'm not sure it's very useful if you're neither French nor seriously obsessive, but just in case... In French, when using a CKEditor or TinyMCE field, it is easy to insert a non-breaking space before exclamation marks, question marks, colons, semicolons, and so on, so that they do not wrap to the next line on their own, at the end of a sentence or in the middle of one. This is not possible in simple text fields, single-line fields, or non-rich-text textarea fields and this often causes formatting issues that are not very β€˜attractive’, especially in responsive usage, remember, i said obsessive πŸ˜‚. So I created for myself a small textformatter module that allows you (well pw for you actually) to insert a non-breaking space before or after certain specific characters in a text or textarea field. It's completely useless and should not be used in a rich-text field, but if it's ever useful to anyone, it's available on GitHub at this address. https://github.com/virtualgadjo/Processwire-module-espaces-insecables-dans-champs-text have a nice day
  10. Hi all, i've just ran into a funny issue, playing with pagination, htmx and that kind of thing in many different situations, i've a page containing a repeater called "zirepeater" it will be easier to explain with those few lines // $zirep = $pages->find("template=repeater_zirepeater, start=$start, limit=$limit"); // $zirep = $pages->find('template=repeater_zirepeater'); // $zirep = $pages->find('parent=1066'); $zirep = $page->zirepeater->find("start=$start, limit=$limit"); // and below in the template print_r($zirep); with the first three lines, firefox print_r a nice result in which i can read [template] => repeater_zirepeater so i assume my query is not that dumb πŸ™‚ but in chrome, brave or edge i get --- ProcessWire\PageArray Object ( [count] => 0 [items] => Array ( ) [selectors] => template=repeater_zirepeater ) ProcessWire\PageArray Object ( [count] => 0 [total] => 0 [start] => 0 [limit] => 2 [pager] => 0 Γ  0 de 0 [items] => Array ( ) [selectors] => template=repeater_zirepeater, start=0, limit=2 ) ProcessWire\PageArray Object ( [count] => 0 [items] => Array ( ) [selectors] => parent=1066 ) --- depending on the query, funny isn't it, firefox is more pw friendly and understands pw way of dealing with repeater page when chromium don't even if they get the selectors well more a surprise than an issue as the uncommented line works with all of them but just in case it could be useful for someone playing with the same kind of things and yes i like playing with pagination and/or htmx load more with nearly everything, galleries, repeaters, children pages, external db table query results (very useful with hundreds of lines...), well, all what pw lets me play with, that's to say everything πŸ™‚ have a nice day
  11. hi all, as usual, i have added a repo with the translation in french for the last master release, just in case https://github.com/virtualgadjo/pw-30255-lang-fr have a nice day Edited to say, i've just ran into a good old spelling mistake in a field and have updated the archive
  12. Hi, sorry to be a bit late to answer this but those are two very different things when it comes to the wbr tag, it's pretty easy, in your site/modules/InputfieldCKEditor folder add a config js file which will allow you to solve both "problems", an exemple of one i have for an "old" website made with pw when it was using ckeditor 4 as its rich editor module CKEDITOR.editorConfig = function( config ) { CKEDITOR.config.fontSize_sizes = '8/.5rem;10/0.625rem;11/0.6875rem;12/0.75rem;14/0.875rem;16/1rem;18/1.125rem;20/1.25rem;22/1.375rem;24/1.5;28/1.75rem'; CKEDITOR.config.extraAllowedContent = 'section[id,class] wbr'; CKEDITOR.config.entities_additional = 'shy'; }; as you can see, i define some option for the font-size dropdown but here the thing we are interested in are the two other lines the extraAllowedContent tells cke not to delete those tags and allow section with id and class attribute and... the wbr tag (which, nomatter how you insert it will be transformed into <wbr /> but works the same way this being done, you can simply create a plugin to insert a wbr tag wherever you need when it comes to &shy; or its html equivalent &#173; its the config.entities_additional line that tells cke not to remove them, well actuelly only &shy; in my case, i don't need both... as you can see, as cke docs says no & nor ; in the list, i could have written 'shy,#173' to make it work for both entities now, the problem is... it works!!! but depending on your browser you may not see it when saving, even if you look at the field content directly in the ddb, it's not a ckeditor issue at all but just a browser behaviour easy to check saving your content/page and viewing it in the browser, using its responsive viewer tool, playing with the page width, you'll see the soft hyphen in action where you've inserted them πŸ™‚ now, like for the wbr tag, you just have to create simple plugin to insert the sofh hyphen in both case, i prefer writing my plugins using icons in the toolbar rather than just keyboard shortcuts as this way i'm sure it will work whatever os my victims are on, pc, minux, mac, it will work when i'm not sure about keys numbers, i'm sure for enter, space but ten plugins later, i'm going to run out of shortcuts πŸ˜€ as simple as this πŸ™‚ in case it helps (just tell me if you need help with this plugin thing) have a nice day Edited to add thnking it may be useful for those who keep using this good old CKEditor 4 in pw, i've added a github repo with the two plugins i'm speaking about https://github.com/virtualgadjo/pw-ckeditor4-plugins always in case it helps have a nice day
  13. @olafgleba i'm afraid you didn't missed anything, there is no sorting options for files and/or images (same king of things) except from using your mouse πŸ™‚ well something llike this in your ready.php file should do the trick (sorting happens when you save the page) $this->addHookAfter('FieldtypeFile::wakeupValue', function($event) { $field = $event->arguments('field'); // being a frenchie my field is called "fichiers" // change this to yours πŸ™‚ if($field->name !== 'fichiers') return; $pa = $event->return; $pa->sort("name"); $event->return = $pa; }); have a nice day
  14. Hi again @olafgleba i thought i was going for something "a litlle" too simple knowing what you want to do, tha answer is still yes but it's a little more technical though easy, the solution i imagine would be a simple hook, same king of trick as when you want to sort the elements of a repeater, hope i'm closer to what you're looking for πŸ™‚ have a nice day
  15. Hi, not sure i really unsderstand your question but if it actually is can you sort/reorder files in the backend, the answer is yes, catching an element in the list by the bar containing its name you can move it to the position you want in the list just in case have a nice day
  16. Hi @adrian playing a little with the module css for a friend i was wondering why i had an extra space i couldn't get rid of between the inputs and the button, found out πŸ™‚ in your module file i saw <p> <input type='text' name='username' placeholder='".($this->data['usernamePlaceholder'.$lang] ? $this->data['usernamePlaceholder'.$lang] : $this->data['usernamePlaceholder'])."'> <input type='password' name='pass' placeholder='".($this->data['passwordPlaceholder'.$lang] ? $this->data['passwordPlaceholder'.$lang] : $this->data['passwordPlaceholder'])."'> <p> <p> <button type='submit' name='login'>".($this->data['loginButtonText'.$lang] ? $this->data['loginButtonText'.$lang] : $this->data['loginButtonText'])."</button> </p>"; which generates an extra p, i changed it into <p> <input type='text' name='username' placeholder='".($this->data['usernamePlaceholder'.$lang] ? $this->data['usernamePlaceholder'.$lang] : $this->data['usernamePlaceholder'])."'> <input type='password' name='pass' placeholder='".($this->data['passwordPlaceholder'.$lang] ? $this->data['passwordPlaceholder'.$lang] : $this->data['passwordPlaceholder'])."'> </p> <p> <button type='submit' name='login'>".($this->data['loginButtonText'.$lang] ? $this->data['loginButtonText'.$lang] : $this->data['loginButtonText'])."</button> </p>"; no more extra p, maybe it was intentional, but just in case πŸ™‚ and of course thanks again for all your modules πŸ™‚ have a nice day
  17. hi again πŸ™‚ @monollonom is right the solution is to use pages, you can do this with the page reference fielfd and get this kind of thing quite easily sorry most things are in french its just in a demo website i use to help french guys with pw πŸ™‚ you can see i hav a spΓ©cial field named resume and a list of radio button coming from a page reference field allowing hidden pages, the parent page is like this as you can read in the blog page, you can use any kind of type for those page reference fields, actually it works a lot like the way i use them for blog categories and/ot tags have a nice day
  18. Hi again πŸ™‚ actually, all those fields are not available in an image field by default but become so when you associate a specific template to the given image field say for example you have an image field named myfooimg if you create a template named field-myfooimg all the fields you use in this template will be availabe for you image datas, text, list of radio/checkboxes and so on... have a nice day
  19. Hi when it comes to a "select" just install the select options module which is in pw by default and then when adding a new field you'll be able to choose when it comes to images, having a close look at the full article from which the image you show comes https://processwire.com/blog/posts/pw-3.0.142/ you'll see that it relies on a template you create witjh a given naming convention --- quote--- Rather than trying to come up with some new way of defining custom fields, you define the custom fields for your file/image field with a Template. Simply create a template having the name "field-[name]" (replacing "[name]" with the name of your file/image field), add fields to it, save, and that's it. It's okay to add fields that might duplicate those already on your regular page template, as the fields for files/images are properties of each file/image rather than properties of any page. ------- not only will you be able to use radio button but nearly any kind of fields you would like to associate to the image hope it helps a little πŸ™‚ have a nice day
  20. Hi, being french, you can imagine that most my websites are multinlingual πŸ™‚ and i alwys use this kind of language switcher foreach($languages as $language) { if( ! $page->viewable($language) ) continue; $url = $page->localUrl($language); $iso = $language->name == 'default' ? 'fr' : $language->name; // use your own default language instead of fr... if($language->id != $user->language->id) { echo '<a hreflang="' . $iso . '" href="' . $url . '" title="' . $language->title . '">' . $iso . '</a>' . "\n"; // echo '<a hreflang="' . $iso . '" href="' . $url . '" title="' . $language->title . '"><img src="/site/assets/img/' . $iso . '.svg" alt="' . $language->title . '" /></a>' . "\n"; // echo '<a hreflang="' . $iso . '" href="' . $url . '" title="' . $language->title . '">' . $language->title . '</a>' . "\n"; } else { echo '<span>' . $iso . '</span>' . "\n"; // echo '<span><img src="/site/assets/img/' . $iso . '.svg" alt="' . $language->title . '" /></span>' . "\n"; // echo '<span>' . $language->title . '</span>' . "\n"; } } and never ran into the issue you describe whether the urls are ...com/toto and ...com/en/toto or ...com/fr/toto and ...com/en/toto (in this case you have to give a name -the name you gave you default language- to the homepage, not the preferred way tu use pw but it works if necessary) the two important things are the use of $url = $page->localUrl($language); like @monollonom says and the line where $language->name is defined for the default language in case it may help πŸ™‚ have a nice day
  21. Hi @franciccio-ITALIANO form me, exactly as @BrendonKoz says, your website works perfectly and as he says too i tend to think that it's a browser cache issue i've alreaddt had the same kind of issue with an ssl certficalte not installed, the web site seen as not secured by the browser and keeping being seen so even after a correct install of the ssl a simple solution (except from testing with another browser like we've done for you :)) for your current machine and browser is to empty the borwser cache/history (you just need to erase the files and offline data, don't loose your passwords/cookies and so on if not needed) have a nice day
  22. Hi, well, all this sounds quite normal, when starting an install process, if the htaccess file is named .htaccess the web site will try to work as if it were installed which is not the case in the contrary, wuen the install process is running/finished this file needs to be renamed as .htaccess with the starting period else it won't work as the server won't find it as a genuine .htaccess file il you have a look Γ  the install.php file code, you'll see when the mutation takes place πŸ™‚ have a nice day
  23. Hi welcome back to paradise πŸ˜„ In my case, let's keep it simple. - blank profile for all sites - and generally speaking, no CSS framework. sorry, I realize that's a bit brief... let me elaborate a little, i used bootstrap a lot which once was a good selling point for agencies: β€œthe website will be responsive with bootstrap” boom, sold... i still use it sometimes, but more for tools made up of forms and tables. In that case, i use purge.js and end up with a bootstrap of about 30 kb. today, the trendy selling point would be tailwind, for me, no way!!! πŸ˜„ i love css too much (scss for me) and clean HTML without 20 utility classes per tag. In the semantic vs. utility class debate, let's say I'm 90-95% semantic and 5-10% utility (my own little scss "framework" easy to modify and override without !important everywhere). well, I'm not sure if any of this is very useful πŸ™‚ but the idea is simple: processwire offers so much freedom in coding, the least i can do is taking full advantage of it so, starting point... bare pw πŸ™‚ have a nice day
  24. Hi, well actually, as when displaying breadcrums i use <?php foreach($page->parents() as $parent): ?> i think that while looping through the parents array, something like <?php foreach($page->parents() as $pid => $parent) { $position = $pid + 1; //except if you want your position starting by 0 } ?> would do the job $pid being different from $parent->id of course hope it may help πŸ™‚ have a nice day
  25. well, if you restrain the template access it won't be proposed to add/edit a page and a user who hs obnly access to certain templates/pages don't have access at all Γ  the templates, this is a supreadmin feautre πŸ™‚ have a look when logged as a non superadmin user
Γ—
Γ—
  • Create New...