Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/13/2016 in all areas

  1. Version 3.0.18 continues from last week, making major upgrades to our images field. This week we got into some of the finer details, and we've got plenty for you to look at here, as well as a screencast (at the end) to demonstrate it all. https://processwire.com/blog/posts/more-images-upgrades/
    11 points
  2. Awesome update! But one feature request: Optional disable crops with flexible widths & heights' and enable crop sizes from 'presets'.
    5 points
  3. I do not use PW's form markup at all but Nette Form elements. Renderer is easy to customize, eg. $required_asterix = Html::el('sup')->setClass('asterix')->setText('*'); $colon = Html::el('span')->setClass('colon')->setText(':'); $renderer->wrappers['form']['container'] = 'div class="form-wrapper"'; $renderer->wrappers['controls']['container'] = 'div'; $renderer->wrappers['control']['container'] = 'div'; $renderer->wrappers['control']['description'] = 'p class="form-description"'; $renderer->wrappers['error']['container'] = 'ul class="help-block text-danger form-error"'; $renderer->wrappers['label']['suffix'] = $colon; $renderer->wrappers['label']['requiredsuffix'] = $required_asterix; As I wrote modifying the markup this way is well enough for simpler forms, and even for larger forms if there are no fancy things. Here is a quick screencap where I used manual rendering, which allows custom markup. Form fields are defined separately, and you can retrieve the full control, or only the label or control, error parts, etc. I like the freedom it gives. <div class="form-wrapper" n:if="$rsvpForm"> <fieldset> <legend><span><strong>Personal data</strong></span></legend> <p class="checkbox-wrap"> {$rsvpForm[participation_toggle]->getControlPart()} <label for="cf_participation_toggle">We attend the wedding</label> <span class="slideToggle">{$rsvpForm[participation_toggle]->getLabelPart()}<strong></strong></span> <label for="cf_participation_toggle">Unfotunately we cannot attend the wedding</label> </p> <div id="personal_data"> <div> <div class="input-wrap">{$rsvpForm['name']->control->cols(35)} {$rsvpForm['name']->error}</div> <div class="input-wrap">{$rsvpForm['email']->control->cols(35)} {$rsvpForm['email']->error}</div> <div class="input-wrap">{$rsvpForm['phone']->control->cols(35)} {$rsvpForm['phone']->error}</div> </div> </div> </fieldset> ...
    3 points
  4. If you're using that file with prepend/appendTemplateFile and you're rendering multiple pages in a single request (e.g. by using $page->render()), then this is expected behavior. At least since the introduction of init.php/ready.php using prepend/appendTemplateFile is not the correct place for any class instantiations or global variable invocations. Do this in init/ready.php and leave prepend/appendTemplateFile for anything that's part of your page rendering process, e.g. wrapping the body markup in the html skeleton or alike.
    3 points
  5. Disclosure and probably explanation: t3n started as "Typo3 News", https://web.archive.org/web/20051217050007/http://www.t3n.de/
    3 points
  6. Even though I really don't know Renobird or LostKobrakai I would still like to extend a word of thanks for their hard work and the time they put in to make things happen and get stuff done. Congratulations on the roll out. Nicely done.
    3 points
  7. Another post on t3n using processwire as an example of why classic CMS aren't always the best choice. (And as expected: Immediately random Typo3 fanboys with no pw experience whatsoever popping up and start hatin'. Business as usual).
    3 points
  8. It's probably not as feature rich, but I really like nette forms, where I can define validation rules for both client side and server side at once. The library is so nice to include a simple js file, to handle client side validation, which is additionally quite easy to enhance / change to ones specific needs.
    2 points
  9. @Bill C, getting familiar with Tracy would have taken less time than writing your post
    2 points
  10. https://processwire.com/talk/topic/8406-set-multiple-templates-role-access/?p=81711
    2 points
  11. Since you are playing around with mod_security settings, I would also try disabling it completely to see if that helps. Maybe also check to see if the server is running suhosin and disable that as well. If it works then you can work backwards to figure out what settings are needed.
    2 points
  12. Hello and welcome to the forum, Is it possible that your template files use relative URLs? If so, the simplest fix might be to add the base tag to all pages: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base eg: <base href="<?= $config->urls->templates ?>"> which should resolve to: <base href="/localhost/restaurant/release/site/templates/"> or you can edit all your code to use something like: <link rel="stylesheet" href="<?= $config->urls->templates ?>styles/main.css"/> Hope this helps. EDIT: the example base tag does not include the protocol. EDIT 2: you probably do not use relative URLs So option two should be the way to go....
    2 points
  13. Sounds good, but just so you know, Tracy can also log errors and dump variables to the console in both Firefox and Chrome. And on that note, there is also soma's Chrome PHP Logger: http://modules.processwire.com/modules/chrome-php-logger/
    2 points
  14. hi am*, welcome to the forum. one thing to add may be that you REALLY have to invest time in planning your site structure. that's one of the most important parts when building sites with processwire. as everything is a page and every page has it's very own place to live! if you did your homework here, seemingly complex tasks can get surprisingly easy. like in this example (https://processwire.com/talk/topic/13183-adopt-field-values-as-defaults-from-parents/): blynx built a module to inherit field values from parent pages, whereas in your template file you could just do this: $foo = $page->closest("foo!=''")->foo so you have to organise everything in a strict hierarchical structure - the pw page tree. i would recommend you to do some test projects (https://processwire.com/docs/tutorials/hello-worlds/) and then share your planned site structure with the community. you will always find a helping hand here
    2 points
  15. Just a quick update on the above in case anyone else runs into problems with this. Having had the solution work for most sites, today I had a persistent "unrecognised HTTP host" message even though config module was uninstalled congig settings were correct caches were cleared etc As soon as I fired up the same site Admin in a different browser, the issue disappeared and I could publish roles etc. In this case it was Google Chromes cache caching my old config files. Over and out !
    2 points
  16. support plain text string and string with html tag function _t($text, $context = 'general', $textdomain = '/site/templates/_strings.php') { return html_entity_decode(_x($text, $context, $textdomain)); }
    2 points
  17. In addition to @teppo and @szabesz, there are more usecases what are currently seems not to be covered well. I must admit that I first also have thought that we need the list view too. But now, after playing around a few times in the last two or three weeks (with an unofficial beta, thanks to @Lostkobrakai) I'm not even torn. I have learned to live without the listview. Usecases that are not well covered atm, for example are image rows with 20 motives that all look the same, where you need the filename, and I mean the filename of all files at once. What I come up and tested (in context of the croppableimages extension) for this are two things: one can toggle visibility of filenames over the thumbs using a little textbox for filtering by filename This is even faster than looking through an endless list of filenames. Another usecase sometimes may be to directly see the aspect ratios of all images at once, not a nice looking centered cropped square. But you will not get that WOW-effect with a visually cluttered grid, also covered with filenames all over. So IMO it depends on the usecases and the user preferences: As you also can see in the second screen, media queries are respected. This isn't what I have done, this is already in the new core imagesfield! (@szabesz: there must be a glitch somehow with your device / version) I simply have extended the new core image field and was able to use comfortable supported hooks from the core field. Here seems to be all usecases already covered on the developers side! Conclusion: with every newly introduced thing, first part is a confrontation with no more able to behave the same as before (we, the users / developers) (sorry for maybe long and bad describing words, but I think you get it) Phase two should be to find some time, play around and try out that new thing, and if you find a usecase that isn't covered well now, don't simply say we need to implement the old way here for that. I personally think I'm oldschooled in many things and also not a friend of often changing things, but I'm so happy that I have had the chance to get my hands that early to the new imagesfield and in addition also found the time to play around with it! As one result, now I have improved my own behave / workflow in some usecases and are also able to give my clients a very well looking edit page, so that they can see and say: WOW! EDIT: and sorry if it looks that I shamelessly promote the croppable extension here. The new core imagesfield from @Renobird and @Lostkobrakai allone is responsible for all the ongoing new things. I wouldn't have done anything without it and also simply wouldn't be able to do things like I now could do. This all depends on the core imagefield. Most things what I have done to adapt the croppablefield with it, was to strip out great parts from the PW2 version so that all the design and magical stuff is delegated / handled from the core imagefield.
    2 points
  18. Hi, I just made this module because I needed it. GitHub: https://github.com/blynx/AdoptDefaultsFromParents Module Directory: http://modules.processwire.com/modules/adopt-defaults-from-parents/ What it does: It fills fields of newly added pages with corresponding field-values of their parents. Configurable by setting "giving templates" and "adopting fields". Configuration: You have to set templates which are able to give field values and fields which are able to receive values. Then, this module automatically applies field values to every newly added page from their parents according to those settings. Also you can switch between immediate or closest parent (@LostKobrakai, thanks for the hint!) Why: I am building a little webshop with padloper and made some product categories ("parent page") which have some properties which should be automatically descendable to their children. Yet, the children should be able to have individual values if they want to. Now: So far it works for me - but please test it out and if you think improvements can be made, tell me about it. Also, what do you think about the general idea? Notes: So far I haven't tested it with more complex fields, yet. So far tested and working: Integer Text Page Similar fields should work. The module simply copies the field value. cheers! UPDATES v003 - 10.5.2016 Added option to switch between immediate or closest parent
    2 points
  19. I'm using almost the same setup, but my "t" function handles context too. The good thing is that _strings.php can be copied to your next projects too. function t($text, $context = 'General', $textdomain = '/site/templates/_strings.php') { return _x($text, $context, $textdomain); } _strings.php: // Search _x('Search site', 'Search'); _x('No matches', 'Search'); // Forms _x('From', 'Forms'); _x('From email', 'Forms'); _x('To', 'Forms'); ...
    2 points
  20. I don't normally like wysiwyg web editors or any other similar tools out there but I stumbled upon Pinegrow and I have to say wow. It is useful in so many ways. Description from Pinegrows: 'a desktop app that lets you build responsive websites faster with live multi-page editing, CSS styling and smart components for Bootstrap, Foundation, AngularJS and other frameworks.' Check out the video below for a quick introductory look at it: Just wanted to share this with anyone that thinks this can help their workflow.
    1 point
  21. I just wanted to share a small module I just made, that can inherit values from pages, that are higher up in the page tree. This inheritance will only show for formatted output, so for example in listers or in the frontend. When using the unformatted value one will see, if a field is really set or not. <?php class FieldtypeInheritInteger extends FieldtypeInteger { public static function getModuleInfo() { return array( 'title' => 'Inherit Integer', 'version' => 101, 'summary' => 'If empty tries to get values of the same field from further above the pagetree. This does only work for formatted values so empty values won\'t ne overwritten by editing a page.' ); } public function ___formatValue(Page $page, Field $field, $value) { if(!$this->isEmptyValue($field, $value)) return $value; $parent = $page->parent("$field!=''"); if($parent->id) return $parent->getFormatted($field); else return $value; } public function ___markupValue(Page $page, Field $field, $value = null, $property = '') { return $this->___formatValue($page, $field, $value); } }
    1 point
  22. Hello @ all, I am using the following js-framework to validate my frontend forms: http://formvalidation.io/ My goal is to check if username and password match via Ajax, so the customer will see immediately if the entered values are correct or not. For this reason I have included the following js snippet inside the template with the login form. <?php $ajaxlogin = $pages->get("template=jsonlogin"); $ajaxloginurl = $ajaxlogin->httpUrl; ?> <script> $(document).ready(function() { $('#mainlogin-form').formValidation({ framework: 'bootstrap', icon: { valid: 'fa fa-check', invalid: 'fa fa-remove', validating: 'fa fa-refresh fa-spin' }, fields: { user: { verbose: false, validators: { notEmpty: { message: '<?php echo _t('Username missing! Please enter your username', 'Login');?>' }, different: { field: 'pass', message: 'The username and password cannot be the same as each other' }, } }, pass: { verbose: false, validators: { notEmpty: { message: '<?php echo _t('Password missing! Please enter your password', 'Login');?>' }, different: { field: 'user', message: 'The username and password cannot be the same as each other' }, remote: { url: '<?php echo $ajaxloginurl;?>', data: function(validator) { return { user: $('[name="user"]').val(), pass: $('[name="pass"]').val() }; }, message: 'Dont match' } } } } }); }); </script> This script should send the values of the fields user and pass to the backend (json file). Field username = user, field password = pass. The backend file looks like this: <?php //check if password and username match $match = true; $username = $input->get['user']; $pass = $input->get['pass']; $u = $users->get($username); //check if userid and password/temp password match if (($u->id && ($u->pass == $pass)) OR ($u->id && ($u->tmp_pass == $pass))){ $match = true; } else { $match = false; } // Finally, return a JSON echo json_encode(array( 'valid' => $match, )); ?> It should return true if both values match and false if not. In this case the username check works as standalone, but the combination of username and password match not. I can also not check if the password is in the db as standalone - this is probably a reason that it is not stored as a standard value. So I guess the problem could be in the jsonfile and not in the js file. It would be great if a user also uses this validation framework and can help me out. Here is another link that probably can help: http://stackoverflow.com/questions/27143058/bootstrap-validator-send-all-input-field-values-to-remote-php-file Thanks in advance
    1 point
  23. You might need to switch to PageTable or something similar. You are hitting the limits of what a Repeater is capable of. People often run into this issue, see for example: https://processwire.com/talk/topic/13089-repeater-field-limits-and-server-timeouts/ Not long ago I even posted a request in the Wishlist topic section: https://processwire.com/talk/topic/13112-the-possibility-to-specify-a-maximum-item-limit-for-a-repeater-field/
    1 point
  24. Thank you sooooo much! And +1 for Martijn's request
    1 point
  25. This is what you have to love about ProcessWire. Fantastic release last week, some feedback from users, then an even better release 7 days later. 2 small requests from me. Tooltips/titles for the icons for the different views. Reset to default for the slider. Keep up the great work team.
    1 point
  26. I haven't gone that far and I really hope I never need to
    1 point
  27. I added this small tweak to the FieldType, which allows me to use the Ace extended for my code editing.. if(wire('modules')->get('InputfieldAceExtended')) { $f = $this->modules->get('InputfieldAceExtended'); $f->mode = "php"; $f->theme = "monokai"; } else { $f = $this->modules->get('InputfieldTextarea'); }
    1 point
  28. Well you can dynamically build your form too, eg. if($user->hasRole('role_name')) { $form->addTextarea('result_to_see', _t('What is the result you would like to see?', 'Form'), 50, 3) ->setRequired(_t('Required field', 'Form')) ->setOption('character-counter', array('mode' => 'down', 'msg' => _t('%d characters left', 'Form'))) ->setAttribute('data-autosize') ->setAttribute('maxlength', 500); } $preferences = array( 'trial' => 'I would prefer to start with a small trial project to see how we can work together.', 'resolve' => 'I have a specific inquiry, and just want this issue to get resolved.', 'best-roi' => 'I want to go big. Let’s see how we can achieve the best return on investment overall.' ); if($something) { $preferences['anotherItem'] = 'Anther radio button'; } $form->addRadioList('preferences', _t('Please set the preference that best suits you', 'Form'), $preferences) ->setRequired(_t('Required field', 'Form')); echo $form; But you see what fits better for your project.
    1 point
  29. Hahaha.. good one! I'll move it up on the list then Thanks Adrian! Appreciate the tip. Have a good one. Hi. Word has it you'do be much happier with the Tracy debugger, but sure if you'd like the code I'll write something up and get it to you. Thanks.
    1 point
  30. for reference: adrian's template setup batcher can save you time
    1 point
  31. Aah, did we intend to post a link to the module maybe?
    1 point
  32. I have put Tracy Debugger on my list of things to look over soon. In the meantime I just use Xdebug usually. Depends on what I'm doing. I got burnt big time the other day by throwing a quickie echo statement in a piece of code which in turn messed up an Ajax call which in turn screwed up the Admin Page tree. LoL. So I took a very simple wrapper class I wrote to help with debugging. It's a simple wrapper for the FirePhp class. I took it and created a quick and dirty PW module out of it. So everything goes to the Firebug console in Firefox. The code is just taking the array passed to it and doing var_exports on each element in the array. It can also be used to call Firebug's trace function. Nothing fancy, crude, I know. I reinvented the wheel there but it didn't take very long to do. I had the code already more or less. I think it would have taken longer to uses someone else's and get familiar with it. Sample code for using it: $module = $wire->modules->get("FirePhpBC"); $t1=55.12; $module->fireLog(array('Joe',$t1)); $module->trace("i`m here."); And lastly, more preaching to the choir with this wiki article https://en.wikipedia.org/wiki/Defensive_programming 'Defensive programming' I think it is part science, part gut feel. I think the same holds true for debugging. I think you can get a little obsessive with defensive coding and waste a lot of time checking for ghosts. The article mentions this also. Like everything else, it only helps if you put it to practice. Obviously .. better code... fewer bugs. And another thing I try to avoid is writing large chunks of code without testing and I also try to modularize and reuse..'Separation of Concerns' . Again.. preaching to the choir. Anyway.. enough .. I'm trying to keep my posts to a reasonable limit. lol. Have a good one..
    1 point
  33. Check also if the limitation is not on the FB API side. I remember that I had to do the same with youtube, but YT allowed me to call a limited amount of videos on the same request.
    1 point
  34. I was hoping for something more like Lister (rows, columns, sorting) but with thumbnails. It just seems like information is being obscured in order to have a more front-end kind of design. Casting my vote for... A way to see all the image filenames clearly, not truncated and supered over an image. A way to see how they are tagged & described without having to drill into each one. Thumbnails with same aspect ratio as the original image (cropped to square is the visual equivalent of all caps)
    1 point
  35. Hi Mischa Just wanted to chime in here in case this is a question coming from your client. I don't know of any instances of PW being hacked but the reality is probably nothing is un-hackable. It all depends on the ambition and resources of the hacker Vs the robustness of the platform. I'm not trying to scare you here but when my client asks me "if PW has ever been hacked" it's good to set expectations. Unless you specifically wish to get into a situation where you're responsible for security, then don't be accountable for that. if Microsoft, Sony, US Government still get hacked with a security budget of (probably) millions and a security team outnumbering yours, then it tends to illustrate that any online platform has the potential to be hacked. A thorough and regular backup agreement is your best asset here so at least if you do get hacked, you have some type of salvageable website until you identify the source of the hack. Hacks can come in the form of hosting vulnerabilities, poor password storage practices, hacks via 3rd party modules or scripts, database exploits etc etc If any of these were targeted and your site was down, to your client it would all amount to the same thing "PW has been hacked". The reality is, a hacked PW site might be completely unrelated to PW and security. Just for the record, I believe PW has an extremely positive security record More importantly, I imagine if anything was found, there would be a very fast response from Ryan and Co.
    1 point
  36. I wouldn't touch that if I were you. No need to. ProcessWire already has got you covered. You could probably get away with less than 10 lines of code..Something as simple as...OK...before that, let's break this down. Server-side processing: is probably easier than client-side processing. The former is easier (IMO), because PW has got you covered...Throw some PW API in your template file and you are sorted. You only need to send back data in the format requested by the client, in this case DataTables is the client. Client-side: would have been a bit more difficult (for me...because I find PHP easier than JavaScript ). However, in this particular case, we are covered. DataTables does all the heavy lifting. All we need to do is to give it data in the format and structure it has requested. Requesting data: First, the JavaScript needed to request data (i.e. the client requesting data from the server)..Straight from the DataTables example $(document).ready(function() { $('#example').DataTable( {// the ID of your HTML table "processing": true, "serverSide": true, "ajax": "scripts/server_processing.php"// this is the only thing to change RE ProcessWire(template file) } ); } ); Nothing fancy in that code. The value passed to the ajax property is the important thing here. In ProcessWire, we won't be able to access a PHP file directly like that (see forum posts about this). We have two choices. Either, post to self (./) - notice the dot, or post to an existing PW page. So... $(document).ready(function() { $('#example').DataTable( { "processing": true, "serverSide": true, "ajax": "./"// posting to self (i.e. the current page) //"ajax": "/ajax-handler/"// posting to a ProcessWire page titled Ajax Handler that lives off the root } ); } ); Process ajax request: In the template file of the 'page' or the 'ajax-handler' page, depending on the value set to 'ajax' in the JS above, you will have code like so, ready to receive ajax requests..@see if($config->ajax) { // here we are listening to ajax requests sent to this page /* 1. listen (could be POST or GET. in the DataTables example, it is using GET 2. Check and sanitize required parameters 3. Kosher? Send back data in the format requested, i.e. JSON. Otherwise, ignore, show error or tell them to take a hike */ } // output HTML as usual => e.g. @see the HTML tab in the DataTables SSP example OK, the fun part. Fire-up Firebug and go to the 'Console' Tab. Visit the DataTables SSP page and watch the Console. Have a look at: Params tab: DataTables has sent a long request. Most of the stuff we will not need. The key here is to match the parameters to their corresponding ProcessWire terms, i.e. limit, sort and start. That's all we need. This is basically pagination. So, let's match stuff we need for pagination... DT => PW start => start length => limit sort // @note: index-based naming, where 0=first DataTables table column. // In this case, the value is 5 (i.e. the last column in the SSP example = salary) order[0][column] 5 => sort (sort will correspond to whatever property in your selector, e.g. title, some_text_field, etc) order[0][dir] asc => sort order in ProcessWire. if asc, do nothing, if desc then sort becomes -sort So, we get our data as normal in ProcessWire. Note, this code goes within the if($config->ajax){} condition... // @note: here you sanitize inputs + could do some other logic, e.g. check if input present, etc $start = (int) $input->get->start; $limit = (int) $input->get->length; $sort = $sanitizer->name(?)// @this is your homework; how to get to the order[0][column] and order[0][dir] values. ;-) {dir here is direction, btw} $data = $pages->find("template=basic-page, start=$start, limit=$limit, sort=$sort"); if(count($data)) // { // need to send back data with some extras to DataTables // @hint: have a look at the structure of the JSON. // @continued below... } else //error message, nothing found Next, have a look at either the 'Response' or 'JSON' tabs. That is what the server has sent back. The most important thing to note is that that was originally an array on the server (built from our $data above with some extras...). Let's build this next. if($config->ajax) { // @note: this is built from the $data above /* @note: as per the JSON tab in Firebug we need to send back 4 'things' to DataTables. 1. draw (int): I thought corresponds to the page number but seems to increment: I'll let you find out 2. recordsTotal: Number of records found 3. recordsFiltered: I haven't checked what this is 4. data: The ProcessWire find results */ // to get the total number of records: $total = $data->getTotal(); $dataDT = array();// we'll send this back to DataTables as JSON $data['draw'] = $whateverDrawIs;// could be $limit = $data->getLimit(); $data['recordsTotal'] = $total; $data['recordsFiltered'] = $whateverThisMeans; // prepare values to send back that match your DataTables table headers foreach ($data as $d) { $dataDT[] = array($d->title, $d->name, $d->id, $d->parent->title, $d->template->name);// each record } // send data back to client in JSON format (@see the JSON tab in Firebug) header("Content-type: application/json"); echo json_encode($dataDT); }// end if ajax And that's it Written quickly in browser, got carried away...there could be errors, blah blah, the usual disclaimers
    1 point
  37. Sorry if that came across the wrong way - I am just always in awe of how great you guys are at being multilingual. It was meant to be a compliment! I know a little travel Spanish and it seems so hard to get beyond that. I also remember a teenage German asking me questions about English grammar and I didn't know the answer - I think unfortunately those of us who are from English speaking countries typically don't get the same grounding in languages and their rules - we just know what sounds right without knowing why. That's why in some ways you probably do have a better grasp of English and how it works. And it's such a bastard language with all these weird exceptions to rules - I don't know how anyone ever learns it!
    1 point
  38. Well I guess you have no idea how much effort is put even in simpler replies if you're not a native English speaker
    1 point
  39. I always think of ProcessWire as complete PHP framework bundled with integrated browser based content management tools (hundreds of tools, actually). ProcessWire should be listed here: https://en.wikipedia.org/wiki/Comparison_of_web_frameworks#PHP You do not even have to use the CMS if you don't want to, but why reinvent the wheel?
    1 point
  40. 1 point
  41. I don't really see what we're missing feature-wise here either, but that being said, I do have to admit that originally I was under the impression that this was going to be a replacement for the old grid view (which never made much sense to me, especially considering how it lacked so many features), not both the grid and the list view. The thing is that I too would prefer list view in some cases: especially when the images are intended to be displayed on the front-end as a list, it would make sense that they're displayed as a list in the back-end too The screenshot above displays two obvious use cases that could be handled better: backgrounds for transparent images (use a grid, not solid colour, just like we did for the old image field) and narrow fields (instead of trying to cram everything side-by-side, in some cases it would make sense to have the image on the top and other elements below it). Additionally this UI doesn't make as much sense for the single-image use cases as it does for galleries and such. In my opinion it would be good to have the option of disabling the buttons on a field-by-field basis. Additionally it feels a bit awkward that even though there's only one image, one still has to click to see the edit fields; though this might be a question of preference, it's also one of the cases where the old list view made more sense to me. That being said, this is a great update, so big thanks to everyone involved. I'm sure we can iron out the glitches and improve the usability of the field in some situations now that the new field is in the core. It's typical that some additional requirements only arise after a feature is in wider use
    1 point
  42. Just a note, closest() isn't even needed here, because we already know the current page doesn't have a value for foo. ->parents("foo!=''") will do the same excluding the current page from the possible resultset. It's rather this where closest() shines. $foo = $page->closest("foo!=''")->foo
    1 point
  43. @laban, sorry didn't spot your question earlier. But here's the answer. // DOM is ready $(function () { // field with the name attribute title $("[name='title']").truncate({ characters: 55, prefix: '', suffix: ' character(s)' }); // field with the name attribute an-other-field $("[name='an-other-field']").truncate({ characters: 160, prefix: '', suffix: ' character(s)' }); });
    1 point
  44. Fixing the config is universally a good thing
    1 point
  45. $t->flags = Template::flagSystemOverride; $t->flags = 0; // etc... save here or delete $t->save();
    1 point
  46. Tracy Debugger for ProcessWire: https://processwire.com/talk/topic/12208-tracy-debugger/
    1 point
  47. I use a similar solution to a _strings.php file, and include it from my _init.php file (prependTemplateFile), so that it's available to all templates. But I bundle all the translated values into a new function (which I'll call _t(), but you could name it whatever you want). So you can call upon that _t() function anywhere that you'd call a __() function. For instance, in your /site/templates/_strings.php file... function _t($label) { static $labels = null; if($labels === null) $labels = array( 'Yes' => __('Yes'), 'No' => __('No'), 'Maybe' => __('Maybe'), 'And so on...' => __('And so on...') ); return isset($labels[$label]) ? $labels[$label] : $label; } From there, you can replace any __('label') call with _t('label'). In this manner, you only need to translate your _strings.php file, and all the other template files can use the translated labels. For the cases where you need to translate text that only exists in a particular file, then you'd continue to use the __() function as usual.
    1 point
  48. Pinegrow is really powerful, I'm using it till a few months for building basic template structures. You can even use it with your editor of choice, every change is updated live (this also can be turned off). It's a bit similar to ›Webflow‹, but it's a standalone app and supports standard-frameworks (Bootstrap, Foundation, …) which is a big plus. I think Webflow is at its current state an interesting way for designing prototypes in the first place. (if you don't mind working in the cloud)
    1 point
  49. Really? I got frustrated in 5 minutes. Though it might be that I tested with my laptop. Seems to require huge screen.
    1 point
  50. I know this thread is old, but with the new Log viewer that Ryan just set up, I have started putting the following just before the body close tag (in main.inc or foot.inc or wherever needed so it is on all pages): if($user->isSuperuser()) echo '<iframe width="100%" height="200px" src="'.$config->urls->admin.'/setup/logs/view/debug/?modal=1"></iframe>'; Then whenever I need to log a variable or output of a function etc, I use the following in my template file: $log->save('debug', $problem_variable); If you need to output an array, json_encode is quite a nice solution: $log->save('debug', json_encode($array)); This will give you (as superuser) a panel showing the "debug" log output (which shows latest entries at the top) at the bottom of your site - very handy
    1 point
×
×
  • Create New...