Jump to content

Newbie overwhelmed...


Grays

Recommended Posts

Hi guys,

I've been spending the past couple days trying to get myself acquainted with PW... and I find myself swaying between excitement and discouragement. I'm excited because I'm really loving the way PW works but discouraged because I can't help but feel that I'm in way over my head. I'm not sure if this is in part because I still haven't reached the "AHA!" moment, but I'm also just very frustrated with my own lack of PHP knowledge (it's even less than I originally thought - at this moment, I think I'm completely PHP illiterate).

Now, I really don't want to give up on PW, so I come here in hopes that someone can help point me towards the best way to approach "learning beyond the basics". I've gone through the various tutorials in the wiki and followed the Basic Website Tutorial as well, felt like I have a decent general grasp of things. Then I decided to upload and take a look at the blog profile. It had a lot of features I'm looking to implement, so I thought it would be good to see how things are done and make changes where necessary... except I think I ended up getting overwhelmed by it. Simply put, I can't make heads or tails out of a lot (most) of the PHP coding I see in the template files - never mind adapt it to the site I want to build!

So, I've got a few questions. For someone who isn't a developer, would you say that jumping in and trying to take the Blog Profile apart is a bad idea? Is that considered advanced territory? Should I have just tried to build everything from scratch and add in the extra features step by step? Though, I'm not even sure how I would go about doing that, to be honest.

I'm just lost. The basic stuff, I can grasp... like if I were to build a "static" site with various sections and some content, I can do that with PW at this point. The problem is, I think, the more advanced parts - as in, where and how to grow from the basics. I don't know where to even begin to tackle things, especially when it comes to specific customization. For example, I could probably copy and paste code for implementing comments... but then because I can't even understand what I'm copying or how to code PHP, I don't know how to make little changes, like say if I want to make it so that admin comments are styled differently, or if I want to load up Gravatar if one exists and if not then a default avatar, etc. Stuff like that.

I'm sorry if this sounds like I'm just rambling randomly... it's just that I think I'm stuck at that point between being able to do the basic stuff but not having a single idea as to how to grow beyond that - short of going off to take some intensive PHP courses or something.

So I guess my bottom line question is, how doable is PW for someone who doesn't know any PHP (and isn't just going to build a basic site with some content)? Am I better off not jumping into the deep end without at least knowing some PHP first? I've mostly built sites on ExpressionEngine and a bit of Textpattern in the past, so landing in pages of PHP code makes me feel like a foreigner in a strange country. :undecided:

And while I'm here, may I just quickly ask what the difference between $page and $pages is? The Basic Website Tutorial mentioned it a bit, but I'm not sure I truly understand when to use which... and what it means when pulling content from the page or another page?

I sincerely apologize for my newbie whining...

  • Like 4
Link to comment
Share on other sites

I would say that the blog profile is not the best place to start. It uses more advanced techniques and was designed to be a demonstration of them– These are techniques I don't even use in my own site development, but felt like we needed a profile that would appeal to those looking for a dedicated MVC strategy. The best place to start really is the basic profile that comes with ProcessWire. When you understand that, you really can build anything. If you are wanting to go further, you might like to look at the skyscrapers profile. But the important thing to remember is that there is no "right" way to build your site in PW. This is why even tutorials can be a mixed blessing when you are learning, because they reflect one approach that may not necessary be the right one for you. 

Beyond the basic profile, you just need to read $page, $pagesPageArray and about Template files. Ignore everything else, because you may never need it. Don't feel like you need to remember or understand everything on those pages. But read through them and make note of what's there. These pages cover 99% of what you will do in ProcessWire from the code side… and probably a lot you won't ever use too. Once you get going and developing stuff, you'll want to keep the Cheatsheet open, which has sections that cover what's on those links above more succinctly. 

In ProcessWire, you should be comfortable with HTML markup and CSS. But it's less important that you know PHP.  You only need to learn a few basics. You really don't need to know any more than you need to know EE tags. 

  • Know how to get in and out of PHP from HTML markup. i.e. <?php ... ?> 
  • Know what a $variable is – just a place to store a value. Most ProcessWire API functions return a value.
  • Know how to use an if() statement. In PW, you'd use an if() to test if something had a value you wanted to output.
  • Know how to use a foreach(). In PW, you'd use a foreach() to cycle through a page's children, or the results of a $pages->find(...).
  • Know how to output a value, whether: <?php echo $value; ?> or <?=$value?> …both do the same thing. 
  • Know how to use include() to include another file, i.e. "<?php include("./header.inc"); ?>

