Jump to content

SamC

Members
  • Posts

    733
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by SamC

  1. I think this could be said of any CMS really. I have found though that the barrier to entry with PW is low, and the learning curve is steady. It's not like you get to a point then get totally stuck like I've experienced in the past. I've found knowledge of one thing leads nicely to the next. This is what keeps me interested just keep dangling that carrot.
  2. I was thinking about this field today when uploading a few images. I have it set to 2400, the theory being that it saves space when some uploaded images if untouched could be huge, like raw digital cameras files. However, I was thinking this could cause rather large problems down the line (larger than storage issues): 1) Screen resolutions going up further so 2400px is not considered large anymore. 2) The original image is required in order to resize to 3000px in a template. Seems maybe the most sensible idea is to keep an untouched copy of the original on the server for maximum flexibility in the future. I'd be interested to hear other peoples thoughts on this.
  3. I think that processwire is easier because I did exactly this comparison. Not with zero knowledge of programming, but zero knowledge of both CMSs. Tried with wordpress, got so fed up, switched to PW, made a site with everything I required in a month or so. I find the word 'easy' a bit misleading here. I found PW fitted in with my mindset a lot more than wordpress. The hierarchy, the realtionships between objects, everything makes more sense to me, therefore makes it easier understanding the API. I have no regrets at all about spending the last 15 or so months with PW I use it about once every two days. Since about 2010, I used Umbraco CMS (liked this), Drupal 7 (did the job), Craft CMS (liked this), Wordpress (tore hair out), then Processwire (love it!). Two things that stand out to me: 1) I can't give this forum and it's members enough credit for the help they have given. They are patient, very friendly, don't insult you when you ask beginner questions and you get replies so quickly. You can't even put a price on that IMHO. 2) My excitement and enthusiasm to web design has gone through the roof since starting PW because, at last, I have the confidence in being able to create whatever I want, with any design I want, using any framework (or no framework) I want. This is mainly because of (1) above. ...and @bernhard prefers making websites with processwire to flying a helicopter! Now that says how awesome it is
  4. I forgot the if statements in the input fields themselves: <input class="form-control" name="name" id="name" type="text" value="<?php if ($name) echo $name; ?>"> Now the form action works, and when filled in correctly, the redirect leaves empty fields as expected. Thanks for the suggestions, and I'm glad you got it sorted! If you find a better way of doing the forms, be sure to share them in the forum
  5. Does this work if the form is filled in correctly? This was the problem I'm struggling with: $mail = wireMail(); $mail->to($contactFormRecipient) ->from($email, $name) ->subject('Woodenfox design website form submission') ->bodyHTML($message); if ($mail->send()) { // at "/contact/" this runs $session->sent = true; $session->flashMessage = "Thanks for your message! I will get back to you shortly."; $session->redirect($pages->get($contactPageID->url)); } else { // at "/contact/#form-top" this runs, presumably because of the initial // problem of variables not persisting at this new URL $session->flashMessage = "Sorry, an error occured. Please try again."; }
  6. Yes, wasn't the best example I didn't know it was a reserved word at the time and had changed it since. @Missariella I'm with you now on your issue. I have the same with the redirect, just never noticed, works fine without it. I tried some jQuery to redirect after form submit but I'm not sure how to do this with PHP tbh. Probably need another member to chime in here. I tested by: print_r($v->data()); // Array ( [name] => Sam [email] => [message] => ) $session->flashMessage = 'Please fill out the fields correctly.'; ...then: print_r($v->data()); // no output $session->flashMessage = 'Please fill out the fields correctly.'; $session->redirect($pages->get($contactPageID)->url . "#form-top"); So I'm stuck too basically. ==EDIT== Just had a thought. Maybe you could add the sanitized values to the whitelist, then retrieve them from that when required: https://processwire.com/api/ref/input/whitelist/ I used this to remember values from a bunch of select lists which then had to be displayed after a form submit (which went to a different page).
  7. On the phone atm. My post from above doesn't store in session: // sanitize input field values $user = $sanitizer->userName($input->post->inputUsername); value="<?php echo $user; ?>" Try without session. My form is only on one page, however, the values don't remain after navigating away them back.
  8. I'll look into it further. This is a bit of an issue for me.
  9. Try putting the sanitized data as the value Looking at the input fields specifically: <input type="email" class="form-control" name="inputEmail" placeholder="Email" value="<?= $email; ?>">
  10. @Missariella I needed to do this the other day: Instead of: $session->redirect($pages->get($contactPageID)->url); I used: // above form <div id="form-top"></div> // redirect to anchor tag after submit $session->redirect($pages->get($contactPageID)->url . "#form-top"); Works great, and no need for iframe
  11. I like to use the vertical list for images at full size on the slider. I forget to fill in a description if I can't see that field and not found a way to make just this part required so at least I'd get a reminder. Anyway, I like the image nice and big: ...but every time I save the page, it reverts to a smaller image: Can anyone reproduce this? It happens to me with Reno theme and the default classic theme.
  12. Still not tried this but looking at the screencast again, it looks very promising. The problem I have found in the past with an admin bar, is that you're on an parent page, say 'services' that is just made up of child pages pulled in via a loop?. The clients may not fully understand that the whole page is made of other pages and literally has nothing directly editable on it. They click 'Edit' and go "huh?".
  13. Ok, working now, I changed the date picker to include an actual time too and tested: // blog-index.php <ul class="list-unstyled"> <?php $entries = $pages->find("template=blog-entry, sort=-postDate, limit=5"); foreach ($entries as $entry): $daysAgo = $datetime->relativeTimeStr($entry->getUnformatted("postDate")); ?> <li class="py-1"><a href="<?= $entry->url; ?>"><?= $entry->title; ?></a> - <?= $daysAgo; ?></li> <?php endforeach; ?> </ul> ...and: Gotta start checking that API reference more often.
  14. Thanks @abdus Found it now: https://processwire.com/api/ref/datetime/relative-time-str/ I'll give it a shot.
  15. I'd love that to see that mockup in action, looks so simple and pleasing to the eye.
  16. @svsmailus you don't particularly need deep working knowledge of PHP. The API is really simple to use. I came into this with almost zero knowledge of PHP (but a basic knowledge of general programming principles), a year later and I'm doing some really cool things. Not as cool as some of the guys here but this isn't a competition, they are very generous here with sharing the knowledge. In my opinion, if you want to progress in any CMS, this forum is the place to be. Processwire has allowed me to do things in the one year that took me much longer to achieve with the convoluted and plugin dependant ways of other CMS systems, including Drupal 7 & Wordpress. My templates output exactly the HTML I want and no more and querying the database is so simple. This in turn has saved me a bunch of time with the CSS as I don't have to style out classes chosen by the plugin developers thus being able to reuse code a lot easier across multiple sites. In regards to hosting, after changing a few times over the years, I use 'Kualo' now. They have been absolutely outstanding for support and the live chat is great. If you're anything like me, that is, very curious, like to ask a lot of questions and are keen to learn, then there's nothing stopping you! I am also working on a blog with a bunch of basic tutorials for people right at the beginning like yourself, hoping to go live within a couple of weeks (once I have some more content). Good luck ==EDIT== p.s. welcome to the forum!
  17. I'm trying to put a timestamp next to posts to show how long ago they were published. Is there something obvious I'm missing here as the only times I seem to be able to get are 'Today', 'Yesterday' and 3+ days ago, never '2 days ago'. <ul class="list-unstyled"> <?php $entries = $pages->find("template=blog-entry, sort=-postDate, limit=5"); foreach ($entries as $entry): $timeStampNow = $datetime->date($format = "ts"); // postDate is a Datetime field on the blog-entry template $timeStampPostDate = $entry->getUnformatted("postDate"); $difference = $timeStampNow - $timeStampPostDate; if ($difference < 86400) { $daysAgo = "Today"; } else if ($difference > 86400 && $difference < (86400 * 2)) { $daysAgo = "Yesterday"; } else { $daysAgo = date("j", $difference) . " days ago"; } ?> <li class="py-1"><a href="<?= $entry->url; ?>"><?= $entry->title; ?></a> - <?= $daysAgo; ?></li> <?php endforeach; ?> </ul> Maybe I'm not taking into consideration the actual time of day they were posted, maybe the code above does work, but I've never been able to output '2 days ago' thus far. Any advice would be awesome, thanks. [BASICS] [DETAILS] [INPUT] [OUTPUT]
  18. I've been using bootstrap for the last three sites. However, I'm not getting on with the lack of mixins so I thought I'd give uikit 3 another go with the many hooks available. Thanks for the tips @AndZyk
  19. That's quite a good idea, thanks for the tip.
  20. @gmclelland yeah sorry, I should have mentioned i haven't installed this so haven't seen the module options. I also forgot to mention that I love the colour palette, very tasteful. This is some great news, thanks
  21. ^ I like this a lot. The same reason as I liked the reno theme, the sensibly used horizontal space. My first reaction was: I just tried the demo here: https://processwire.com/blog/posts/uikit-3-admin-theme-updates/#Comment41064 And clicking on the big P logo did indeed open a sidebar, but on the right. Now I couldn't use this at all, clicking on the left, and then having to drag the mouse over to the other side of the screen... however, it may be possible for it to open on the left instead. A logo means 'Home' to pretty much every internet user on the planet. I would not expect in a million years for it to open a sidebar and I'm baffled by this design choice. Another bugbear of mine is having a scrollbar in a weird position. I am so used to it being on the edge of the window, having it further in is super annoying and the added tree here is for, I'm not really sure why it's here actually. I chose to edit the 'Home' page, what do I need the tree for? ...so the first thing I would do with this theme would be to lose that bar on the right. I'm editing a page, I don't need to see the tree, but: ...the scrollbar is still inset unfortunately. I'd lose this sidebar feature completely, i don't see how it adds value to the editing experience other than to distract. My ideal would be something simpler, like this (badly cropped, edited and joined) with options not repeated as much in a top bar and a sidebar: (Yes, it takes inspiration from the WP interface) ======================================= Now I don't intend for this to be one huge moaning session, the new theme certainly looks funky, so great work and thanks for the hard work on that! However, in terms of usability (especially for clients that aren't computer savvy who will be confused by things flying in all over the place), I'd personally stick with Reno with the fixed sidebar and all options shown:
  22. I do this in my 'main.php' file to include a bunch of other stuff in order to keep it small. Works fine, never had a problem with the paths. Excuse the poor annotations. My templates also all have... <?php namespace ProcessWire; ?> ...at the top too so I don't lose the scope of functions in '_func.php' (which is prepended to 'main.php'). One of the functions for example is called in '_top-bar.php' file and without the namespace you get a undefined function warning which confused the hell out of me at first. As mentioned, you can also use wireIncludeFile(), but with this approach, if you can also pass additional information into the template which is great within loops! Stuff like: I pass the current loops page object ID into the '_card.php' file which can include stuff like this: // _card.php <?php namespace ProcessWire; // $pageId in first loop os 1101, $pageId in second is 1103 $entry = $pages->get($pageId); ?> <div class="card <?= $entry->name; ?>"> <p>The title of the page which has been passed to me is <?= $entry->title; ?></p> </div> Would probably make more sense if you did some experimenting but give it a shot. Good luck
  23. Thanks @abdus it does work after all, seems I needed to check my code a bit closer, the redirect only happens when the form is filled in successfully. Been testing it for the last half hour with empty fields, doh!
  24. I just tried the following, I created a file 'chmod.php': <?php chmod(".htaccess", 0644); // nothing lower would work here chmod("site/config.php", 0400); // this seems ok echo 'Completed' ?> ...uploaded it into my root via filezilla, went to mysite.com/chmod.php. Back to filezilla, deleted the file. site/config.php is now 400. .htaccess is now 644 (nothing lower than this would work in my environment).
  25. On a contact form which is on the bottom of a page, when submitted, the page redirects to itself, but of course goes back up to the top of the page. Been trying to find a way to go to: // go to <div id="form-top"></div> site.com/contact#form-top ...but I always end up at /contact/. Tried a few things along these lines but don't seem to be getting anywhere: $contactPageID = "1022"; // ... $redirectUrl = $pages->get($contactPageID)->url . "#form-top"; $session->redirect($redirectUrl); // still goes to mysite.com/contact/ Any help would be great, thanks.
×
×
  • Create New...