Jump to content

cpx3

Members
  • Posts

    64
  • Joined

  • Last visited

Recent Profile Visitors

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

cpx3's Achievements

Full Member

Full Member (4/6)

17

Reputation

  1. @Jan RomeroYou are incredible. Danke! (PS: I like your profile image!)
  2. Hi to all, I have a page reference field (select_categories) that references to a page called "unternehmen". When I debug it, PW says that the of the referenced page is "unternehmen". But when I put the condition, I get false. What am I doing wrong?
  3. Thanks for that. Looks like that the problem was that one select_author is a select with a single value... I changed it and now it seems to work.
  4. Hi everyone, I have quite a strange problem. When I use the following code with a terminal php command, it produces the following error message: Fatal Error: Uncaught Error: Call to a member function of() on int in /site/templates/process_pagefields.php:20 #0 {main} thrown (line 20 of /site/templates/process_pagefields.php) When I use it with Tracy it works fine from time to time, but sometimes it echoes "0", too. Any ideas what I am doing wrong? Thanks in advance, Bernhard Here goes the code include("/html/index.php"); // bootstrap ProcessWire // Get derefAsPage property of page_field_b to distinguish multiple/single page fields $deref = $fields->get('select_related_articles')->derefAsPage; foreach($pgs as $p) { // For this page, get the pages selected in page_field_a $selected_pages = $p->select_author; // Standardise $selected_pages to PageArray in case of "single" field if($selected_pages instanceof Page) $selected_pages = $selected_pages->and(); foreach($selected_pages as $selected_page) { // Add this page to page_field_b on the selected page $selected_page->of(false); if($deref) { $selected_page->select_related_articles = $p; echo "Set $p \n"; } else { $selected_page->select_related_articles->add($p); echo "Added $p \n"; } $selected_page->save(); } $numPgs--; echo $numPgs."\r"; }
  5. AndZyk, I found the solution. For whatever reason, the file compiler option was deactivated in config.php, so the templates were not compiled...
  6. Hi fellow programmers, I have a strange problem: when I try to use any functional field I get the error message "undefined function"__richtext()" or whatever I try. As soon as I include <?php namespace ProcessWire; ?> in my template files, everything works fine. The _init.php file exists and is not excluded, the same is true for ready.php and they seem to get included. Any ideas? Thanks, Bernhard
  7. Thanks again for the answer. Actually I only called that selector on a testpage which had nothing on it than this selector plus pages->find. The solution for the moment was to add a "minimum date" (i.e. created>date_minim) which seemed to be the only possibility to increase speed. The interesting fact was however that the same selector with the same data (I did not change anything) worked from 1000 ms to 80000 ms.
  8. Hi to all, I have a quite strange problem. If I open a page that contains the selector select_countries=oesterreich, begin=(start_date=''),begin=(start_date<=today),end=(end_date=''),end=(end_date>=today), template=template-news, checkbox_not_startpage=0, select_categories!=tipps|shortcuts, id!=, limit=5, sort=-created things get so slow that I usually need to restart the whole server to be able to login to PW-admin. I attached the profiler output of the function and you can see that with the exactly same data the output time goes up to minutes... Any idea? When I put the selector in the debugger it has an execution time of about 1200 ms. The problem only seems to appear when the selector is (the first and only) part of a function. Any ideas? Thanks in advance, Bernhard
  9. Thanks for the great help everybody!
  10. Thanks once more for the answers! My problem is that I have no idea how to get the value of select_countries.title (which is a referenced page). I tried (beside many variations): foreach ($items as $p) { echo $p->select_countries.id; } But with no results...
  11. Thanks to everybody for the answer! I tried findRaw which seems to be the most effective but brings me to another problem: How to access page references? I have the following code: $items = $pages->findRaw("template=template-news, select_region=austria, limit=2, objects=1", ["select_countries" => [ "id", "title" ]]); where select_countries are referenced pages. But I have no clue how to access the select_countries id as it neither works with array[0] nor with select_countries->title...
  12. Hi there, to display a single slide from a huge database I only need a single page. But when I use the selector $pages->findOne("template=template-news,start=1,sort=created")->title; the selector seems to ignore the start position and always returns the same page. As the docs specify clearly that findOne has the same options as find, I have been trying to find my mistake for the last four hours with any success... (I cannot use find as this slows down things extremly). Any ideas?
  13. Thanks anyway. I supposed it would as it is possible to exclude them. But they are definitely the source of the problem.
  14. @wbmnfktrThe problem seems to appear only when url segments are activated. Is there anything I oversaw?
  15. Thanks for the hint, I reinstalled the module and did everything as described but it still does not count anything...
×
×
  • Create New...