Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/28/2016 in all areas

  1. I just added a small code snippet so that custom global fields are also added to templates when using a TemplateMigration.
    5 points
  2. This seems like it might go back a very long time: https://processwire.com/talk/topic/1125-images-field-returning-array-even-when-max-files-set-to-1/ I feel like I have come across this before too and been in a hurry and just used ->first() rather than trying to debug it. A couple of things that work other than first() $user->of(true); echo $user->avatar->url; or this: $u = $users->get($user->id); echo $u->avatar->url; Both of these work. In a rush so not sure why - I don't see why the $user object seems to have outputformatting off by default - maybe this is intentional, but I don't recall.
    3 points
  3. If you look in the settings for your particular integer field (cruise_spaces) there should be an option to set how '0' values are treated. If you take the option that 0 and blank are not the same i think it will solve your problem. Setup->Fields->Edit Field: cruise_spaces Under the 'Details' tab
    3 points
  4. I have added an image field "avatar" to the user template. The field settings are "Maximum files: 1", "Formatted value: Single items (null if empty)". So I believe I should be able to get the URL of this image in my template with $user->avatar->url But this returns /site/assets/files/1217/ If I add the avatar field to any other template besides the User template I can get the URL as expected. For the user template if I use $user->avatar->first->url I get the URL okay. So it's like image fields added to the User template don't honour the "Formatted value" setting. Has anyone else experienced this? If so I guess it's bug and I'll file an issue on Github. Edit: If I get a specific User page it works normally $pages(1217)->avatar->url So it's just an issue when trying to get the image from the User object. Is this difference from the Page object likely to be intentional?
    2 points
  5. There's a $ to much in $newspage->$news_items
    2 points
  6. Ahh, right. I was meaning the file I have auto-prepending to my templates, which I happen to have called init.php. I should have been clearer.
    2 points
  7. I am talking about site/init.php - that is definitely loaded in the admin. Maybe you are referring to your own manually included init.php that is in the templates folder?
    2 points
  8. Beware of putting $user->of(true); in init.php because it will also be loaded for the admin (as well as the frontend) which I expect will cause all sorts of problems.
    2 points
  9. Just struck this also. @Chris is right about the source of the problem... $storage->parent = $this->pages->get('/admin/'); ...should instead be... $storage->parent = $this->pages->get(2); Making the change above does allow the module to be installed but first you have to delete the fhStorage template from the failed installation attempt. And this isn't straightforward because the system flag is set, and can only be removed via the API. To do this... $t = $templates->get("fhStorage"); $t->flags = Template::flagSystemOverride; $t->flags = 0; $t->save(); Then the template may be deleted via the Admin (or the API).
    2 points
  10. Hi Gazley, I'm not sure if I fully get what you are after, but I try to answer. You can access an Imagesizer instance like this: $ImageSizer = new ImageSizer(); // or, maybe better, with an image-filename $filename = $page->images->first()->filename; $ImageSizer = new ImageSizer($filename); Now you can query everything you want: https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire/core/ImageSizer.php#L312-L321 https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire%2Fcore%2FImageSizerEngine.php#L1110-L1131 https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire%2Fcore%2FImageSizerEngine.php#L205-L216 $quality = $ImageSizer->quality; // returns the calculated value from: engine-default-setting => wire/config.php => site/config.php EDIT: Or do you mean the new modules configurable default settings of the ImagesizerEngines? If yes, you can use the $modules method getModuleConfigData() $configdata = wire('modules')->getModuleConfigData('ImageSizerEngineIMagic'); $defaultQuality = $configdata['quality'];
    2 points
  11. Support thread for WireMail Mailgun. For bug reports, please use the bug tracker on GitHub. https://github.com/plauclair/WireMailMailgun
    1 point
  12. Hi everyone, This is an early (but mostly functional) version of a module that I am experimenting with for automatically populating all empty fields on a page. It is designed for use during site development and should be uninstalled once the site is live. https://github.com/adrianbj/AutoContent (anyone have an idea for a better name?) It currently supports the following field types: Text - outputs "This is an example Field Label", where "Field Label" is the label for the field Textarea (RTE and plain) - configurable content from http://loripsum.net/ and embedded images from http://lorempixel.com Datetime - honors output formatting and returns random date/time with configurable min/max datetime Integer - honors min and max settings Float - honors min, max, precision settings URL - returns a random URL Email - returns a random email address Image - you can specify image category (people, nature, business, etc), and the range for min/max number of images to generate. Page - creates runtime selected child page content for output - not well tested yet. MapMarker - not well tested yet! I will be adding support for Profields and other selected 3rd party fieldtypes shortly. Highly configurable content is provided by: http://loripsum.net/ http://lorempixel.com/ https://github.com/fzaninotto/Faker Generated content can be localized to your region - very handy for addresses, people's names, phone numbers etc: Many fieldtypes are configurable via the Input tab on the field's config settings, eg: Textarea: Text: Images: Datetime: In general I am designing this to work with minimal/no configuration so you can install and have all fields on all pages on your site immediately populated for testing layout and styling without the need for manually adding dummy content. There is also a dummy page batch creator and deletor (automatically tracks and deletes just the dummy pages) available from the module config settings page. Please let me know if you think you will find this useful - trying to get an idea of how much time to put into support for additional field types.
    1 point
  13. I have just delivered this website: Into Nature (Dutch only), about an 'Art expedition' through the province of Drenthe, in The Netherlands. I built the site for Vandejong. The site is made using two distinct parts/techniques: Processwire for the back-end (through a RESTful json api) and the front-end is built on Ember.js. This is my third large site built this way, and the first I am completely happy about. A page called 'API' is the main interface between the two: it uses urlSegments and parses the content from the PW pages into Ember-friendly JSON data. As Ember is very strict (heavily based on the Convention over Configuration concept), and Processwire is extremely versatile, the way Ember requires its data dictates the way I shaped the API. Both @clsource's REST-helper and ProCache are used to format and cache the API responses, making the API very responsive. Something that was initially hard to wrap my head around was how to deal with the site's routing/pagetree. While Google now indexes modern 'single-page' web applications, for instance Facebook still scrapes their opengraph from the raw HTML pages. I dealt with this by giving the Ember app and the PW page-tree use the exact same routes / pages. Every Processwire page is a valid starting point for the Ember app, while also including the scrapeable meta tags belonging to that exact URL. As a result, the whole thing is nicely CURL-able and bot-friendly.
    1 point
  14. Hi @horst - many thanks for your reply. It's a really great answer and I appreciate you taking the time to provide this information. I guess I thought some metadata, like "quality", could be accessed directly from an Image instance but as you have shown, it's easy enough to new-up an ImageSizer object. Thank you!
    1 point
  15. @heldercervantes Depends very much on the server setup. Sometimes files/folders are owned by the Apache process, but when you upload via FTP they are owned by your FTP account. One way to sometimes get around this is to upload files via cPanel or whatever rather than FTP. Perhaps your hosting company can chown (change owner) all the site files for you.
    1 point
  16. Setting the correct user/group for your files should solve this issue. It sounds like uploading via ftp didn't do that.
    1 point
  17. What delay? It's working fine, thanks!
    1 point
  18. Sorry for the delay - got distracted by other things. Please check out the latest version - as I mentioned, you can now match a user to the homepage so they'll have access to the entire tree.
    1 point
  19. Sorry to bother you again I wanted to add an editor without superuser role, and if I set "No Access" and didn't specify a branch parent for this user, he sees nothing. First I thought setting a branch parent to Home works, but it doesn't. Setting another page is OK though. Perhaps it would be reasonable to add a module setting for "Excluded roles", which won't be included in the branch restrictions?
    1 point
  20. I think Robin S is right. It would be nice if this behavior was pointed out in the docs.
    1 point
  21. Yup, just delete that field from the DB and it should be fine again.
    1 point
  22. Thanks. Probably the easiest thing for me is to put: $user->of(true); in my templates' auto-prepended init.php and then I can use the field consistently across $user and $page. (edited for clarity) Some of Ryan's comments in the old thread you linked to make it sound like having output formatting off for the user template is deliberate, but then the docs say and which make it sound like $user should be essentially the same as $page and will have outputting formatting on by default.
    1 point
  23. Probably from the ImageExtra module When it is removed from a field, that module either needs to remove these fields as I suggested, or set them to NULL = Yes as suggested by @mn-martin in that issue thread I linked to above. Perhaps you could also leave a comment to back up my claims
    1 point
  24. 1 point
  25. Can you show us a screenshot of the field_portrait table structure from PHPMyAdmin or similar? Or at least list out the fields/columns in that table.
    1 point
  26. I found a crude but apparently working solution. I ask if a certain session variable $session->secondvisit exists, which is certainly not the case in the beginning. If not, it will be created and a crude language switch starts working. if (!$session->secondvisit) { $session->secondvisit = true; $locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']); if (strpos($locale, 'de') === 0) { $user->language = 'de'; } elseif (strpos($locale, 'es') === 0) { $user->language = 'es'; } } This is standing in front of <html>. Any constructive critique welcome. For any language other than German or Spanish, the default language english will be in effect. As the language string is e.g. "de_DE", strpos returns either 0 or false. So querying simply if (strpos($locale,'de')) { ..... } will not work, because the position of 'de' in 'de_DE' is 0 and php takes a 0 for a false, if I am correct.
    1 point
  27. I believe $pages->findOne() maybe useful here also
    1 point
  28. Can't believe it's almost 2 years. Unfortunately in between 'life' happened .
    1 point
  29. Hi ottogal, Sorry for my late response. I currently don't have time to update Batcher, at least not for the next month. The module needs a rewrite because a lot changed since this was released, for example: Native support of ProcessWire's modal Make use of InputfieldSelector to build the selector strings ... I hope to update the module at the end of may, but since I don't know the release date of Pw 3 I can't promise... unless someone else takes over. Cheers
    1 point
  30. Hi, the get selector give me troubles before too. The best way to use it is with an ID as selector value: $pages->get(1234); Reading the doc's I found this: Note that $pages->get("..."); is not subject to this behavior (or access control) and "include=all" is assumed. Repeater's are actually pages that exists under the Admin menu. So a get filtered by title will return this pages too. If you need only one page use a findOne or a find with more filter's parameter's. Hope that this help's you.
    1 point
  31. Hi, i have the same issue Session: Unable to install module 'FormHelperExtra': SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fhStorage' for key 'name' this happend on my second attempt to install FormHelperExtra. On the first atempt i got the following error: "Unable to install module 'FormHelperExtra': Can't save page 0: /fhstorage/: It has no parent assigned" PW Version: 2.7.2 Php Version: 5.5.9 Here's the phpinfo() output of my localmachine where it happend (i just changed the project name) http://jsbin.com/yatexeguku/edit?output for "fhStorage" search, i have this entries in my database: PS: i just have tried to guess what's wrong. i have not build any processwire module untill yet, but might it be possible that you whant to request the admin page, to create the fhStorage page, but it's not requestable with get('/admin') ? becouse my admin page has the name "processwire":
    1 point
  32. Exactly. It would be nice to know a) how big the need really is, and b) how much work is needed to add and maintain this. I don't have anything against IIS, but it's also very unlikely that I'll ever need it either. We've already got native support for Apache, and personally I'd like to see native support for nginx too. On my list that's much higher than IIS. .. although I did specifically make the Changelog module IIS compatible, so who am I to speak
    1 point
×
×
  • Create New...