I think that covers all you would have to know to do most things from the PHP side in ProcessWire. Can anyone think of anything major I'm missing?

Lastly, when you are developing, enable debug mode in /site/config.php:

$config->debug = true; 

This will ensure that you get helpful error messages rather than ambiguous ones. 

  • Like 20
Link to comment
Share on other sites

Ok, starting from the end. Put very roughly, $page represents a single page while $pages represents all pages. The methods from $page http://processwire.com/api/cheatsheet/#page can be applied to any object that represents a single page.

$page, when used simply like this, represents the page that called the current template (usually by being viewed in the browser), but the $page methods can be applied to any Page object (other pages, even if they didn't call the current template).

How do we get all those pages that are not represented directly by the variable $page? You guessed, using $pages http://processwire.com/api/cheatsheet/#pages

$otherPage = $pages->get("/about/");

The get() method of $pages, returns always only one page. Meaning that $otherPage, is now an object equivalent to $page. Because of this, you can apply to it all the methods and call all properties of the object $page:

echo $otherPage->id;

While get() returns a single page, find() returns an array of pages, to be more precise a PageArray, and to those arrays you can apply any of the PageArray methods and call it's properties http://processwire.com/api/cheatsheet/#wirearray

$pagesList = $pages->find("template=basic-page");
$pagesList->shuffle();

//same as:
$pagesList = $pages->find("template=basic-page")->shuffle();

and because $pagesList is now a list with lots of $page equivalents inside it, you can go to each one individually and apply the same methods and call the same properties as with $page:

foreach($pagesList as $individualPage){
    echo $individualPage->id;
}

Disclaimers:

I did an over simplification of the terms (same as in the cheatsheet). To make it clear:

$page is a variable that holds a Page object that represents the current page. The methods I keep referring and that are on the cheatsheet, are in reality methods of Page objects, and not $page itself. The same applies to $pages and Pages.

I must have some errors there because I'm far from a PHP specialist (even less concerning OOP).

edit: Ryan, I saw that you answered before me, but I think to the first part. I will read now :)

  • Like 9
Link to comment
Share on other sites

 Should I have just tried to build everything from scratch and add in the extra features step by step?

Not sure. I consider myself to be not very firm with PHP, either. In fact, I have stated on numerous occasions that my PHP knowledge resembles the faculty of speech of a toddler. I never bothered to check out out said profiles/tutorials (because they didn't exist when I first checked out PW), I just started to build an older, smaller site. Maybe it helps that I'm firm with jQuery, after which the PW API is tailored. Along the way, I searched the forums, the API docs and asked very stupid questions. That's how I got to know the basic solutions, the “how to do XY in PW”s, if you will. You definitely do not need to be a PHP wizard to build (basic, at least) sites with PW.

 I don't know where to even begin to tackle things, especially when it comes to specific customization.

Sounds as if you're trying to take on too many things at a time. Try to relax and address one issue at a time. Don't hesitate to ask questions here – as long as you've searched forums and API docs and tried to understand it, no one here will bite your head off for asking questions.

Most important of all: it is fun to work with PW. Try to have some fun.  :-)

 what the difference between $page and $pages is?

Well, very basically said, $page is the “currently addressed” page, and $pages is an array (something similar to a list) of pages in your site. You can “modify” that list of pages by using selectors to “limit” the selection of pages you would like to work with.

  • Like 4
Link to comment
Share on other sites

Grays I went through the same cycle as you and in case it helps at all all I will say is that using the default site that PW comes with and reading this forum and the links the others here have posted gradually got my PHP+PW engine started and even though it's only a low capacity engine (to stretch a metaphor) it is a very happy and productive one. That is to say I am *extremely* glad I found and persevered with PW and PHP because with the help of the generous people here and the great product PW is, I have been able to fly up and away from my old 'stuck' CMS to where I am now where I feel I could tackle almost anything with a little planning and QnA on the forum.

