Jump to content

Jan Romero

Members
  • Posts

    680
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Jan Romero

  1. I’m not familiar with Sublime Text, but this seems to be a problem of both your phone and Sublime Text not honoring Unicode guidelines (check this out), albeit in different ways. Sublime Text doesn’t show you the problematic character at all and your mobile browser shows a missing glyph symbol. Try viewing your code sample from the first post on your phone. You’ll see the same rectangle right behind the closing PHP tag ?>. Sublime Text should have a view mode that shows invisible white space characters (like tabs, spaces, and your 2028 separator). If you turn that on, you should be able to delete it easily You have run into the same issue as this guy. That is to say, it’s not ProcessWire inserting the symbol
  2. This one has always annoyed me too. I still find myself middle-clicking page titles in page tree and page list, trying to open multiple edit tabs. Then when I’m done they’re all just page trees…
  3. You have a unicode line separator (U+2028, E2 80 A8) between ?> and </ul>, but your main problem is using Android If you switch your editor to ANSI, it will show up as 
. Obviously, that doesn’t belong there. Just remove it and you’re good
  4. ProcessPageEdit::buildForm returns an InputfieldForm element. So you want to hook after it’s done creating the form using addHookAfter. Then you can get the form element like so: $form = $event->return; Now all you can modify it to your heart’s content. To get the submit button, I think you can simply do $submitbutton = $form->get('submit_save'); Sorry, no copypastable code. I’m on mobile.
  5. I’ve recently had these symptoms after migrating to a different host. Turned out to be a memory shortage when resizing images. You said you checked all the image files. Did you see if there were any corrupted size variations by any chance? Does the problem also affect pages that already have all the necessary variations (or have no images at all)? Have you checked the site’s logs?
  6. This has apparently been disabled because the circular reference lead to problems: https://github.com/ryancramerdesign/ProcessWire/issues/663 One possible solution for you would be to default to $page if no page is selected. Seems intuitive enough for the user, unless you need “no selection” to actually mean “no selection”. Another thing you could do would be to add a “proxy” page somewhere, called “<This Page>”, and check if that was selected, then use $page.
  7. Passwords aren’t stored as plain text in the DB, so that shouldn’t be an issue. If one is worried about leading/trailing whitespace, one might as well disallow that specifically, or routinely trim passwords (and tell the user about it). Plus, we deal with spaces in POST data all the time anyway?! Even this forum allows spaces in usernames, which kind of blew my mind the first time I logged in. I really dig it. I’m a big proponent of long passwords and I feel, calling them “passwords” instead of “pass phrases” was a major mistake, leading to the stupid password policies we see everywhere, when in reality, the best thing you can do is just have a long-ass combination. Personal sentences are great for this. Easily typed, because that’s what we’re used to type, and easy to remember, because unlike cryptic alphanumeric combinations with an obligatory exclamation point at the end, they make sense even without thinking up mnemonics first…
  8. Hi, a draft should be created automatically when editing a page, unless you are a superuser and/or have the permission “managedrafts”. If you see the new page in the admin menu, you're allowed to edit pages without having to make a draft first, so you're not redirected. Try logging in as a less privileged user. I'm doing a little overhaul at the moment, putting the draft relations into the database and adding a couple of things here and there. If you have any suggestions for the admin side, I'm all ears, because I'm not really using it that way, so I have no real direction..
  9. It is thanks to Horst. http://modules.processwire.com/modules/page-tree-add-new-childs-reverse/
  10. Hey man. That’s a huge post and I don’t have a lot of time, but I have a feeling correcting the array keys in $form will fix a bunch of it. For example: mail($emailTo, $subject, $message, "From: $form[email]"); The error message you get refers to the $form part. See what's wrong? email isn’t a thing. You have to give it a string as a key You have the same issue every time you refer to the $form array. Just put quotation marks around it and you’re almost there. The next thing is that the keys you try to access are not the ones you set here: $form = array( 'Nom complet ' => $sanitizer->text($input->post->fullname), 'E-mail ' => $sanitizer->email($input->post->email), 'Message ' => $sanitizer->textarea($input->post->comments), ); So you have to decide whether you want to use $form['Nom complet '] or $form['fullname'], $form['E-Mail '] or $form['email'], etc. Also, watch out for those spaces. They should work fine, if you want to go with those keys, but they’re pretty ugly. Disclaimer: I haven’t read your full post yet :< Edit: By the way, I'm not sure, but it might be that this will not parse correctly: "From: $form['email']" I suspect PHP might stop reading the variable after $form. For better control over complex variables inside literals, you can use curly braces like so: "From: {$form['email']}"
  11. So with your current structure, Folder1 appears under two separate urls. Once under root, and once under /folder1/. To do this in ProcessWire, you can keep the page structure the same way you have shown, with Folder1, Folder2 and Folder3 as children of the frontpage. They are still “neighbors”, or siblings as PW calls them (you can get a page’s siblings by calling $page->siblings()). Since you don’t want to have a dedicated frontpage, you would create a special template for the frontpage and either redirect it to /folder1/, or render Folder1 right there: <?php echo $page->child->render(); //child gets the first child. //this is the entire template. The redirect would work like so: <?php $session->redirect($page->child); //if you put any code here, it will //not be executed. The first option would be more like what you have now, where the frontpage simply mirrors its first child. You can use the same template for other “category” pages, where you don’t need an overview page, but want to go directly to the first item. For completeness’ sake, this would be the full page tree (just add Home at the top): HomeFolder1Page1 Page2 Page3 Folder2Page1 Page2 Page3 Folder3Page1 Page2 Page3 When you think about it, ProcessWire’s approach makes the most sense anyway. Url paths describe a tree, so it’s only natural that there must be a root page.
  12. Yeah, that’s true. It works in Ryan’s example at the beginning of the thread because he calls isLoggedin() before overwriting the $user variable with a normal string (strings in php are indeed different from objects). So, confusingly, in that example $user refers to different things at separate times. He should probably edit the post for posterity.
  13. That’s how callbacks work, but I believe LostKobrakai can’t use a standard callback, because his requests will be asynchronous. So the callback would get executed as soon as all requests have been made, but it won’t wait for the actual responses. For that he’ll have to use events. So either pool the events of the request objects and fire your own event when all are done, or have a single function handling all requests and executing the callback upon completion. @diogo hehe, I’m glad you got that reference %) @Mike Anthony that’s brilliant! I’ll have to save that link
  14. Fun fact about SVGs: Internet Explorer will not scale <img> SVGs properly if they don’t have the viewBox attribute. I’m not sure if it was Inkscape or the optimizer I used, but my SVGs were missing this, and I had to edit it in for IE: width="1024" height="512" viewBox="0 0 1024 512" Without viewBox, the image would remain 1024x512 in IE, but it won’t scale it down and clip it to the <img> tag’s dimensions instead.
  15. Feel like you left out the most interesting parts there It sounds like you’re not using jQuery, but if you did, Ajax requests would return Deferred objects that expose done events. You could then use $.when to bind these Deferreds together into a single Deferred that fires such an event once for the entire queue, once all “inner” Deferreds have finished. I recently had to wrap my head around this. Voodoo is an apt description. I think in vanilla JS (I hope this is not the name of some JS library ) you would create an XMLHttpRequest object for each request, whose onreadystatechange events you handle in one function. There you could naively count the successes in a global variable and do your thing once you have all of them. So it kinda depends on what the requests look like and what events you can subscribe to. The requests should run in parallel if you simply send() them one after the other, i. e. the program will not wait for the server response until it executes the next request.
  16. I love all of those, but I can’t help but notice how the dignified feel of Eat-Drink-Royal is undermined by the neglected typography. Consider installing SuperSmartypants if you have no control over the texts. Here’s a comparison of the original and two versions with curly quotes and hairspaces: Gotta love that her name is Quayle. It’s far too rare that typefaces get to show off a capital Q, arguably one of the most beautiful characters in any font.
  17. The log will be in /site/assets/logs/errors.txt, or in the setup tab in the admin on newer dev-branch installations.
  18. That’s in the module settings for the core module ProcessField /processwire/module/edit?name=ProcessField
  19. What input type are you using? PageListSelect won’t allow custom selectors or custom PHP code. The Autocomplete input type doesn’t support custom code either. If you put return $page->children; as the custom php, it should totally work.
  20. I updated my post above. Apparently you need a closing php tag at the top, so it doesn’t expect php code. Disclaimer: I have only tested this with a PW and module version from about a year ago.
  21. You need to echo the html markup within your outer php tags as strings. Or you can probably just get rid of the outer php tags. <?php echo '<div class="row fullWidth img">'; echo ' <img src="' . $config->urls->templates . 'img/header.jpg" alt="header-picture">'; echo '</div>'; ?> <!-- OR simply: --> ?> //just a closing tag here <div class="row fullWidth img"> <img src="<?php echo $config->urls->templates; ?>img/header.jpg" alt="header-picture"> </div>
  22. Sure it’s possible. I’d love to see a more page-field-like PageTable, actually. Here is a (really, seriously) half-assed module that lets you add a page to a PageTable field. Be aware, when you remove your page from the field, it will trash the entire page just like the standard PageTable does. Do NOT use this anywhere but in a testing environment. It also has a hard coded template that you shoult probably change to whatever your PageTable accepts. $this->addHookAfter('InputfieldPageTable::render', $this, 'PageTableRender'); public function PageTableRender($event) { $pageTable = $event->object; $out = "<select name='{$pageTable->name}_addcustom'>"; $pages = $this->pages->find('template=PAGETABLETEMPLATE'); //change this foreach ($pages as $p) { $out .= "<option value='{$p->id}'>{$p->title}</option>"; } $out .= '</select>'; $out .= "<script> $(document).ready(function(){ $('select[name=\"{$pageTable->name}_addcustom\"]').change(addPage); function addPage() { var input = $('input[name=\"{$pageTable->name}\"]'); var container = input.siblings('.InputfieldPageTableContainer'); var dataurl = container.attr('data-url'); var pageid = $('select[name=\"{$pageTable->name}_addcustom\"]').val(); var ajaxURL = dataurl + '&InputfieldPageTableAdd=' + pageid; $.get(ajaxURL, function(data){ container.html(data); container.effect('highlight', 1000); }); alert('wtf did you do'); } }); </script>"; $event->return .= $out; } As you can see, the heavy lifting in the PageTable field is done via Ajax. Maybe it’s a starting point. I really need to go to bed
  23. The same disclaimer applies to me, obviously, but you may also want to hook into execute() in ProcessLogin, or, if you’re using the dev version, create your own alternative ProcessLogin. It’s used as an example on the blog.
  24. This is a great feature you can use to achieve what you want. It basically allows you to generate multiple versions of markup for the same template. There are of course more ways of doing something like this, but render options and partial template files will take you very far, with very clean code.
×
×
  • Create New...