• ×   You have pasted content with formatting.   Remove formatting

      Only 75 emoticons maximum are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      So I have a bit of code for ad management :
      <?php $ads = $pages->find("parent.template=client, sort=expiration_date"); $alert_count = 0; foreach ($ads as $ad) { $todaysdate = date("F j, Y H:i"); $today = strtotime($todaysdate); $expireson = $ad->expiration_date; $expires = strtotime($expireson); $fiveaway = $expires - 432000; if ($today > $expires) { $alert = $alert_count=+1; echo $alert; } } //end FOREACH ?> It currently finds all the pages with a parent of "client" and then I can drill down to the pages that have "Expired" in my if statement. I wanted to get a "count" of the pages that met the if statement requirements so I could output that number in an alert at the top of the page. When it runs, it currently just prints out "1 1 1 1..." and not the total count of pages. Does anyone know of a way possibly achieving my desired output? I tried count(), but that did not quite produce my desired output.
       
      I should note that I have several other if statements dealing with the date/time for outputting other alerts as well (just didn't think they were needed for this case).
    • By Dennis Spohr
      Hi all,
      in the backend of ProcessWire it's possible to define a maximum width and height for images. If you upload an image, it will be resized automatically. I find this feature very handy to safe space. Very often users upload images which are much bigger than needed.
      On my application users can upload their images via the frontend. But if you upload images using the API, images won't be resized automatically.
      Is there any way to do this?
      Currently that's my code:
      if ($_FILES['thumbnail']['name']) { $upload = new WireUpload('thumbnail'); $upload->setMaxFiles(1); $upload->setOverwrite(true); $upload->setDestinationPath($lesson->video_image->path()); $upload->setValidExtensions(array('jpg', 'jpeg', 'png')); $lesson->video_image->removeAll(); foreach ($upload->execute() as $file) $lesson->video_image->add($file); } Thanks very much!
      Dennis
    • By Mirza
      Hi All,
      I have created a script which will create the pages and it should be unpublished.
      I have added the status as unpublished by default while first time saving the page as below.
      $hotelPage->hotel_website = $hotel['hotelWebsite']; // By default page created will be unpublished state $hotelPage->addStatus(Page::statusUnpublished); $hotelPage->save(); $hotelPage->setOutputFormatting(false); // Add hotel images only after setting output formatting to false $hotelPage->images->add($hotel['hotelImage']); $hotelPage->save(); On the same time, saving the hotel image as well and triggering the save method.
      But when I see the created page in the tree, Its shows unpublished but publish_date is not empty(date will be present as created, modified and published are all same)
      Now I don't understand why the date is getting filled into the publish field for a page?
      Please let me know if am doing something wrong.
    • By benbyf
      Hello,
      Does anyone know whether the is a place detailing the structure your admin theme should take when creating one? e.g. I see UiKit, Reno and Default admin themes all have default.php, init.php, controller.php files, is this a stylisitic choice or a prerequisite for any admin theme module?
      Thanks!
    • By bmacnaughton
      I am using the translation function (either $this->_() or __()) within a module that responds to AJAX API calls - there isn't really a page that is being served.
      When I supply a string with an apostrophe, e.g.,
      __('Book \'em danno') It is formatted as
      Book &#039;em danno  
      Is there some way to prevent output formatting when retrieving strings using the translation functions?