So I'm sorry this post of mine won't help you practically but I hope it helps you feel that you will be able to do as I have (and likely more and better) and end up having a superb tool in your tool belt for future website work.

  • Like 5
Link to comment
Share on other sites

Much is already said here by pro´s. All I can add to it is that you should stick to PW even if all the api and php can be intimidating and make you look back for a more easy cms. Why you should stick to PW ? Because it will pay off in having total freedom to make a website in any way you want or see fit for you needs. You don´t want to go back anymore to an easy out of the box cms but with all it´s limitations. I have repeated Joss tutorial basic website many times only to get familiar replacing content between html tags with php tags and api calls. After that you start experimenting making your own template files with your own php code and api calls. A good way is to make first a general html page with a top navigation bar, some text, pictures, and a footer, all with plane html, js and css. Then you replicate this page with a template file and fields in PW and start replacing content between html tags with php and api calls. That´s how I learn my self deeper into PW. One very important thing that I haven´t found much about yet is how to make PW´s front end (the fields ?) very easy for clients. Clients want to edit/update their website as easy as possible. It´s funny but almost all cms'es start with explaining how you can do a-b-c- and x-y-z but never they start first explaining how easy the front end is and how clients and end users can do a-b-c and x-y-z on the frontend to update their website. And yet clients are king and not us who make websites for them.

First thing I would like to know is how to make "setup" - "modules" - "access" disappear in the frontend but keep it on the backend. Same with making disappear for pages "view" - "new" - "move" - "delete" - "copy" on the frontend but keep it on the backend.

  • Like 1
Link to comment
Share on other sites

What Ryan says is completely true, my knowledge of PHP is simple, but i've built some interesting/complex things using only the basics listed, and the fact that you can build almost anything using only those basics and the cheatsheet is the strength of it's underlying design.

With PW, i think it's more about how you can visualize the relationship between your content in the backend and how you will output that in the front..so more like creative thinking, problem solving... it is for this reason that processwire is so much fun as @yellowled points out, because you find yourself being inventive and coming up with cool ideas that no other CMS would 'provoke'...

it's nice to finally be able to say to clients "yes that can be done"

  • Like 2
Link to comment
Share on other sites

With PW, i think it's more about how you can visualize the relationship between your content in the backend and how you will output that in the front..so more like creative thinking, problem solving...

Exactly. All the potential is there in PW that´s why we love it. But it takes time and practise (for a newbie) with php and api, controllers, view, model, class, etc. - to become self creative with all that potential.

Link to comment
Share on other sites

I would say that the blog profile is not the best place to start. It uses more advanced techniques and was designed to be a demonstration of them– These are techniques I don't even use in my own site development, but felt like we needed a profile that would appeal to those looking for a dedicated MVC strategy. The best place to start really is the basic profile that comes with ProcessWire. When you understand that, you really can build anything. If you are wanting to go further, you might like to look at the skyscrapers profile. But the important thing to remember is that there is no "right" way to build your site in PW. This is why even tutorials can be a mixed blessing when you are learning, because they reflect one approach that may not necessary be the right one for you.

Ah, I've generally learned best/fastest from examples, deciphering the bits and such, hence me trying to pick apart the Blog Profile. Seems I was trying to fly before knowing how to walk! I shall revert back to the basic site and go from there once more as you have advised.

Having "no right way" to build a site is actually one of the reasons I like PW, because I enjoy the freedom of being able to build sites the way I designed them (which was also one of the reasons why I was drawn to EE back in the days). So I do take the tutorials as they're meant to be taken... which, I think, is what led me here. I find myself stuck trying to take things "out of the box" so to speak because I don't know how to code any of it. I hope I'm making sense...

But, Ryan, thank you so much for listing all those things I should take a look at. It's exactly what I need at this point - a direction to head towards, because I didn't even know where to begin and how much I'm supposed to "know" in regards to PHP. Looks like I'll be doing lots of reading shortly. :)

By the way, in your example for outputting a value, is it generally more recommended to use the shorthand (is that the right term?) of coding or the full <?php echo $value; ?> and so on? I think I've been seeing bits of both throughout the forum and code bits, so it was something I was curious about. I figured it was just a shorter way to code the same thing, but are there any pros/cons of using one or the other and can the shorthand(?) be used everywhere? Just want to make sure I adopt the best practice right from the start!

