Jump to content

Wanze

PW-Moderators
  • Posts

    1,116
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wanze

  1. Depending on some settings of your server, you can also upload .zip Files http://processwire.com/videos/ajax-file-uploads/
  2. Your module has to implement the ConfigureableModule Interface: class MyModule extends WireData implements Module, ConfigurableModule Then you can implement the following method, PW will handle saving and displaying the module options! static public function getModuleConfigInputfields(array $data) { $fields = new InputfieldWrapper(); //Generate a Text field for entering the API Key $field = $modules->get("InputfieldText"); $field->attr('name+id', 'apiKey'); $field->attr('value', $data['apiKey']); $field->label = "API Key (Developer Key)"; $field->description = 'Enter the API key'; $fields->append($field); return $fields; } The code above should let you save the API Key in the module config options. Now in your module, you can retrieve the key: $apiKey = $this->get('apiKey'); //or $apiKey = $this->apiKey; Hope this helps! Also I suggest looking at other modules which have config options
  3. If I'm right, then only fields which are marked "autojoin" are fetched with the SQL Query behind $pages->get automatically.
  4. Try this, hope it helps: foreach ($galleries as $gallery) { //Try with "==" instead of "===" if ($gallery == $galleries->first()) { $class .= " active"; } //Another solution foreach ($galleries as $k => $gallery) { if ($k == 0) { $class .= " active"; }
  5. In your php.ini, you should also set the values for "max_execution_time" and "max_input_time" to more than 30 seconds (30 = default value I guess). But I also suggest to upload huge files via FTP.
  6. Hi encho. If you allow to upload multiple images, then your $field->images returns a WireArray. I think that's causing your problems. Take a look in the setup of your "images" field, under the Details. If you have the maximum files set to zero, this means no limit: Description: Enter 0 for no limit. If you enter 1, the API will dereference this field as a single file rather than an array (when the Page's outputFormatting is on, as it is by default). Try this code: foreach($page->repeater as $field) { //Grab first image of Array... if you set the limit to "1", then you could just write $field->images $image = $field->images->first(); $thumb = $image->size(286, 217); echo "<ul>"; echo "<li><img src='{$image->url}' alt='{$image->description}' /></li>"; echo "</ul>"; } With File Inputfields, it's the same
  7. Hi MatthewSchenker, I just had a quick look over your code and website. There didn't show up any Js errors. But in the template code, you are also looping the Javascript code, so this is printed out with every image. Remove it from the loop and insert this JS-Code in the head or before the </body> tag: <script type="text/javascript"> $(document).ready(function() { $(".fancybox").fancybox({ openEffect : 'none', closeEffect : 'none' }); }); </script> </body> </html> Does this solve your issue?
  8. Hmm do you get any error messages in your Javascript Console in Chrome? I'm also on Mac and it seems to work fine here with chrome. Try: Clear the browsers cache Clear the cache from the statistics generated with MarkupCache => Go to the module options and for example change the default date range and save, this should also clear the MarkupCache behind. Does it work with other browsers? Btw I just noticed that Chrome does not support APNG, so I will change the loading animation to a gif..
  9. Not sure if I can help you out since I've never used the Thumbnails module so far. I looked a bit how the Thumbnail module works. I think the problem is that the method "getThumb('wideslide')" returns the url to your cropped image. This is just a String and not an PageImage object, so you can't access the property "width". As a workaround, you could find out the width of the thumbnail with php: //Find out the width of the cropped image before the loop $width = 0; $first_slide = $page->slides->eq(0); if ($first_slide) { $crop_url = $first_slide->slide_image->eq(0)->getThumb('wideslide'); $crop_path = $config->paths->root . $crop_url; if (file_exists($crop_path)) { $size = getimagesize($crop_path); $width = $size[0]; } } if (count($page->slides)) { echo "<div id='slideshow'"; if ($width) echo " style='width: {$width}'></div>"; foreach($page->slides as $slide) { /// continue In your repeater-template, you should get the correct cropped image url with: $img_url = $page->slide_image->eq(0)->getThumb('wideslide'); echo" <img src='{$img_url}' alt='{$page->slide_title}' />"; I have not tested my code and the chances that I just had an overcomplicated idea and there are some errors are quite big. Maybe some Processwire-crack comes up with a better idea
  10. Check this thread out: http://processwire.c...-pages-via-api/ The error appears because your page was not found, thus the variable $mypage is an object of "NullPage". //Note the change from $wire->pages to $pages... $p = $pages->get("/foo/bar/"); if ($p->id) { //Page was found, you can modify with API } else { //Page was not found... it is NullPage and has id = 0 } Edit: Changed $page to $p, see Ryan's explanation below
  11. Alrighty, then the repeater is of course a good solution For the second part with the global slideshow, I would do the same with the repeater field. => Check if the current page has a repeater-field with more than zero entries, otherwise grab all the stuff from the repeater of the global page.
  12. Hi kasperwf, welcome to the forums! For the slideshow you want to achieve, I think you don't need a repeater since you can already store multiple images with description in the Image-Fieldtype itself. Check out the options of your image field: Under "Details", set the option "Maximum files allowed" to zero. This way, you can add as many images as you want (with description). You can also give the description field more than one row in the "Input" section of the options. For the global slideshow, I would create a separate page which stores all global images & descriptions. This page can be hidden, as it serves only to store the global images. Then in your template code, you could do something like this: //Check if the actual page has some images stored in a field called images if ($page->images && count($page->images)) { foreach ($page->images as $image) { //..output page images slideshow } } else { //Display global slideshow $global_page = $pages->get("/path_to_your_global_page/"); foreach ($global_page->images as $image) { //... output global images slideshow } }
  13. Hi Processwires! Just updated the module with some small improvements: Loading Animation for each section for better usability Date Range: If your range is smaller than 3 days, the module queries the visitors per date AND time. For example: If your date range is "24 hours" back, then you will now get the count of visits per hour. Before, you only got a straight line between two dates. ;-) Optional feature: For the visits and pageviews, the module allows you to display the difference compared to the previous date range. This should give you a quick idea, if your website has more or less visitors compared for example to the month before. See the attached Screenshot By default this setting is disabled, but you can enable it in the module settings I also updated jqplot and the Google API Client to the newest versions. Let me now if you run into problems with some setups! Cheers
  14. Create a new User and a Role (for example "editor") and assign it to your user. He won't see Setup/Modules/Access anymore, because only users assigned to the role "superuser" see these pages by default.
  15. Hi p_hammond, This is a simple task in Processwire Give all your projects the same Template, for example "project". Assign an Image Field to this Template. This way, you can store one or more images in your projects. To grab the latest 6 projects with image (in your homepage template or portfolio), you can build a query like this: $projects = $pages->find("template=project, sort=-created, limit=6"); //Output the Images and link to project page foreach ($projects as $project) { //Grab the first image of field "images" $img = $project->images->first(); echo "<img src='{$img->url}' alt=''><br>"; echo "<a href='{$project->url}'>{$project->title}</a> }
  16. Yep it took me some time too, allthought i'm not surprised with a system flexible as Processwire. You can change the structure of the Backend the way you like it
  17. Thanks onjegolders, you're welcome! You can change the title field of the GA-Page which is in your Site-Tree under "Admin". Actually i hope to implement some planned improvements over the next week.
  18. Maybe looping over all items an then call the remove method for each item: $images = $page->image; foreach ($images as $img) { $page->image->remove($img); }
  19. I think you could check the "last modified date" of the file itself with php: foreach ($file_pages as $file_page) { int modified = filemtime($file_page->filename); echo "last modified" . date('d-m-Y', modified); } Not testet and assuming that ->filename returns the path + the filename itself
  20. Hi folks. I've almost finished a site using this module, it works fantastic so far ;-) One thing I noticed AND solved (temporary): When enabling caching on templates, then the cache file gets generated only for the language of the first request. Switching between languages does not work anymore, always the same language is loaded. That make sense, because PW stores a cacheFile per ID. Solution: PageRender module in the method "getCacheFile", add after line 118: //Check the language if ($this->user->language->title != 'default') { $lang = $this->user->language->title; $lang = $this->sanitizer->pageName($lang); $secondaryID .= $lang; } This code adds a secondary Cache-ID per language resulting in a cache file per language. How to implement this correctly? I think the getCacheFile method should be hookable so this module can modify the returned CacheFile name.
  21. Hi Luis, You could also set Status of a Page to hidden, then ProcessWire does not include the Page in searches and lists (Menu). This setting can be found under the "Settings" tab of the page -> Hidden: Excluded from lists and searches. If you want a hidden page to appear in a search, add "include=hidden" in the Selector, for example: $pages->find("template=basic-page, include=hidden"); //or $homepage->children("include=hidden");
  22. Looks very nice! "Active and fiendly community" --> There's a little r missing.. my eyes seem strong today
  23. Finally comitted the fix to Git! I hope to make some other improvements in the next few weeks. By the way, I found a stupid mistake. You were not supposed to see the "Google Analytics Account Id" in the module config, unless already chosen from the Dropdown. It's clear that people get confused when this setting exists right after the install... Check this code out: //Ga Account ID - only display when Account was chosen with dropdown before $field = ($data['accountId']) ? $modules->get("InputfieldText") : $modules->get("InputfieldHidden"); $field = $modules->get("InputfieldText"); Aaaaaaaaaaargh :-
  24. I'm not sure if I understand 100% what you want to achive, but I think you just need to do this in PHP when "echoing" the text from the textarea: echo nl2br($text); You'll have "<br />" Tags and not paragraphs in your html. Maybe that's ok? ;-)
×
×
  • Create New...