asbjorn Posted September 6, 2016 Share Posted September 6, 2016 I'm trying the recently added multi-instance support in a local environment, and has encountered some problems. There's not much code, so I'll paste all I have and some info on the installations (both are ProcessWire 3.0.33), and pinpoint the issues as I go: In a template on www.testdomain.pw (local through MAMP) <?php // Server path to the PW installation $path = "/Users/name/documents/testdomain/studiehandbok/"; // The root URL for the PW installation $url = "/studiehandbok/"; // Create a new ProcessWire instance $mi_studiehandbok = new ProcessWire($path, $url); // get study pages $subjects = $mi_studiehandbok->pages->find("template=study, limit=2"); // output list foreach ($subjects as $sub) { echo "<a href='$sub->httpUrl'>$sub->title</a><br>"; } ?> Issues: The echo will show the correct Url. But as for title, only a list of the text Array will show. But echoing name instead of title works. Comment: as for $url, when I had http://www.testdomain.pw/studiehandbok/ as the root URL for the PW installation, the first slash "/" after www.testdomain.pw disappeared. In config-dev.php on the /studiehandbok/ multi-instance installation $config->httpHosts = array('www.testdomain.pw'); Comment: This multi-installation is located in a subfolder of my main PW installation. The subfolder is as shown in $path above, called /studiehandbok/ PS: I've also tried with another local installation as the multi-instance, also giving an error on the line of the ->title Notice: Array to string conversion in my template. PS2: I tried to find template=home and others. With home the title actually showed, but only then (tested a few). I'll provide more details if necessary, but I didn't know exactly what to include. Link to comment Share on other sites More sharing options...
yuters Posted September 27, 2016 Share Posted September 27, 2016 I'm having the same issue, it seems to only affect fields with language support. Which makes the ->title property an array containing ['data'], I'm trying other fields with language support, like a textarea, and they give the same error but are inaccessible through the ['data'] array key. I guess multiple languages are not yet supported on multi-instance. Link to comment Share on other sites More sharing options...
adrian Posted September 27, 2016 Share Posted September 27, 2016 You guys are mentioning an array rather than an object is being returned, so I am probably not correct here, but might be worth a shot - I wonder if outputformatting is off when calling a field from another instance? Try turning it on for the page, or using: $page->getFormatted('title'); Again, I a, probably wrong, but I haven't played with multi-instance yet so just throwing an idea out there. Link to comment Share on other sites More sharing options...
yuters Posted September 27, 2016 Share Posted September 27, 2016 With $page->getFormatted('title') I get this error: Notice: Array to string conversion in wire/modules/LanguageSupport/FieldtypeTextLanguage.module on line 69 Link to comment Share on other sites More sharing options...
adrian Posted September 27, 2016 Share Posted September 27, 2016 Just now, yuters said: With $page->getFormatted('title') I get this error: Notice: Array to string conversion in wire/modules/LanguageSupport/FieldtypeTextLanguage.module on line 69 Yeah, that would make sense since it's an array. Will have to wait for someone who has some experience with multi-instance to chime in. Link to comment Share on other sites More sharing options...
BitPoet Posted September 28, 2016 Share Posted September 28, 2016 I can't test it right now, but one thought is that maybe user language might not get initialized correctly for the instance. Does setting the language explicitly before retrieving the subjects help? $mi_studiehandbok->user->language = $mi_studiehandbok->languages->get('default'); Link to comment Share on other sites More sharing options...
asbjorn Posted September 28, 2016 Author Share Posted September 28, 2016 No luck with your language suggestion, BitPoet. At least not like this on my main site: switch($user->language->name) { case 'default': setlocale (LC_ALL, $homepage->locale); break; } $mi_studiehandbok = new ProcessWire('/Users/asbjornness/documents/vid/studiehandbok', '/studiehandbok/'); $mi_studiehandbok->user->language = $mi_studiehandbok->languages->get('default'); And also repeating the switch-part on my secondary (multi-instanced) site. Both nb_NO to be precise in my case. Still getting a list of the text Array with this code: $subjects = $mi_studiehandbok->pages->find("template=subject, limit=10"); foreach ($subjects as $s) { echo "$s->title<br>"; } Link to comment Share on other sites More sharing options...
Michael Murphy Posted October 24, 2016 Share Posted October 24, 2016 I am also having the same issue with 3.0.36 - it only seems to affect multilanguage fields like TextLanguage, PageTitleLanguage and TextareaLanguage. Has anyone found a work around or should I add this to the issues repository? Link to comment Share on other sites More sharing options...
Michael Murphy Posted October 25, 2016 Share Posted October 25, 2016 I just tested with two fresh installs of the master branch using the multi-language default profile. Seems to be a bug, so submitted this to the issues repository: https://github.com/processwire/processwire-issues/issues/60 Link to comment Share on other sites More sharing options...
Michael Murphy Posted October 31, 2016 Share Posted October 31, 2016 To update those on this thread, Ryan just pushed some fixes to the dev branch which fixed this issue for me, maybe also for you. Amazing turnaround - less than 5 days (3 actual working days) from a bug submission to a working fix. Big up respect to @ryan Would be interesting to hear what people are planning to use the multi-instance support for. My initial needs are for some content migration between two sites, but I can imagine using it for much more in the future. 2 Link to comment Share on other sites More sharing options...
asbjorn Posted October 31, 2016 Author Share Posted October 31, 2016 On 31.10.2016 at 7:40 PM, Michael Murphy said: To update those on this thread, Ryan just pushed some fixes to the dev branch which fixed this issue for me, maybe also for you. Nice. I'll check it out tomorrow! Edit: I can confirm that the fix is working. I've been able to set up multi instance with multiple language without problems. On 31.10.2016 at 7:40 PM, Michael Murphy said: Would be interesting to hear what people are planning to use the multi-instance support for. My initial needs are for some content migration between two sites, but I can imagine using it for much more in the future. I'm a web editor at a university college's web page. And we'll be using this to integrate parts of a study guide (academic presentation of study programs and its subjects) into our main web page where our primary focus is marketing of these programs. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now