• Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      I have been looking up everything I can to try to find what's going wrong with this. I have a very simple form (title and file field set to multiple) that will create a new page with the name and attachments. However, it appears that I am missing something crucial as only 1 item gets uploaded to the field. Here is my code:
      <?php $uploadpage = new Page(); $uploadpage->template = "dashboard"; $uploadpage->parent = $pages->get("/testing/"); $uploadpage->title = $sanitizer->text($input->post->new_title); $uploadpage->save(); $uploadpage->setOutputFormatting(false); $u = new WireUpload('test_upload'); $u->setMaxFiles(6); $u->setOverwrite(false); $u->setDestinationPath($uploadpage->test_upload->path()); $u->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png', 'pdf')); foreach($u->execute() as $filename) { $uploadpage->test_upload->add($filename); } $uploadpage->save(); ?> I have the max files set to 6, and have a foreach loop to add the files, but it is only uploading one. Does anyone see where I might have gone astray?
    • By louisstephens
      So maybe has already figured this out, but I am stumped. I have a field (test_field) that is set to pdfs, and I was trying to get a count of the number of pdfs in that field so I could add it to a status bubble on the front end. I tried:
      function testPDF() { $a = $page->test_field->count(); echo "<span class=\"bubble\">" . $a . "</span>"; } but it is returning "NULL" . I currently have 3 added to the field. I also tried putting this function in _func.php, though I need to use wire('pages'), but I only need to get the count for that specific page, so I am sort of at a loss of how to proceed.
    • By sirhc
      Hi all,
      Im looking for a selector that gets the pages added a specific time frame (eg. from yesterday 9:00pm to today 9:00pm).
      Is there a existing selector im missing or does someone now a good solution for this?
      Thanks in advance .
    • By celfred
      Just a simple (I think) question which is in the title of my post.
      Roughly speaking : here's my code (made-up because my real function is so long... I don't want to post it all here )

      function updateScore($player, $task, $real = true) { [...] $player->score = $player->score+$task->score; if ($task->name == 'new-equipment') {   $new-eq = $pages->get("name=sword");   $player->equipment->add($new-eq); } if ($real == true) {   $player->save(); } }
      Everything works fine when I call updateScore($player, $task, true), but if I call updateScore($player, $task, false), scores are untouched, but the equipment gets added !
      It used to work fine on PW2.7 but my update to PW 3.0.62 seems to have broken this... Is there a simple explanation ? I keep reading my code over and over and this is driving me crazy...
      Thanks !
    • By zaib
      I've a page "blog" which have child pages (blog posts). Right now I've 11 pages (blog posts) and I'm fetching all the posts in my "blog" pages which displaying fine, Issue is only 10 results are showing this is how I'm fetching
      $entries = $pages->find("template=blog-entry"); foreach($entries as $entry){ <a href='{$entry->url}'>$entry->title</a> }