-
Posts
733 -
Joined
-
Last visited
-
Days Won
9
Everything posted by SamC
-
I spent awhile trying to create something like this via a sign in form which then created a profile etc... but I'd put money on it the module does a better job than I could have done! Can't wait to give it a spin
-
This thread has totally exceeded my expectations with some great advice in here. It's really helpful to hear from people who have experience in selling themselves effectively. On a plus note, regarding the original post, I've had a much better day today playing with wireIncludeFile() within loops and watching with glee as PW works its awesome magic. Quite the opposite to my experience yesterday.
-
Updated and working great so far. Using 3.0.62. Thanks
-
Now we're talking! This is what I'm after. Have you got any screenshots of the admin your clients might see or a video of it in action? I'll probably set up a test site on a subdomain so they can get a live demo to dispel any issues they might have with "is it as easy as wordpress...?". This is a very good point. Just because someone 'knows' wordpress, their methods will undoubtedly be different. I tried to trace a function through the default theme and ended up on a few different templates (with identical php other than a few lines), a functions file, a template functions file and multiple pages of the codex. Twas not fun.
-
Nice! I don't think I'd use this though as I wasn't keen on the distraction of the wordpress sidebar. However, I think some clients might like this. That's interesting. I'm not so sure about the unlimited businesses without a website but you're more experienced than me so I def appreciate the input. You know that, I know that, the client may be a bit more skeptical. I actually think it rather generous of me to actually care how their project does 5 years down the line. I've had plumbers that come in, bodge it up and don't give a rats a** what happens in the future. But I digress After spending all day with wordpress, I think I've decided that my best bet is to shelve that idea for now and focus on: a) why I like processwire b) why a customer would like processwire c) security/ease of theming/speed/migration ease (without renaming absolute URLs with SQL *shudder*) d) the API and ease of use for future functionality e) the high level of base functionality without the need for any plugins at all i.e. not comparing to other CMSs at all, simply being able to point out the key points on why this system would be suitable (and more). It does seem like trying to sell ice to an eskimo though. I'll learn.
-
Nope. Will it help me convince new clients?
-
Be warned, this is a bit of a ramble but interested to hear other points of view. It's not a 'I hate wordpress' post at all, we all know each project needs tools, and they are chosen depending on the project. https://www.cmscritic.com/processwire-vs-wordpress/ So, I've as looking at this old post yesterday and see a few of the regulars here getting involved I installed wordpress yesterday and have spent the best part of this morning getting to grips with some basic stuff. Anyway, I'm thumbing through the twentyseventeen theme and I can't help but be extremely confused by the whole thing. My mind is blown how overly complex it seems to display what is a big header image, with some posts under it and a sidebar. There's a 567 line functions file that does something or other. Is it a case of the theme has to support a zillion different things a user "might" do, when the processwire approach is to theme the site with exactly the requirements of a given project? Of course I don't have a lot of experience with custom themes in wordpress but I'm thinking it would take a good year or so (at least for me) to get proficient at this. Why am I doing this? Purely because (a) it's so popular and I can't avoid the possible work opportunities and (b) I have doubts that convincing people to use processwire is going to work. Mainly because I can't answer the question "who will take care of my site when you're gone". This is a legit question for a business owner and I feel this is also a big problem for a system that has a far lower userbase and (c) I'm love trying out different CMSs. i compared the UI side by side: What I liked about the above is that this is showing all 'Pages', and is listed as such. The above however also list 'Pages', because everything in processwire is a page. I think that 'Add new' should immediately popup on hover though like the way wordpress does. I can't much any point going to '/page/add/'. I also think 'Tree' should be removed entirely (when AOS module is used with 'Always show sidebar items'). The 'Page' link at the top goes to the same page and what does 'Tree' mean to a user? Off topic, but I find the Reno module awkward to use compared to the default admin theme. The accordian in the left menu requires a lot more clicking than the default theme hover/dropdown combo. However, Reno becomes a lot more useful with AOS and looks great. The actual editing process interested me as I remember wordpress being really easy to do this: This time though after using PW for a year is that there is too much distraction here. My eye wanders over to the right. The worst bit here is having to select a parent page every time you create a child page, that would pain me somewhat. I want to be able to select a parent and directly create a child (like Drupal or PW). I almost missed the 'Featured image' bit down there to the right (although it can be dragged up). Now this is nice. Very clear, a user will just move down the page, editing as they go. No need to worry about 'Parent' or 'Order' options (in WP). Another thing I notice as there doesn't seem to be any relationship to wordpress pages and posts. You can change the URL to posts to display on 'site.com/posts/my-post' but there is no 'posts' parent page. I find this quite confusing. Global categories can be set ( with a bunch of code https://stackoverflow.com/questions/16802751/multiple-custom-post-types-one-set-of-categories ) so your custom post types can use a single list of categories across the whole site. however, the categories are stored under 'Posts' in the admin bar to the left. So, in effect, they're global but don't LOOK global. Another +1 for my confusion. Custom fields (acf: repeater and repeater matrix, aka 'Flexible content field'... are only in pro version), custom post types (cpt), security (wordfence), user management (roles/permissions). I need plugins for all of those. There are plugins that do really simple stuff that cold be done in a few lines in PW. Although widgets look cool with the drag and drop, I'm not sure I'd actually want a client adding extra stuff all over the place on their site in sidebars etc. Setting image sizes, controlling image uploads are things I would expect in a CMS, not requiring extra functions to achieve. I mentioned earlier and this one is a killer for me, I hate this. I found a system that I'm productive with, it totally clicks with my brain, I can use any frameworks, any themes, make one from scratch, whatever, yet: (b) I have doubts that convincing people to use processwire is going to work. Mainly because I can't answer the question "who will take care of my site when you're gone". This is a legit question for a business owner and I feel this is also a big problem for a system that has a far lower userbase. So how do other people on the forum approach the above point? Currently looking at:
-
So what happened @nickngqs I'm really interested in this. I need to find a way to convince people too.
-
How do we emulate WordPress "post author selection" in Processwire?
SamC replied to Zahari M.'s topic in API & Templates
-
Oh dear, I think you know the answer to that question! Can I update in the admin or have to reinstall? I saw the modules manager but that isn't listed as compatible with v3.
-
@tpr maybe to do with this CSS: @media only screen and (min-width:1200px) { html.AdminThemeReno.headSticky:not(.modal) #main:not(.closed) #headline { padding-left: /*252px*/ 20px; } } @media only screen and (min-width:960px) { html.AdminThemeReno.headSticky.headStickyCompact:not(.modal) #main:not(.closed) #headline { padding-left: /*232px;*/ 20px; } html.AdminThemeReno.headSticky:not(.modal) #main:not(.closed) #headline { padding-left: /*232px;*/ 20px; } }
-
@werch I had to repost here because after reading this: https://processwire.com/docs/security/file-permissions/#potential-permissions-for-site-config.php ...it seems 444 is not actually enough either. 400 or 440 seems the way to go.
-
I tried to use it before but was so confused with it. I can't remember what I was trying to do, it was in an earlier post of mine a while back. That said, this has jogged my memory so I'll give it another shot for sure. Maybe my extra experience now will make things clearer. I know it's hailed as an extremely useful tool in PHP.
-
Yeah wireRenderFile() is awesome. I use it for random content blocks on my other site. Great to be able to pass in additional data. I got stuck in to the whys and hows right at the beginning i.e finding out this method returns a PageArray, this one returns something else. What a PageArray actually is etc. I spent a day just print_r()'ing stuff to see the structures of various get/find combos with different selectors. It helped a lot. But as you say, I'd put £££ on it that I've only scratched the surface!
-
Lol, I love it when I'm patting myself on the back and congratulating myself on my code success... and then someone comes along and shows how much easier it can be done I just keep climbing that hill. I had to modify the above but works great: <h2>Categories NEW</h2> <? // find categories that have been referenced by a blog post $categories = $pages->find("template=category-entry, blogPosts.count>0, sort=name"); ?> <?php if ($categories->count): ?> <ul class="list-unstyled"> <?php foreach ($categories as $category): ?> <li class="category"> <a href="<?= $category->url ?>"><?= $category->title ?> (<?= $category->blogPosts->count ?>)</a> </li> <?php endforeach; ?> </ul> <?php else: ?> <p>No categories yet.</p> <?php endif; ?> RE using the API: The post categories need to go on multiple pages though. Would this not go against the DRY principle? That's why I stuck it in a function. They are displayed under each post at '/blog/' and under the individual post at '/blog/my-first-post/'.
-
Maybe you can lockdown further in terms of permissions. I use: Directories: 755 Files: 644 .htaccess: 444 config.php: 444 Works for me. Whether it makes any difference is another story, I've just always done it like this. https://processwire.com/docs/security/file-permissions/#potential-permissions-for-writable-directories-and-files
-
That's a great explanation, thanks. Using the new page ref field, I managed to get a counter onto the posts pretty easy too: // category-index.php <ul class="list-unstyled"> <?php $categories = $pages->get("/categories/")->children; $categories->sort("name"); foreach ($categories as $category): // how many items are in returned PageArray $counter = count($category->blogPosts); ?> <?php // if any posts have this category selected, then render it with counter if ($counter): ?> <li class="py-1"> <a href="<?= $category->url; ?>"><?= $category->title; ?> (<?= $counter; ?>)</a> </li> <?php endif; endforeach; ?> </ul> I like this two way relationship stuff! Seem to making progress using PW so much faster than any system I used previously, it's remarkable. Got pretty much everything linking to everything else now: ...and made a little function to output the categories on each post: // _func.php /** * Render blog post categories * * @param PageArray $items * @return string * */ function renderCategories($items) { $arr = []; foreach ($items->categorySelect as $category) { array_push($arr, "<a href='$category->url'>{$category->title}</a>"); } $str = implode(" / ", $arr); if ($arr) { return "Posted in: " . $str; } } used like: // blog-entry.php <p>Posted in: <?= renderCategories($page); ?></p> And: It's the first time I've had such a great time learning a CMS. The positive vibe on this forum is a massive plus to me, keeps me motivated.
-
Hi @abdus so the new way of doing things means only relevant posts are returned as a PageArray rather than ALL blog posts (i.e. 'template=blog-entry'). This is why this method is more efficient?
-
I've installed the page fields connect module and trying to redo the above page with new code. I linked the fields, I can now see blog posts in a page ref in categories templates, and I choose categories in blog posts templates. So it's working in other words. Not 100% sure on the code to use here though: <?php namespace ProcessWire; ?> <div class="container"> <div class="row"> <?php // get PageArray of all categories $categories = $pages->get("/categories/")->children; // loop through them individually foreach ($categories as $category): ?> <?php // OLD CODE - if ($pages->count("template=blog-entry, categorySelect=$category")): ?> <?php // if single category has any values in the blogPosts page ref field - is correct?? if (count($category->blogPosts)): ?> <div class="col-4"> <h2><a href="<?= $category->url; ?>"><?= $category->title; ?></a></h2> <ul class="list-unstyled"> <?php // OLD CODE - $posts = $pages->find("template=blog-entry, categorySelect=$category, sort=-postDate, limit=2"); // The old way had to get EVERY blog post before doing anything // NEW CODE - only gets relevant blog posts to begin with // return PageArray of all items in blogPosts ref field in single category $posts = $category->blogPosts; // sort the PageArray newest first $posts->sort("-postDate"); // only want first 2 items $posts = $posts->slice(0, 2); // loop through the 2 items foreach ($posts as $post): ?> <li><a href="<?= $post->url; ?>"><?= $post->title; ?></a></li> <?= $post->summary; ?> <?php endforeach; ?> </ul> </div> <?php endif; endforeach; ?> </div> </div> Is this how you should use this? With pages->find, you sort/limit etc.. from within the selector. Running: $posts = $category->blogPosts; ...returns me a PageArray with EVERY blog post in the page reference field from that specific category i.e. all of these: Just not sure if I'm on the right track here. It works ok, but is this the way to do it? I added a bunch of comments to try and show better what I'm doing. Never had to loop or filter through a multiple page reference, only ever used a single page. I got this info from thumbing through the docs again here: http://cheatsheet.processwire.com/pagearray-wirearray/sorting-and-filtering/a-sort-property/ http://cheatsheet.processwire.com/pagearray-wirearray/getting-items/a-slice-n-limit/
-
This module was suggested by @abdus to me in another post and after giving it a whirl, it's pretty awesome! If you link one way, it makes sense for pages to be linked the other way also.
-
Thanks for all the tips. I am aware of limit @mr-fan but thanks anyway. This is just a demo for now but will start writing some real content asap. Looking forward to being able to give something back to the community. Although my guides will probably be nothing new to seasoned users, they will make it easier for people new to PW, or maybe to persuade people choosing a CMS/CMF that PW is super easy to use even for non/beginner coders. Anyway, back from work now so can continue. -EDIT- I added a Datetime field to the blog posts with no output so I can choose the post date on each one rather than use the created date i.e. I can backdate them to make it look like I've been doing this for ages... seriously though, now it shows the two latest posts per category and I can manipulate the dates better (for HTML/CSS output) from the field timestamp. I'll probably stick that in a function as the date will be displayed on multiple templates. // category-index.php <?php namespace ProcessWire; ?> <div class="container"> <div class="row"> <?php $categories = $pages->get("/categories/")->children; foreach ($categories as $category): ?> <div class="col"> <h2><a href="<?= $category->url; ?>"><?= $category->title; ?></a></h2> <ul class="list-unstyled"> <?php $posts = $pages->find("template=blog-entry, categorySelect=$category, sort=-postDate, limit=2"); foreach ($posts as $post): ?> <li><a href="<?= $post->url; ?>"><?= $post->title; ?></a></li> <?= $post->summary; ?> <?php endforeach; ?> </ul> </div> <?php endforeach; ?> </div> </div> Seems to work ok: Thanks for all the help. Maybe my first post should be "How to make a blog with processwire"...
-
Think I'm gonna need something like this for listing posts by date, thanks @ryan
-
My one 'concern' for want of a better word is the code: $posts = $pages->find("template=blog-entry, categorySelect=$category"); This is inside a foreach so does this do the find every loop or is the value in memory after the first run? This is just a demo using default bootstrap 4, just working on getting the data displayed first. Never liked the way that grid layouts do that when one column is longer. I'll most likely use something like this technique again, works really well and flows nicely:
-
So I quickly knocked this up before work. Changed path to /category-index/category-entry/ (have template files for each now) and to render the /categories/ page: // category-index.php <?php namespace ProcessWire; ?> <div class="container"> <div class="row"> <?php $categories = $pages->get("/categories/")->children; foreach ($categories as $category): ?> <div class="col"> <h2><a href="<?= $category->url; ?>"><?= $category->title; ?></a></h2> <ul class="list-unstyled"> <?php $posts = $pages->find("template=blog-entry, categorySelect=$category"); foreach ($posts as $post): ?> <li><a href="<?= $post->url; ?>"><?= $post->title; ?></a></li> <?= $post->summary; ?> <?php endforeach; ?> </ul> </div> <?php endforeach; ?> </div> </div> How is this in terms of efficiency? Like, if there were 10,000 posts. I saw code in another post, something like like: if (! $pages->count("template=blog-entry, categorySelect=$category")) continue; { // Do stuff } Is this a situation where @Robin S module would come in handy? Currently the page renders lie so: (some pages are repeated because they have multiple categories selected but this is fine)
-
Always up for trying new things! Thanks.