Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/10/2012 in all areas

  1. Nate, welcome to the forums and thanks for the suggestion. It is something that pops up every now and then and certainly something to think about. I think only thing that makes template languages more newbie friendly is that those fail silently. Forgot ending ?> from <?php and whole site won't load. This single thing might be big obstacle for someone who is just starting. What comes to echoing variables and making simple if statements or foreach loops - I don't think that any template language is much easier than PHP. I have only used EE tags, Smarty and tried Laravel's Blade, so I don't know too much of those.
    1 point
  2. Not evangelical at all, as I'm not even an experienced programmer. I only learned PHP in the past few months, and I can say it was mostly because of the way PW is thought out. As a Designer I never thought I would be writing some rather advanced PHP so soon, but because PW uses PHP instead of a templating engine, and because it's designed to make it so easy for anyone to achieve basic tasks, you just feel encouraged to go further and further without any constraints. Really, just start building a website with PW without thinking of external tools, you don't even need to install any of the excellent custom modules that are already available, and you will see how easy it is and how powerful it can get
    1 point
  3. Hi diogo, Thanks for the welcoming! I forgot this topic could possibly lead to a "evangelical" debate :/ With that said, I'm glad PW has taken a stance on this one way or another. I haven't taken the time to dive into the PW templates yet so, yes, Ryan's points may very well be sound and your comment about " it easy for anyone with no PHP skills to learn and use" might also be as well. I will say that Ryan's article touches on Smarty and to be fair that's a template engine of yesterday as far as I'm concerned unless something has changed in Smarty 3 (also debatable I'm sure.)
    1 point
  4. The page fieldtype refers to the page object itself, and not the id. So this should work: $news = $pages->find("template=news-post, news_section=$page, limit=5");
    1 point
  5. How about a module repository -- and code that allows PW installations to scan the repository for new modules & updates?
    1 point
  6. The best thing I've had fun playing with recently is chaining in PW, and it's worth knowing about. Here's a good, slightly abstract example: On a large communal news website, an Article page has a PageField called Author - this links to the Author's page. The Author works for a Company - there might be several authors in that company writing on this website and you might be curious and want to find out various things like the following (pretend we're on the article page still): // Let's find all articles by this author: $author_articles = $pages->find("template=article,author=$page->author"); // Let's get the company name that this author works for - going through a few pages to get this one - from the article to the the author' page then the company page - all using the incredibly powerful PageField field type echo $page->author->company->title; // Ridiculously simple huh? // Now let's grab a list of other authors from this company - not sure why you would, but you could (the authors are all PW users in this case, so the template is 'users') $company_authors = $pages->find("template=user,company=$page->author->company"); // And finally let's get a list of all articles written by all authors in this company using $company_authors above $company_articles = $pages->find("template=article,author=$company_authors"); Now some people might wonder how the last one works - surely $company_authors is an object or array right? Well if you run a simple echo on it, it doesn't spit it's dummy out like PHP normally would, but rather gives you a concatenated list of page IDs in the format: 123|124|1024|456 - the pipe character is used in the last $page->find to mean "OR" so it works perfectly. And this is why I keep getting excited whenever I work with ProcessWire. I would need literally dozens of lines of code to recreate that example in any other CMS I can think of. I pulled in the articles and authors by template, but there are various ways of doing it and I just did it with template names as that didn't assume any particular site structure, so it's not necessary to follow that exactly. Have fun!
    1 point
×
×
  • Create New...