Sounds as if you're trying to take on too many things at a time. Try to relax and address one issue at a time. Don't hesitate to ask questions here – as long as you've searched forums and API docs and tried to understand it, no one here will bite your head off for asking questions.

You may be right. As mentioned to Ryan above, I'm likely trying to fly before knowing how to walk properly. Part of the reason is because I'm also currently trying to convert a site built on EE over to PW, so I keep thinking ahead even though I really should be going at it slower instead of stressing myself out.

I do have to admit that I'm hesitant to ask stuff in the forum right now, because I feel a bit like a headless chicken running around. I'd either be asking about every single little stupid thing or it'd be a case of not even knowing where to begin searching for what I need. I tend to try and work things out myself, so this is a point of frustration for me because I feel like I'm so stuck right now and not even knowing what specific thing to ask to get unsuck.

Oh and thanks for the explanation in regards to page/pages. And to diogo too. I think I'll be heading over to the areas Ryan pointed out to familiarize myself a bit more on what I need to know and perhaps things will start to click in place. :)

(Btw, yellowled, I actually know more PHP than I do JQuery, so that might tell you something about how lost I am...)

Thanks all! I'm feeling a bit more, err, pumped up about jumping back in. You guys are awesome.

EDIT: Holy, just saw that there were more replies. Will go read them and reply accordingly in a bit.

EDIT 2: Um, I meant "to get unstuck"... and not unsuck. But I suppose unsuck works too. :rolleyes:

  • Like 2
Link to comment
Share on other sites

...

By the way, in your example for outputting a value, is it generally more recommended to use the shorthand (is that the right term?) of coding or the full <?php echo $value; ?> and so on? I think I've been seeing bits of both throughout the forum and code bits, so it was something I was curious about. I figured it was just a shorter way to code the same thing, but are there any pros/cons of using one or the other and can the shorthand(?) be used everywhere? Just want to make sure I adopt the best practice right from the start!

see this post and the following 5-6 for some pros and cons

...

I do have to admit that I'm hesitant to ask stuff in the forum right now, because I feel a bit like a headless chicken running around. I'd either be asking about every single little stupid thing ...

you shouldn't hesitate, have a look to some of the old foxes and younger (but also well known) foxes around here. :)

  • Like 2
Link to comment
Share on other sites

horst, thanks for the helpful link on shorthand - I suppose I best stick with the complex. They feel easier for me to comprehend too somehow...

As for asking questions, I get the feeling I might become the next annoying person on the block. I promise I'll do lots of good reading, searching, and trials of my own before I bother you lot!

So I'm sorry this post of mine won't help you practically but I hope it helps you feel that you will be able to do as I have (and likely more and better) and end up having a superb tool in your tool belt for future website work.

It helps much more than you think! I admit to feeling a bit intimidated because I was starting to wonder if PW wasn't suited for someone like me, but I'm comforted in knowing (and hoping) that perhaps it isn't so out of reach for me to be able to produce something more than the very basic site from PW (especially since I know that PW can do so much more).

Much is already said here by pro´s. All I can add to it is that you should stick to PW even if all the api and php can be intimidating and make you look back for a more easy cms. Why you should stick to PW ? Because it will pay off in having total freedom to make a website in any way you want or see fit for you needs. You don´t want to go back anymore to an easy out of the box cms but with all it´s limitations.

Exactly why I'm still sticking around. :P That and I'm kind of stubborn when I'm trying to figure something out. Thanks for sharing how you went about learning your way into PW - it helps gives me an idea of the steps I can also take. The frontend problem you mention is probably something to consider, but I think I'll worry about that last! For now, I'm adapting my own sites first, so at least, that's one less worry for the moment...

With PW, i think it's more about how you can visualize the relationship between your content in the backend and how you will output that in the front..so more like creative thinking, problem solving... it is for this reason that processwire is so much fun as @yellowled points out, because you find yourself being inventive and coming up with cool ideas that no other CMS would 'provoke'...

I'm probably visualizing a bit too much and not doing enough of the outputting part, lol. But yes, this is probably another thing I should really try to do as I'm still not completely in tuned with PW's way of doing things yet. I can't wait for the moment to kick in - and for the fun to begin.

