Jump to content

adrian

PW-Moderators
  • Posts

    11,097
  • Joined

  • Last visited

  • Days Won

    365

Everything posted by adrian

  1. Well you might have already sorted it out, but it's hard for us to help without seeing the section of code that contains the getRandom(). This should work: echo $testimonial_image_page->images->getRandom()->url; If it doesn't and you get the same error, then please check to make sure that the template of these pages has a field called "images".
  2. Thanks for the report - I have fixed this bug and pushed it to Github. Let me know if it works for you now. I agree with Pete about not generally wanting to have links go to ID based URLs though. My module is just meant to be an easy way to provide a shorter link, or perhaps a human readable link with the ID appended, like: http://www.mysite.com/article/this-is-the-full-title-1058/
  3. Thanks Soma, That is certainly cleaner and simpler Only thing I needed to add back in was: $f->datepicker = 3; And in case someone is wondering about the 3: https://github.com/ryancramerdesign/ProcessWire/blob/03387f8283d518e9cc405eff8f05cd6a5bf77c4c/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module#L24 const datepickerNo = 0; // no datepicker const datepickerClick = 1; // datepicker on click const datepickerInline = 2; // inline datepicker, always visible (no timepicker support) const datepickerFocus = 3; // datepicker on field focus I ended up in one of those situations where I was trying to add attributes to match the generated source of a working datetime field, rather than figuring out exactly what PW needed to set them itself. Can I blame it on the fact that it was 1 am
  4. Actually thanks to the genius of WillyC, that is pretty easy. Well I guess it's really Ryan's genius, but Willy's post has been a classic for quite some time! $pages->addHookAfter('Page::path', null, 'hookPagePath'); function hookPagePath(HookEvent $e) { $page = $e->object; $e->return = "/$page->id/"; } That will rewrite all your links, but you'll still need my module to make the links actually work. I am actually thinking this code might be a nice optional addition to my module. Of course you can put a conditional "if" to only return the id for particular templates or whatever if you need. EDIT: There actually appears to be a conflict between the two - stay tuned - I'll take another look at this tomorrow
  5. I guess I don't really know exactly what you want. That module will allow you to link to any page using its ID. Are you want to have internal links in an RTE field be ID based? If that's what you want you could create a simple text formatter module to change the links. Sorry, I am probably missing your point still. Could you explain your scenario in a little more detail. I am sure there is a way to achieve what you are looking for.
  6. Some progress. Adding: $f->attr('dateInputFormat', "Y-m-d"); $f->attr('timeInputFormat', "g:i a"); populates the time as well, but it is always 12:00 am, ignoring what is set in the value. I'll keep experimenting and report back. EDIT: Ok, I got it - you need to set the value to the unix timestamp Final code: $f = $this->modules->get("InputfieldDatetime"); $f->name = 'changes_since'; $f->label = 'Changes since'; $f->datepicker = 3; $f->attr('data-dateformat', "yy-mm-dd"); $f->attr('data-timeformat', "hh:mm:ss"); $f->attr('dateInputFormat', "Y-m-d"); $f->attr('timeInputFormat', "H:i:s"); if($form->get('changes_since')->value){ $f->attr('value', $form->get('changes_since')->value); $f->attr('data-ts', $form->get('changes_since')->value); } $f->attr('class', 'FieldtypeDatetime'); $form->add($f);
  7. Hi everyone, I am trying to add a datetime field to a process module and am having a weird problem here. This is my code: $f = $this->modules->get("InputfieldDatetime"); $f->name = 'changes_since'; $f->label = 'Changes since'; $f->datepicker = 3; $f->attr('data-dateformat', "yy-mm-dd"); $f->attr('data-timeformat', "h:mm tt"); $f->attr('value', "2014-03-13 1:45 pm"); $f->attr('class', 'FieldtypeDatetime'); $form->add($f); When this field is displayed the value is just: 2014-03-13. For some reason the time is missing. However, when I use the datetime picker a make a selection, the field is then populated with the full date and time. Not that it helps, but if I change the field type to InputfieldText, the full date time is shown when the input renders. Also, something else weird I noticed is that when I submit the form, $input->post returns the correct date and time, but $form->processInput($this->input->post); echo date("Y-m-d g:m", $form->get('changes_since')->value); returns: "2014-03-13 12:03", no matter what time I select. I think this is to do with the am/pm in the time format. If I compare the generated classes, ids, etc for this input field vs one in the admin when editing a page, they are the same so I am currently at a loss. Thanks for any help!
  8. The linked module above will let you do that: http://modules.processwire.com/modules/process-redirect-ids/ Works for either all pages, or specific templates/pages that you select.
  9. Not sure exactly what you mean here - don't know whether you wish php was actually a client side language or whether you just want to be able to test your code in the browser. If by chance it is just the latter, then one of these might help: http://sandbox.onlinephpfunctions.com/ http://phptester.net/ http://writecodeonline.com/php/ http://phpfiddle.org/ Anyone feel like porting PW to nodejs
  10. So then in your profile.php redirect you need: if(!$user->isLoggedin()) { $session->redirect('/login/?pid='.$page->id); }
  11. Thanks Raymond, I built an email template about 10 years ago (all tables and inline styles) that I am still using and remember all about Outlook's html rendering. It actually got worse from one version to the next back then. I hadn't yet seen anything on responsive options though, so thanks for those other links too!
  12. Not sure I understand, but if you want to redirect from your profile edit page back to the last page they were on, then the initial link to the profile page should include the ?pid= and then would want the same redirect code in your profile edit page to grab the page id and use that for the redirect. Does that make sense? Sorry, in a bit of a rush.
  13. I don't really understand why you want it in the foreach loop. Unless you are rendering out this menu in multiple places, there is no need to have the code in the function either. Maybe that is just my take though? Curious to hear what others think.
  14. I haven't actually read this yet, but I am intrigued, so using this as a bookmark for later http://alistapart.com/article/can-email-be-responsive
  15. Hey Martijn, It's not you - there is something wrong with either Github or Ryan's module creation code. I guess Github changed something in their API recently? I have mentioned it to him already. In the meantime you can simply edit your module's entry in the directory and manually add in the "master" before zip.
  16. Sorry I didn't actually look at mindplay's code. It might be easiest to just: echo '<li><a href="/">Home</a></li>'; before the spot where you return the output of the function. Perhaps if you are still confused so us your complete code so far.
  17. Did you make sure that basic-pages was selected as an available template in the module config settings? Take a look at the screenshot here: http://modules.processwire.com/modules/service-pages/
  18. Something like this should work: $menu_items->prepend($home); Of course this all depends on the array of pages that you are iterating through to generate your menu. And of course you need to define $home, like: $home = $pages->get("/"); Lots of options really.
  19. madalin, PW 2.4 manages themes a little differently. Unfortunately most (all?) of the third party themes have not been updated yet. Here are some instructions on how to get it to work: https://processwire.com/talk/topic/4650-new-processwire-admin-theme-on-dev-branch/?p=53671 However honestly I think you are better off sticking with the default theme at the moment - there is a lot of new functionality in there that the old themes don't support. I also know that there is a second 2.4 specific theme just around the corner, and I am sure more will follow.
  20. This is my version of Ryan's starter: $requested_pid = (int) $input->get->pid; $t = $pages->get($requested_pid)->path; if($user->isLoggedin()){ if($requested_pid == ''){ $session->redirect('/'); } else{ $session->redirect($t); } } if($input->post->username && $input->post->pass) { $username = $sanitizer->username($input->post->username); $pass = $input->post->pass; $u = $users->get($username); if($u->id && $u->tmp_pass && $u->tmp_pass === $pass) { // user logging in with tmp_pass, so change it to be their real pass $u->of(false); $u->pass = $u->tmp_pass; $u->save(); $u->of(true); } $u = $session->login($username, $pass); if($u) { // user is logged in, get rid of tmp_pass $u->of(false); $tmp_pass = $u->tmp_pass; $u->tmp_pass = ''; $u->save(); // now redirect to the profile edit page if($tmp_pass == $pass){ $session->redirect('/profile/'); } else{ $session->redirect($t); } } } // present the login form $headline = $input->post->username ? "Login failed" : "Please login"; $content = " <h2>$headline</h2> <form action='./?pid=".$requested_pid."' method='post'> <p> <label>Username <input type='text' name='username'></label> <label>Password <input type='password' name='pass'></label> </p> <input class='bluebutton' type='submit' name='login' value='Login'> </form><hr /><br /> <p><a href='/reset-pass/'>Forgot Password?</a></p> "; Then wherever you have a link to login: <a href="/logout/?pid='.$page->id.'">Login</a> Of course you can do the same with logout too. Hope that helps
  21. http://modules.processwire.com/modules/all-in-one-minify/ http://modules.processwire.com/modules/minify/ http://modules.processwire.com/modules/minify-html/
  22. +1 for the RCDefaultApp - I should have mentioned that one in my list. I find that really important too! I was tempted to use the windows maximizer, but decided I would try the Mac way - not really panning out for me There is a great article somewhere about this but I can't find it at the moment. Basically talks about people who like to have typical overlapping windows on a Mac, vs fully maximized windows on Windows and something about being better multi-taskers, or something like that. Sounds like rubbish to me
  23. This forum needs a way to spread the love to the person who really deserves it - in this case, Nico! Maybe this would help a little: https://processwire.com/talk/topic/6373-mention-system-for-the-forums/
  24. Well I don't have the recording mode done yet, but thanks to Nico we now have the ability to migrate content from a Wordpress site into PW. Firstly, this module has been renamed - now it is simply: "Migrator" https://github.com/adrianbj/ProcessMigrator so please uninstall your old one and install this new version. The module now supports 3rd party plugin modules for migrating content from other sources. The first one is: MigratorWordpress: https://github.com/NicoKnoll/MigratorWordpress Here's what it looks like in action. Not much action in that screenshot I know, but you can see how MigratorWordpress adds in a new data source option (a WordPress xml export file). There are instructions on exporting in the MigratorWordpress readme. For those of you who still have access to a WordPress site, simply run WP's built in exporter, then import the resulting xml file into Migrator. At the moment the Wordpress site needs to still be live because any embedded images are installed to PW from their full existing URL. Also if you have ideas for other plugins, please feel free to start coding If there is interest I'll write a guide defining what is required for the module to be recognized by Migrator and also about the JSON schema that is required. So please test out and let us know how things go.
  25. Perhaps this will be more affordable: http://www.adobe.com/products/creativecloud/buying-guide.html Single app - $20 / month Illustrator really is phenomenal, but if you are in need of a vector app for free, Inkscape is functional, and in a pinch try out SVGEdit.
×
×
  • Create New...