-
Posts
125 -
Joined
-
Last visited
Posts posted by nabo
-
-
7 hours ago, da² said:
I made a quick test, and this is strange because for me the render() method always uses default language (even if language is well managed in templates on frontend).
This code works:
$languages->setLanguage('default'); echo($pages->get(6012)->title."\n"); $languages->setLanguage('english'); echo($pages->get(6012)->title."\n"); $languages->setLanguage('default'); echo($pages->get(6012)->title."\n");
But this one doesn't, it returns default language instead of english:
$languages->setLanguage('english'); echo($pages->get(6012)->render()."\n");
I'm testing by bootstrapping PW so I also tried to force output formatting and this doesn't change, but I feel this may be related with using this code from a bootstrapped code instead of a template code (because translation works in templates).
I tested and I'm right: the last code is working in a template code but not in a bootstrapped one.
So render() method looks like to have a particular behavior (bug?) with language management when bootstrapped.Tested with PW 3.0.210.
EDIT:
To conclude the test, I added this code in a template, to see if multiple langage changes are working, and yes it is:
$languages->setLanguage('english'); echo($pages->get(6012)->render()."\n"); $languages->setLanguage('default'); echo($pages->get(6012)->render()."\n"); $languages->setLanguage('english'); echo($pages->get(6012)->render()."\n");
Thanks for spending time testing this.
Unfortunately I have to use the render inside a module and it's fired after saving a page.Don't know if this could be consider a bug @ryan?
-
8 hours ago, poljpocket said:
Two ideas, both untested:
- Could you try resetting the language between calls? More info here (Languages::setLanguage).
- Make sure this happens even if you supply the same language twice. This would assume there is a problem related to the render call and not the languages.
Tried both
1) yes, no change
2) as you suppose, the problem is not related to the language 😞 -
47 minutes ago, da² said:
Hello,
Are you sure your english language name is "en"?
What is the output of this code:
foreach (wire()->languages as $lang){ echo "$lang->name, "; }
Yes, I'm sure.
I didn't post the complete example but there's a cycle that try to render page based on language sent.If I choose any language (only one) it works, if I a choose more than one, only the first works.
-
Hello
I have a problem with page render.
I need to render the same page in more language but when I call the function, the content is correctly rendered only the first time.
public function sendPost($post_id,$lang_current) { wire('languages')->setLanguage($lang_current); $post = wire('pages')->get($post_id); $content = $post->render(); }
If I use something like this and log the content of "en" is null...
$this->sendPost($page->id,"default"); $this->sendPost($page->id,"en");
any idea? 😐
-
Hi @kongondo and thanks for this module (I bought some days ago).
I installed it and it worked perfectly since I switched to php 8.
Now I've got 4 deprecated messages and the backend doesn't work anymore.Deprecated: Required parameter $mode follows optional parameter $value in /site/modules/DynamicSelects/DynamicSelectsRender.php on line 980 Deprecated: Required parameter $action follows optional parameter $items in /site/modules/DynamicSelects/DynamicSelectsActions.php on line 214 Deprecated: Required parameter $action follows optional parameter $items in /site/modules/DynamicSelects/DynamicSelectsActions.php on line 317 Deprecated: Required parameter $action follows optional parameter $items in /site/modules/DynamicSelects/DynamicSelectsActions.php on line 415
-
On 1/29/2023 at 1:44 PM, jploch said:
@nabo Sorry for the trouble. I was able to reproduce the error (installation was working locally but not on my production server). This should now be fixed. Please update the module.
For those who have problems with the installation of the module, please make sure that you update to version 0.0.98
Now it works!!!!
Thanks, now I can start play a bit 🙂
- 1
-
Thanks for this module, it seems great, but if I try to install I got this error 😞
Error installing module - FieldtypePageGrid
Modules: Unable to install module (FieldtypePageGrid): Can’t save page 0: /pg-items/: It has no parent assigned- 1
-
@flydev any news about this project?
- 2
-
2 minutes ago, Jan Romero said:
Can you not do this?
$cl = $languages->get($user->language->name); $blog_title = empty($page->getUnformatted('title')->getLanguageValue[$cl]) ? 'Look Ma No Title' : $page->getLanguageValue($cl, 'title');
The unformatted value of language fields should be a LanguagesPageFieldValue object that you can ask about language values without fallback: https://github.com/processwire/processwire/blob/dev/wire/modules/LanguageSupport/LanguagesPageFieldValue.php
Thank you!!!!!
-
2 hours ago, virtualgadjo said:
Hi,
too bad, if you can't change it because it's used in other circumstances for the given field, the simplest way i can imagine is, when you need a different behaviour, in your template, just check if the value for a given language is the same as the default language one and, if so, just grab the value from another language, a bit savage but it should work 🙂
have a nice day
This is the problem! I can't check because the value for a given language (if the value is empty) is returned with default value.
-
24 minutes ago, virtualgadjo said:
have you tried checking the "remain blank" option for the fields you want to work this way as, by default, it's the "inherit value from default language" that is checked?
Yes, I know this feature but I can't change this setting for these fields 😞
-
Hello
I manage a multi-language site. In very few case I would like to have a content in other language than default when the value is not set in current language.
I try this way to check if the value is empty, but the value is printed with default language
$cl = $languages->get($user->language->name); $blog_title = $page->getLanguageValue($cl, 'title');
Is there a way to check if a value is empty in some language?
-
Can't wait to test ?
- 1
-
Hello
it would be nice if it could be possible to force a unique (or relative) imagefield for CKEditor.
Example
Using a repeater matrix (or repeater) with CKEditor field, the primary sources for images are imagefields in the page-repeater fieldset. Obviously I can change the page source, but I need to start from the root and this is not comfortable. In this specific situation the better solution is to have an imagefield in the parent page and force CKEditor to automatically go there... or if you want to have a "media library" go there first.Don't know which could be the best "setting system" but in my opinion this is an annoying problem.
-
On 3/30/2021 at 10:33 PM, Robin S said:
Thanks @Robin S this command solved the problem! Thank you again ?
- 1
-
Thanks @Robin S. I will try soon and let you know!
(unfortunately the PW installed is 3.0.123 and I need some time to update it)
-
Hello
I have a strange problem with $page->find
The problem is that it's not work for a particular template. I correctly get the starting $page but these kind of selectors don't work$page->find("template=my-template")
$pages->find("has_parent=xxx,template=my-template")but these work
$page->find("template=another-template")
$pages->find("template=my-template")I tried also with include=all in the selector.
The strage thing is that I repeat the same procedure with another starting parent $page the system works perfectly.
Any ideas?
-
Hi @kongondo
thanks for your work, I really appreciate and have waited for a long time ?
I'm really excited to test PadLoper2.I have some questions
1) since PadLoper product are separated by PW pages, are you planning to do an Inputfield for select PL2 product? It could be useful if you want to use a richer product page modeling it with PW fields.
2) PL users are different from PW users?
- 1
-
The problem is this indeed! The parent page exists!
I tried to export the page, copy the json, delete the page and import in the same position. This is the error.
Other details
PW 3.0.148
superuser -
Hello
I'm trying to use export/import. The export works correctly, but when I try to import data I get this error for each row.
1. Page: /en/data/coupons/coupon_code/ – Fail
Unable to locate parent page: /en/data/coupons/
Page cannot be importedI tried every options (changing parent, erasing path info from json)... but nothing.
Any idea?
-
Thanks @MoritzLost!!!!
-
Hello
is there a way to hook a page save but only when I save it from page edit?
And is there a way to prevent page save hook when I trash it?thanks
-
I got a solution (maybe there are others better than mine)
public function init() { if($this->wire('user')->isSuperuser()) { $this->wire()->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'buildForm'); $this->wire()->addHookBefore('Pages::saveReady', $this, 'saveForm'); } } public function buildForm(HookEvent $event) { $p = $event->object->getPage(); $inputfields = $event->return; $data = wire('modules')->getConfig($this); $fieldset = $this->wire('modules')->get("InputfieldFieldset"); $fieldset->attr('id', 'my_fieldset'); $fieldset->label = __("My Renders"); $fieldset->collapsed = Inputfield::collapsedYes; $field = $this->wire('modules')->get("InputfieldTextarea"); $field->attr('name', 'renders'); $field->attr('value', $data['RendersPages'][$p->id]['renders']); $field->label = $this->_('Renders'); $fieldset->append($field); $inputfields->append($fieldset); } public function saveForm($event) { $data = wire('modules')->getConfig($this); $data['RendersPages'][$this->input->post->id]['renders'] = $this->input->post->renders; $this->wire('modules')->saveConfig($this, $data); }
- 1
-
45 minutes ago, flydev ?? said:
Hi,
Which is the class derived from ? Can you paste all the module code ?
Hi
class Renders extends WireData implements Module, ConfigurableModule { static public function getModuleInfo() { return array( 'title' => 'title', 'summary' => 'summary', 'version' => '1', 'author' => 'me', 'autoload' => true ); }
Dynamic Selects (Commercial Module)
in Modules/Plugins
Posted
Hi @kongondo
i use happily your module. May I give you a suggestion?
I work with a lot of items and instead of a simple select options would be useful a feature like Page Auto Complete (both for performance and also partial search). Could be in your roadmap?