Anyhow, thanks again all! I'm really glad I decided to unload my woes upon the forum, even at the risk of major whining.  :-[  I've gone off to read some basic PHP intro stuff, look up the terms Ryan mentioned, along with a few others... and I think something is slowly sinking in somewhere. Then I think I'll tackle some of the docs and get to work. If any of you have any other stuff I should take a look at, please do point the way. Or you can always slap me upside the head for being melodramatic if it turns out my main problem is impatience...

Link to comment
Share on other sites

As for asking questions, I get the feeling I might become the next annoying person on the block. I promise I'll do lots of good reading, searching, and trials of my own before I bother you lot!

I think only way to know how to improve documentation and make the PW more friendly for beginners is that you new guys keep asking questions. So nothing to worry about.

Good example of that is latest docs Ryan wrote about image field. "Multiple images vs single image" issue has come up numerous times up on forums and now it is clearly written right from the beginning of that page.

  • Like 1
Link to comment
Share on other sites

Also wanted to say Grays that if you've liked EE in the past,  chances are you are in the right place. I never liked the big three but I was a big fan of EE. In the end I've found that PW is like the good bits of EE, improved and with none of the downsides.

The concept of being free to design first, knowing that the tool won't get in the way is something you'll be glad of every day :)

And yes, I'm the annoying guy Horst mentions ;)

  • Like 1
Link to comment
Share on other sites

@Grays, do not feel alone. I too am new to ProcessWire and still trying to put things together. Although I have been working with WordPress for a few years now and have spent many hours trying to hack the default ways of it, I still consider myself very green when it comes to php.  I have went through each tutorial on here and read them twice. I then just started building in my local environment,  I built 4 simple demo sites as reference libraries in 24 hours. I also am trying to just learn the in's and out's of the framework. I am looking forward to working/learning with it and will keep an eye out for your questions as I am sure I will have the similar ones.  :rolleyes:

With that said, my opinion is to just dig in and build.

  • Like 1
Link to comment
Share on other sites

I happened to run across this today and thought I would share. I don't know your level of understanding for basic programming, but I sometimes like to revisit the basics. Although php is not used here, its the same concept. The instructor here makes it very interesting with her enthusiasm, that is actually entertaining. I hope someone just starting out may find it useful. Here is the link

  • Like 1
Link to comment
Share on other sites

@Grays just wanted to say too, that you are not alone, I am a newbie to. And this thread is cool because it just gave me a little bit of encouragement that I need to go into the PW, because before that I was like banging my head in the wall to get through it :) It looks like to many of us newbies, PW looks a little bit scary, when you want first get into the details how it works, a bit intimidating... but after a while, you see that it is not scary at all.

I am on mostly on Joomla now for about 3-4 years. I could build a lot of things there. And I always had in my mind how I achieved something in Joomla and how I would achieve it in PW. And the more I get into the PW the more I see it is a piece of cake comparing to Joomla, even though Joomla is quite easy CMS.

But you got to get a little bit dirty hands using PHP. But not much though, just as much as you want to get some custom output, but that are simple brackets of code, nothing much. That for me wasn't quite an issue, because if I wanted so specific output in Joomla, I also had to customize PHP code in there. And you don't really mess with the code in Joomla, if you really don't know what you are doing.

If you go through the wiki, see tutorials etc. it will help you to understand PW quite soon.

But I have another question about PW. For developing totally custom applications/extensions, maybe parse some data from other site or whatever, you should need to build new module. I reckon modules are extensions to PW. It is said that PW is CMF (Content management framework), that shows when you use it's API. But is it also any kind of framework for PHP, that comes in handy, when developing custom applications? Such as is Codeigniter or CakePHP?

I know that this is a bit offtopic, and sorry for that.

Link to comment
Share on other sites

What any newbie should do first is learn Drupal.

After 2 years of:

  • awful theming, i.e. $element['#object']->field_video_embed['und'][0]['value'] instead of $page->field_video_embed
  • searching through 500 line arrays to find out what module is injecting a certain markup in your code
  • writing huge css files to deal with the divs nested within divs nested within divs nested within divs
  • figuring out how to add a meta tag to your <head> using an API and an array
  • getting carpal tunnel syndrome from constantly clearing the cache because Drupal is such a hog, everything has to be cached
  • learning the Views module, a point and click interface that is 3X more annoying and difficult than learning and using straight SQL
  • find a good host that is beefy enough to deal with the Drupal and has advanced caching capability
