-
Posts
11,102 -
Joined
-
Last visited
-
Days Won
365
Everything posted by adrian
-
Help with frontend ajax form submission on same page
adrian replied to hellomoto's topic in General Support
Give us chance We will need some more info. Is ./inquiries/ really pointing to a PW page that has the inquiries.php template assigned to it? Is that page definitely being loaded? If that page is being loaded, what do you get when you dump $_POST? -
Issues with Page Creation - Language and Fields Not Saving
adrian replied to creativejay's topic in General Support
I am probably the wrong person to answer ML questions, since I only just started using it myself, but you mention: Remember that to get /fr/about/ etc you need to set the name for the site's homepage in French to be "fr". The /fr/ in the url is not based on anything set under Setup > Languages.- 4 replies
-
- 1
-
-
- name
- language support
-
(and 3 more)
Tagged with:
-
$newrole = new Role(); $newrole->name= $userrole; $newrole->save();
-
Well it depends - if you have the tire child/subpages already setup and they won't change, then using field pairings to ignore the title, you can exclude it from the CSV file. It really depends on whether this is a one time import or whether the client will be using it to update the site and how their csv will be structured. Anyway it sounds like you have a handle on how the module works - now it's up to you to decide the best approach.
-
Module: Testrun selectors + find() from admin (ProcessSelectorTest)
adrian replied to nik's topic in Modules/Plugins
Just an FYI, when using the console, d() is usually more useful than bd() as it will put the results at the bottom of the console panel, rather than needing to open the dumps panel to see the results. -
Thanks for sharing @fbg13 - just so you know, we already have: http://modules.processwire.com/modules/template-editor/ and there is @tpr's fork which adds module file editing as well: https://github.com/rolandtoth/ProcessTemplateEditor It might be worth trying to consolidate the two modules - I am not sure the feature set of yours vs @Nico Knoll's and @tpr's fork. I know Nico has been quiet around here of late - perhaps you or @tpr could take over with one definitive module for this?
-
Hi @Juergen - I think what you have come across is a POST size limit on the validator.nu site. You can confirm this by entering: bd(static::$pageHtml,'pageHTML', array('maxLength' => 1000000)); as the last line of this function: https://github.com/adrianbj/TracyDebugger/blob/master/TracyDebugger.module#L784 You may need the Dumps Recorder - I didn't check if the standard dumps panel retains this dump. If you then copy and paste this into: https://validator.nu/ using the "Text Field" option. You'll likely get a "bad gateway" error. If so, then that is the issue, although I am not sure what to do about it at the moment - I don't know whether they recently changed that limit (I have asked here: https://github.com/validator/validator/issues/371) - I am also seeing it here depending on the size of DOM of my page - horst's ALIF module puts it over the limit for me. As for the tracy-debug divs being shown when clicking the link, that is confusing and a little concerning as it looks like the validator is getting access to the Tracy debug bar, which is shouldn't have. Any chance you could let me know the URL of the site (PM if you want) so I can take a look at that?
-
There are still some unsolved issues when installing (or maybe it's exporting?) a module which has required or requiredby dependencies. To be honest it's been a while since I looked at this. I would like to revisit it because it has the potential to be a huge timesaver. I am also thinking of implementing this functionality (https://processwire.com/talk/topic/14117-module-settings-import-export/) into it. If I can make some time for it, I'll see what I can do about sorting out these issues and getting it published.
-
I am not sure the best thing that BCE can do here - it seems that in PHP it's not really possible to convert encoding without knowing what it is and it's impossible to determine the encoding completely reliably. This seems like the most likely candidate for a solution: http://stackoverflow.com/a/7980354/1524576 but there are still no guarantees, but maybe it's worth trying? I know Excel can be a pain and I was reading a little more here: https://help.surveygizmo.com/help/encode-an-excel-file-to-utf-8-or-utf-16 - it mentions that: But when I save an excel file to CSV on my Mac, it is automatically UTF-8, so I don't know what is going on. Maybe that article is outdated as it refers to 1999 to 2010 and I am running Excel 2011?
-
This might be worth a look: https://github.com/ryancramerdesign/ProcessWire/blob/7e8c7c6836282b6b64de81263f5aaa8112fd51ae/wire/core/Process.php#L328
-
I have to leave in a minute, but I just took a look at your site (using the login details you gave me the other day). I am not sure what the contents of a valid urlsegment would look like, but can I suggest using the template editor from Tracy (I set it up for you) to make a bd($input->urlSegment1); as well as maybe a bd('test'); inside some of your conditionals to check that they are being processed as you expect. There is a lot of logic in your publications template and it's not easy to figure out what is doing what. A little debugging should help you to figure out what is what
- 6 replies
-
- 1
-
-
- url
- urlsegment
-
(and 1 more)
Tagged with:
-
Have you read this: https://processwire.com/docs/tutorials/how-to-use-url-segments/ ? Assuming you have enabled urlsegments for the template?
- 6 replies
-
- url
- urlsegment
-
(and 1 more)
Tagged with:
-
Thanks for the access. The field pairings option is mentioned in the first post of the BCE support thread. What is probably not clear is that because different pages / templates on your site may require different field pairings, this setting is only available from the Settings tab of pages that are set to be separately configurable from the main module settings. I have done this for you and everything is now working as expected in Update mode even without a title set in the CSV file. Now for some caveats. If you try to import a CSV file that doesn't have a title column (even in update mode) that also has more rows than there are already existing child pages, then it will throw an error because each page in PW needs a name/title. But so long as you already have a child page for each tire size, you should be fine. Otherwise, make sure the CSV has the tire size as the title for each row and that will work fine. The other thing I noticed is that the CSV file you sent me was encoded UTF16 LE with BOM and it was failing to be read. I changed it to UTF8 and it was fine. Perhaps this is something that BCE could handle better, but for now, you'll want to be aware of that. I also played around with the labels to make this more specific to your client's needs, but of course you can edit further: Please let me know how you go. PS Is there any reason you've gone with the generic "Tire" title/name for each page, rather than maybe using the size code or something else unique?
-
Yeah, yeah I do use implode(), explode(), and each() a lot, but never got used to the $pages(selector) shortcut to get(), but it is definitely nice!
-
Thanks guys! So in case anyone else new to all this ML stuff is interested, this is what I ended up with which shows the title of the current user's language localized to their language and all of the other available languages with the title localized to their language. For displaying the currently selected language: $user->language->getLanguageValue($user->language, "title"); Then for showing the other languages in the switcher: foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? if($language !== $user->language) echo '<li><a hreflang="'.$language->iso.'" href="'.$page->localUrl($language).'">'.$language->getLanguageValue($language, "title").'</a></li>'; } I obviously left out the <ul> container and the <li> class details in this example, but you get the idea.
-
Thanks @BitPoet - that is much cleaner. Another question along these lines. Is it OK to re-title the "default" language as "English" ? I assume I should keep the name as "default", but I feel like it would be nice to title it properly and even localize it when the user is viewing the site in Portuguese. Is that something you guys do, or should I stick with doing this for the frontend language switcher: $langtitle = $language->name == 'default' ? 'English' : $language->getLanguageValue($language, "title");
-
I know this topic is old, but I came across the exact same issue in my first ML site. I am surprised that what @maba was looking to do is not more common or talked about. It seems like the only logical option in my opinion. Anyway, soma's solution did the trick - it's all about that getUnformatted method so that getLanguageValue has an object to work with. I did want to clarify though that it is in fact getLanguageValue rather than getLanguagevalue - note the case of the "V". It doesn't prevent it from working because methods in PHP are not case sensitive. Also can of course just use the $language object instead of the id. $language->getUnformatted('title')->getLanguageValue($language); It does seem a little unnecessarily complicated though.
-
It really depends on what you are doing. If you are adding new pages then the title field is required. Sorry, I assumed that was what you were doing. If you are updating existing pages, then you need to use the update option in BCE and the field pairings setting to match csv columns to template fields. If you do that, then you don't need the title field. Did you read about and understand the field pairings setup? PS If you're having trouble I'd be willing to take a look at the settings on your site if you're willing to give me access.
-
So the problem is that there are seven fields in the template and only six in the CSV. You need to supply the value for the title field in the CSV file as well.
-
Sorry not sure I quite follow. It is the required/global PW Title field I am referring to. Have you removed that from this template? Is "Import" an additional field in the template (in addition to the 6 fields of "text" type (from textfield_1 to textfield_6) ? Can you maybe paste in a screenshot of the list of fields from the template view page?
-
What about the Title field? Yes - text fields can display numbers just fine!
-
Hi Mario, Can you provide a list of the template's fields, including the type of each field, along with the csv you are trying to import so I can test at my end?
-
Actually the functionality of 3 and 2.8 is identical other than the fact that 3 uses namespaces. To quote Ryan: Everyone should have a thorough read through this post: https://processwire.com/blog/posts/pw-3.0.32/
-
Just crosslinking to a related topic - this one about about changing the starting page when inserting an image from another page, but there are lots of code examples and links to mini modules that I thought might be useful to help you understand what is possible.