Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Neutral

1 Follower

About Manuel

  • Rank
    Jr. Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you very much, for writing me those detailed information! @Klenkes and @wbmnfktr , I really appreciate that!
  2. For this purpose, a switch-statement would be a bit more readable and faster. If there are more than 3 conditions to check (one var with different values), you should use switch. Switch is also slightly faster, because it just computes the condition once and then checks for the output while if / elseif / else has to be computed every time.
  3. Dear Community, after diving into Processwire and developing my first PW-based project, I've read about the commercial plugins. I know, choosing the right plugin depends on the project but: What Pro-Plugins do the experienced users recommend? Wich Pro-Plugins do you use most often in your projects? Thank you for sharing you experience! ๐Ÿ™‚
  4. Thank you @bernhard I knew there would be a faster way to get the job done. PW is geeting better and better to me ๐Ÿ™‚
  5. My final solution to output all fields as a JSON-Object: <?php $planets = $pages->find("template=planet, sort=-title"); $planets_array = array(); foreach($planets as $planet) { $moon_array = array(); $moons = $planet->planet_moons; foreach($moons as $moon) { $moon_array[] = $moon->title; } $planets_array[] = array( 'title' => $planet->title, 'created' => date("H:i:s d.m.Y", $planet->created), 'modified' => date("H:i:s d.m.Y", $planet->modified), 'type' => $planet->planet_type, 'age' => $planet->planet_age, 'color' => ucfirst($planet->planet_color->title), 'moons' => $moon_array, 'summary' => $planet->planet_summary, 'foto' => $_SERVER['SERVER_NAME'] . $planet->planet_foto->url, 'planet-reference' => $planet->planet_reference[0]->title ); } $planets_json = json_encode($planets_array, true); echo $planets_json; ?> Output (JSON): [{ "title": "Merkur", "created": "20:25:29 16.04.2019", "modified": "14:06:19 17.04.2019", "type": "W\u00fcstenplanet", "age": "800.812", "color": "Brown", "moons": ["Merkur Mond 1", "Merkur Mond 2"], "summary": "Beschreibung gibt es noch erst eine sehr kurze. hier gibt es noch nicht viel zu lesen...", "foto": "extranet\/site\/assets\/files\/1045\/merkur.jpg", "planet-reference": "Earth" }, { "title": "Mars", "created": "17:54:58 07.04.2019", "modified": "14:06:08 17.04.2019", "type": "Terrestrial moon", "age": "4.500.000.712", "color": "Red", "moons": ["Phobos", "Deimos"], "summary": "Mars is the fourth round planet from the Sun...", "foto": "extranet\/site\/assets\/files\/1018\/mars.jpg", "planet-reference": "Merkur" }, { "title": "Jupiter", "created": "17:28:14 07.04.2019", "modified": "14:05:52 17.04.2019", "type": "Great Gas Giant", "age": "4,5 Billion", "color": "Yellow", "moons": ["Io", "Europa", "Kallisto", "Ganymed", "Amalthea", "Himalia", "Elara"], "summary": "Jupiter is the fifth planet...", "foto": "extranet\/site\/assets\/files\/1017\/jupiter.jpg", "planet-reference": "Mars" }, { "title": "Earth", "created": "17:13:23 07.04.2019", "modified": "14:05:40 17.04.2019", "type": "Terrestrial Planet", "age": "15.56 Billion", "color": "Purple", "moons": ["Moon"], "summary": "Earth (or the Earth) is the third planet from the Sun...", "foto": "extranet\/site\/assets\/files\/1016\/earth-1.jpg", "planet-reference": "Jupiter" }]
  6. You're right, a select-input would be a neat workaround to prevent a user to assign multiple pages. I agree, issue should be fixed. As a newbie tat behaviour was a bit confusing to me. Thanks to everybodies help: @Robin S @adrian @BitPoet @bernhard ๐Ÿ™‚
  7. Switching the field to Multiple Pages works fine, but for now the user is able to assign multiple planets instead of just one ๐Ÿ™‚
  8. Hi @Robin S, that would make sense. But after checking the references (only 4 pages), I can tell you they don't reference each other. Here's another screenshot. The references are as follows: earth (1016) --> mars (1017) mars(1017) --> jupiter (1018) jupiter(1018) --> merkur (1045) merkur(1045) --> earth(1016) After removing one of the d() functions as shown above, the fatal error doesn't occure. The problem is, I want to get all pages with there references, not only n-1 ๐Ÿ˜‰
  9. No problem and thanks for your advise! I'll try to solve the issue and will report the solution in this thread - hopefully ๐Ÿ˜‰
  10. @bernhard now i know what you mean. No - there is another id selected (1017). PW even doesn't offer a self-refference in the selectbox.
  11. Thank you for the hints! Unfortunately the error occures on every page, also on the backend (TracyDebugger Console).
  12. Hi @bernhard - and greetings from Tirol ๐Ÿ˜‰ Yes I've allready installed Tracy-Debugger and get the same error. It can't be an endless loop, because, even if I enter the code directly into the tracy debugger console, the same error happens. Two outputs work fine, after a third one a error occurs... Thanks for your help! Manuel
  13. Hi everybody! I'm new to PW and just did the beginner-tutorial โ€œHello Worldsโ€, a beginning ProcessWire tutorial --> Link After extending the template from the original tutorial with a page_reference-Field (Page-Field value type is configured as single page), PW throws a fatal error when i try to output multiple pages: $planets = $pages->find("template=planet, sort=-title"); foreach($planets as $planet) { echo $planet->title; echo $planet->planet_reference->title; } Should return three Pages, but throws the following error: When i try to output the field with a single page, everything just works fine: $planet = $pages->get(1018); echo $planet->title; echo $planet->planet_reference->title; I've tried to solve the problem with myself (and google), but i can't fix the error. Thanks a lot! My enviroment: OSX Mojave / MAMP (PHP 7.2), PW v 3.0.123
  • Create New...