After that, PW will be a walk in the park.
  • Like 11
Link to comment
Share on other sites

I see you've asked that last question over here franci: http://processwire.com/talk/topic/3311-is-pw-a-framework/ - just a heads up for anyone responding to answer there instead since it's a different topic :)

Thanks Pete, just about to post the same thing here, but you beat me to it. :P

First I asked this question here, but then I found out it could probably be a good thing to open a new topic to this question. :)

Link to comment
Share on other sites

Hi Grays, welcome to the forum.

Even though I have been playing with PW for a couple months now, I too am still very green and new to it. I was in the same boat as you and still am trying to grasp the basics, but take the advice of everyone else above. The people here on the forums are very helpful and friendly. Don't be afraid to ask questions. There are a lot of smart peeps here and I find this is one of the most friendliest, most responsive CMS forums of them all. Make friends with other newbies (such as myself) and follow the questions they ask. Seach the forums for the ones asking basic questions and those will more likely be the newbies. 

I think for me, the best thing I could do was to take it slow and lower my expectations. I fell in love with PW right off the bat and wanted to be a a pro in it. But, even though I had read a few PHP books and took some courses beforehand, in reality I was lost and dissapointed. It's more a mental/confidence thing with me, but once I accepted the fact that it was going to take some time, and I wasn't going to be an immediate whiz, things got easier. So. I started off (still am) doing the basics, one thing at a time. Break up your site into smaller parts and work on each one by one. When you get something simple working, your pride will fuel the next challenge and before you know it, you'll be at the top. 

Analyze the code here in the forums and don't just copy/paste. Try to really understand it by cross checking with how PHP works. A great thread started not long ago on learning PHP is here. You may not understand it in one try, I know I didn't. Sometimes it takes days or weeks for something to "click" in your head.  Read, re-read, read again.

Things DO get easier but it takes time, and time is the secret. Practice helps. It's inspiring what you can do with PW and what keeps me going is knowing this is the best CMS out there. I have researched and tried almost all of them over the years, but nothing compares to PW. I am inspired every day to continue learning and not giving up because it's absolutely worth it.

MY breakdown to how I am learning:

  • Take it slow.
  • Break code examples down line by line. Moving on to the next line only after knowing what each before it does. You'll get it!
  • Don't attempt something expecting results the first time. Take pride in humiliation. You can only learn after making mistakes.
  • Read this PW wiki
  • Study Codecademy PHP course along with a couple PHP books.
  • Try to go through every forum completly. Go through each page one by one, bookmarking where you left off. I do this before I go to bed. Before you know it, you'll have read all the forum topics and can know be updated when new threads post.
     
  • ask questions. I know this can be kinda hard because you don't want to look like an "insert insult", but the truth of the matter is if everyone is afraid to ask then it's hard for newbies like you and I to find answers to basic questions. It's a win win for everyone and the CMS itself.
     
  • breaking down basic elements of a site one section at a time and searching the forums for how to do it (navigation, multi-level navigation, photo gallery, forms, etc..) You may have to read multiple threads but it's all there.

Good luck and don't give up! I can never look back at any other CMS, even during times when I'm frustrated or lost! I only get frustrated with PW because I do not know YET how to proficient. I was frustrated USING other CMS's because of how they were built and I knew their code. Says a lot right there.



 

  • Like 8
Link to comment
Share on other sites

  • 4 weeks later...

Hi Grays, 

I have attached a printable Cheatsheet, its laid out on 2 A4 pages. It covers $page, $pages and PageArray. I hope it helps. 

Ryan pointed out:

Beyond the basic profile, you just need to read $page$pagesPageArray and about Template files. Ignore everything else, because you may never need it.

I'm very new to processwire and I understand where you are coming from. I'm praying for that "AHA!" moment too!

When I see encouraging and friendly threads (like this one) I feel like Processwire is worth the time. 

Good luck :)

processwirecheatsheet.pdf

  • Like 6
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...