enricob
Members-
Posts
23 -
Joined
-
Last visited
Everything posted by enricob
-
Files are compiled twice / Translatable strings are not translated
enricob replied to Zeka's topic in Getting Started
Hi, I confirm there is an issue with strings not translated in files included using relative path (I am using Processwire 3.0.62): the strings are not translated in frontend even if I have inserted the translations in the backend. I solved it using absolute path to include the files, so instead of using: include './views/_home.php'; I used: include $config->paths->templates . 'views/_home.php'; -
Very impressive @nickie, could you please share which is the site with more than 2 milions of pages?
-
How can I get the user profile language?
enricob replied to enricob's topic in Multi-Language Support
Thanks Soma, you're a genius!!! You're solution does not only work perfectly but it's also elegant and clean -
How can I get the user profile language?
enricob replied to enricob's topic in Multi-Language Support
Thanks Soma, that's what I though... But if you check the value of the language field of the current user object while he's viewing the site (not by querying the $user object, but for example looking at the database) you'll see that the value never change when the user change the navigation language, while $user->language value does. So, if $user->language give me the current navigation language (that changes at runtime) how do I get the language value of the current user though the api? -
How can I get the user profile language?
enricob replied to enricob's topic in Multi-Language Support
Maybe I am not explained myself clearly but the fact is that the variable $user->language->name changes, reflecting the language I switched to on the frontend. But when I look at the profile of the same user on the admin panel the language has not changed...Even if I look directly at the database I see that the language field of the page user (for the user I am viewing the site with) stays the same, even if I am switching the language on the frontend. I think the point here is that Processwire automatically populate the variable $user->language with the currently active language, in some way overriding the actual language associated with that user. In fact if I do the same query to get an user (but not the user I am logged in), the value of $userObject->language is exactly what I expect. -
Hi all, I know I can get the current user navigation language using this query: $currentUser = $pages->get("template=user, id=".$user->id); $currentUserLanguage = $currentUser->language->name; or directly: $currentUserLanguage = $user->language->name; Now, if I am viewing the site with this user and change navigation language using the language switcher the value of $userLanguage changes accordingly. However, the REAL user language as seen in the user profile on the admin panel doesn't change. So, my question is: how can I get the user profile language as set in the user profile? Thank you!
-
Great solution Adrian, thank you very much!!! Didn't know about the existence of FieldtypeTemplates... The support in this community is unbeatable!
-
Hi all, I am trying to create a page field type that let the user choose a field among the list of the all the fields (to clarify: the list of fields under Setup > Fields), but I cannot make it work. I tried this: I created the field, I set the type to "Page", I went to Input tab and changed the attribute "Parent of selectable page (s)" : here I select "Home > Admin > Setup > Fields". The problem is if I go to the page the new field is there but the dropdown is empty, there are not values in it. Why? Is it because core pages like templates or fields are hidden by default? Any help is appreciated. Thank you!
-
Hi all, this is a site we have just released, the first we have done using ProcessWire: http://www.ht-heizelemente.de Here's the modules that we used: - AIOM: very useful to minify and concatenate script and css - Alternative Grid Images: good to have image gallery with custom image dimensions - MarkupSitemapXml: simple but effective module that outputs a sitemap.xml As you can see, we didn't use a lot of modules simply because PW is so powerful we didn't have the need to use many of them... I have to say I am very happy with this cms, thanks to ryan and other developers (and the community too) for this great product!
- 1 reply
-
- 4
-
Hi, first I have to say I really like this module, thanks blad! The only minor complaint I have is: when I resize the images to be quite small (200px or less) the longer image names go on two lines so the boxes that contain these images become higher than others, and this breaks the grid layout... Looking at the html code, one way to solve the problem could be to set a fixed height to the header of the boxes (InputfieldItemHeader class), so for now i simply added this code to the module css and now it works: ul.InputfieldFileList li .InputfieldFileInfo { height:80px; } Obviously it's not a perfect solution since I will lose this modification on module update... Maybe if this is useful to others the modification could be done on the original module code
-
Hi all, I use Wappalizer extension a lot and many times I found a new cms or a tool just because I saw the icon on the browser bar. I think that having Processwire on Wappalizer could help in gaining it popularity (of course, mostly among developers or technicians). Like some of you said is not so easy to identify if a site is using PW, one can certainly hide the fact that is using it, anyway I think most of the sites that use PW has the metatag "generator" so this could be a good way to identify PW on a site. I think using the generator metatag should be considered a good practice, at least without indicating the version for security reason...obviously anyone should be free to remove it. What do you guys think? If we had to add PW to Wappalizer here's the link: https://wappalyzer.com/suggestions (I think this should be done by an expert since you have to specify the criteria for identify PW, and I only know about the generator metatag)
-
Insert a paragraph inside a form built using API
enricob replied to enricob's topic in API & Templates
Thank you adrian!!! I did take a look at /wire/modules but I was expecting something like InputFieldHtml or InputFieldParagraph or something like that Anyway I am too interested in what LostKobrakai asked...How can I exclude a field from being included in the wrapper element? Or can I at least customize the class of the wrapper element for a specific field? -
Hi all, I am building a page that contains a quite complex request form. To do this, I created a page based on a "contact-form" template, and inside this template I put all the code needed to display the form and manage the results. The form is built using PW API, the code is inspired from some examples I found here on the forum. My problem is that I don't know how to insert a text paragraph between the fields, anyone has idea on how to do this? Here's a very simplified version of my code (only two fields displayed), in this case I would like to append a custom paragraph (simple html) between Company and Name fields. The only solution I found is to use an additional field of Fieldset type, without content, and on the label I set the text I need to output. However in the label field I am not able to insert html tags... Any help is very appreciated... Thank you! // create a text input $field = $modules->get("InputfieldText"); $field->label = "Company"; $field->attr('id+name','company'); $field->required = 1; $form_fields[] = $field; // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form_fields[] = $field; // submit button $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Send"); $submit->attr("id+name","submit2"); $submit->skipLabel = '4'; // create the form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'contact-form'); foreach ($form_fields as $field) { $form->append($field); } $form->append($submit); // append the form in $out variable $out .= $form->render();
-
@argos I know the fact that "everything is a page" can be weird at the beginning (it takes me a few hours of experimenting to get confortable with this concept ), but I can confirm for my experience that this is really a great solution, both from a developer and and from a customer point of view, better than any other cms I tried (and I tried many, Wordpress, Joomla, Drupal, ...) I started to love the idea when I was starting to solve some problems in PW, and I always ended up (even after a lot of time thinking) saying "well I just have to use pages!". Just to give some examples: Problem: put some settings on a site level that can be manageable from the customer, ie a common footer text, a common image banner, and so on. Solution: You just have to create a new Settings template, put some fields in it, create a page with this template, fill in the fields and you're done! Problem: Create a categories system Solution: You create a category template, with the field you need (title, image, ...), you create some pages that uses these template, then, to link a category to a page, you only have to define a Page type field for the template that this page uses, fill in the value, and you're done! In both cases (in fact almost all other cases) from the template files (php) you can get the field values very easily using the api. The fact is: once you understand the "page" concept, you can solve almost any problem you can think of, and even very quickly.
-
A different way of using templates / delegate approach
enricob replied to Soma's topic in API & Templates
Thank you @Soma, in fact I have still a lot to learn about PW! You're right your solution would work, I haven't thought about it... Anyway, even if I like the idea of having a single main.php template file, I have to say that I too have come to the conclusion that ryan's approach feels better, it's just more "ProcessWire" style (and there's good reason for this! ) -
Ok guys you convinced me that a module like this it's not worth the effort, maybe the good side of PW is indeed the fact that you have to actually write some code Thank you for your answers!
-
A different way of using templates / delegate approach
enricob replied to Soma's topic in API & Templates
Thank you horst for your answer, I know it's not a big work to edit the alternate name for each template, it's just a little bit "unnatural", and I prefer to keep things simple when it is possible, it's just my personal preferences. It would have been great to have a simple solution for having a default "main.php" file but I think as you said this is not possible... Anyway it's really not a big deal, the fact is that in the last days I am experimenting with PW and I think I am only trying hard to push it to its limits -
A different way of using templates / delegate approach
enricob replied to Soma's topic in API & Templates
Hi, I found this topic very interesting, in particular I like the idea of the delegate approach (having only on main.php file and a subfolder with the template files). However there's one thing I don't like about it, it's the fact that everytime I create a new template I have to give it an alternative name "main". This is not big problem in my projects but if for example I want to share this approach with a colleague, which has never used PW, and I tell him "Hey everytime you create a new template remember to give it the alternate name" I'm sure he would say "But.. why do I have to do it everytime? Isn't there a way to do it automatically?" So, my question is: do you think there is a way to tell PW that if there isn't a template file for a certain page, it have to call a default template file (for example the above mentioned main.php)? -
Hi, I was reading a very interesting post in this forum (https://processwire.com/talk/topic/7166-wp-tavern-article-and-processwire-themes/page-4), about PW and its popularity compared to other cms like Wordpress. The key point that has been discussing is: how can PW be more attractive to non developers (ie designers)? (ok here another question arises "Do we want that PW reach an audience bigger that developers only?" but this is another topic...) Wordpress for example has a theming system that certainly is very attractive and quite easy to use, and I noticed someone in the community is already working on a module that could do some steps in that direction. That could be great but there's another thing that in my opinion could help very much: an automatic template file generator. Let me explain... I think that one of the things that scares a person which is not a developer the first time he uses PW, is the fact that after creating some fields and a template that contains these fields from the administration panel, he has to create a new empty file named as the template and put it inside the templates folder. Obviously from a developer point of view this is not a big problem, I go searching the docs and try to find what to put in this file, but from the point of view of a person that has no the developer mental scheme that thing could be scary at the beginning, and I imagine that if this person is trying out a lot of cms to find out which is better for him, he could easily think "ah dawn this is too complicated for me!". Ok, so what if I can, after creating a template, press a button and let the system create the template files for me? This could be great! I can now go to PW tree page, add a page with the template I created before and when I navigate the site I have already a page that is working, and it also outputs the fields that I filled! Then, I go editing the template file that has been created automatically and change the html as I prefer, but I don't have to bother about php code at all... The next step is thinking about a small wizard that create the file when I press the generator button: for example I have to choose if I am creating a simple detail template or a list template. In case of the list maybe we need the user to enter some filter parameters to generate the array list (template type, parent, etc.) and so on... So, this is not a trivial task but maybe not even impossible. In the future you can also think about a way to make this module useful even for developers, for example creating some template for outputting the html of the template files.... But maybe I am going too far So basically I think it could be very interesting to create a module that adds this functionality to PW... What do you think?
-
How to manage template files inside a module
enricob replied to enricob's topic in Module/Plugin Development
Thank you @adrian I will take a look at Field migration and Migrator, it seems interesting stuff! @kongondo: you're approach of having a main .php file and other related files under a subfolder is a good one, it can be good to group together templates files that have similar functions, thank you very much! -
How to manage template files inside a module
enricob replied to enricob's topic in Module/Plugin Development
Thanks all for the answers! @nico: I didn't kwnow about this module, it seems great! I think it can be very very useful. @kongondo: I know I can use subfolders, and I am already using the files in "templates" root as a sort of controllers and the files under "views" as...well, views But still, if I am not missing something here, you need to have a file named as the template, in the "templates" folder, so here I am starting to have a lot of files. For now I am prefixing the template names with a word indentifying the use of the template (for example "event_detail" or "event_list"), this way it seems to me more organized. Anyway this is one of the very few (and really, not so important) complaint I have with PW, which by the way it's really a great tool! -
Hi all, I am quite new to PW, and I am starting to create my first modules. In a site I am working on, I have already created some templates, fields and pages to manage a simple event management, with event list page, event detail page, list of categories, and so on. Now I would like to put all this inside a module, so when I start a new site all I have to do is install the module and I am ready to work with the events. I already understood how to create the module and do the installation (and uninstallation of course) of templates, fields and pages, but now I am wondering what's the best way to manage the template files (.php) that the module pages will use. I noticed others have chosen to copy the needed templates files inside the "site/templates" directory during the installation of the module... Do you think this is the best approach? Are there any alternatives? I am not fully convinced since this way I am adding new files to "site/templates" folder and since this folder could already contain a lot of files the situation could become a litte messy (since I have a mix of files I created and files that a module created). If this is the right way to do it, I am wondering if in PW there is a way to use subfolders inside the "site/templates" folder, I am thinking for example to have a subfolder named as the module name, so all templates .php files related to that module could stay here, in a more organized way. Thank you for a feedback on this! enrico
-
Hi to all, I am not really sure if I have to write in english or italian since I have a question for italian developers but I have chosen english so everyone can understand. I am quite new to PW and I think it's really a great tool! I have fought for years with Joomla, Wordpress, and many others cms and I am quite sure this time I am starting to see the light As far as I can, I would like to help in making the project more popular, especially in Italy, where I don't see very much interest yet (sadly, we are always late when it comes to new and interesting technologies). Can I do anything to help with the italian site? I saw that the api translation was in the to todo list, but I cannot find it in the italian site... Maybe I can help with this? Please let me know!