Jump to content

learning php


Chris
 Share

Recommended Posts

  • 3 weeks later...

I too am learning PHP with my passion for PW growing ever more each day. I have used all the references listed above as well as currently taking the Codecademy course as we speak. I have to say, the Codecademy bugs are driving me crazy!! The resource I use the most though is http://safaribooksonline.com/ . I pay only $9 a month and can have up to 5 books per month in the allowed slot. Their website says $19 for up to 10 books but there is a reduced rate if you dig. I find it invaluable especially for the price. They not only have butt-loads of PHP books but also pretty much every web dev, design, programming topic.

I too second https://phpacademy.org/ .It is an excellent free resource (video based). I have watched every video on that site and even donated because that's how good it is. I am not a fan of videos but the way that guy explains things is worth watching.

Good luck and stick with it. I have read, re-read and studied but always seem to never "get" it. The best advice I ever read was to just jump in. Seriously, you can study all you want but without having something to practice with, it's 1 dimensional.  WIth PW being PHP based, and me wanting to learn PHP, it's a perfect combo. Like one of those combos you get with the extra fries at the bottom of the bag :)

Link to comment
Share on other sites

  • 2 weeks later...

And the classic  PHP 101 by Vikram Vaswani. It's old, but still a gem...This is written in fun, easy-to-follow tongue-in-cheek style in 15 parts. Some is way advanced for mortals like myself and I'll probably never need to be that advanced. It's the best PHP tutorial I've seen anywhere.

BTW: You''ll get 404s for some of the lessons but nothing that Google wasn't able to find...

  • Like 1
Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...

I have struggled understanding OOP and just so happen run across this one. It is designed around WordPress, but could be applied to any platform. I have read a few series from the author and he has a way of breaking things down so they are easily understood.

I helps make the water a bit clearer.

http://code.tutsplus.com/tutorials/object-oriented-programming-in-wordpress-types--cms-20299

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

I recently decided I have to do some proper PHP learning so I read Learning PHP, MySQL, JavaScript, CSS & HTML5 and then PHP Objects, Patterns, and Practice for some hardcore OOP stuff. Reading about OOP design patterns got me thinking maybe there could be a Processwire design pattern collection. It would contain high-level design patterns that would teach aspiring PW users to think in the language of pages, fields and templates.

Obviously I'm in the phase of letting all this OOP sorcery sink in, so I'm just throwing this idea out to you PW gurus. Is there merit to my idea or did the combination of sun & OOP information overload simply soften my head?

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

With a little help from @Kongondo, I have finally committed to taking some lessons PHP beyond what I can learn messing around with my PW install.
 
Here are the best-looking tutorials I have found so far...

I also found Rocky's Boots helpful for learning logic - not sure if anyone else will like it.
 
Please let me know if you have a favorite resource for learning PHP. Also, if anyone can vouch for the usefulness of either of the above tutorials, please let me know!
 
It would be great if this thread could become a resource for all others new to PW and PHP - I hope there are many!
 

EDIT: I have just been directed to the other forums on this topic:

learning php 

Learning PHP: where to learn (just enough to make living w/ PW easier)

Post your suggestions there, I guess!

Edited by kongondo
@Kathep - I've merged your thread with this one
Link to comment
Share on other sites

  • 3 years later...
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Joachim
      Long time user and huge fan of PW, but this time I can't find an answer to my question this time:
      For my social media buttons, I have a Repeater field called var_link_web with two fields: one is for the URL, and the other is an Images field containing two images that are used as a background-image for a <div>, of which the second is the ':hover' version (although activated through JavaScript here). 
      There are four instances of this Repeater, of which two are 'turned off'.
      I use the following PHP in my _main.php to call them, wrapped in <p><?php == ?></p>:
      $s_m_button = $variables->var_link_web; foreach($s_m_button as $button){ $button_image = $button->var_link_image->first->height(80); $button_image2 = $button->var_link_image->eq(1)->height(80); echo " <a href='$button->var_link_url'> <div class='image_link' style='background-image:url({$button_image->url})' onMouseOver='this.style.backgroundImage=url({$button_image2->url})' onMouseOut='this.style.backgroundImage=url({$button_image->url})'> </div> </a>"; }; ($variables leads to an unpublished page with several fields I want to have easy access to, and is defined in _init.php.)
      However, this gives me the following result:

      I have no idea where the extra <p>'s come from. The URL field has the 'HTML Entity Encoder' turned on. What's even weirder is that the HTML source file seemingly renders correctly:
      <p> <a href='https://www.facebook.com/'> <div class='image_link' style='background-image:url(/site/assets/files/1045/icons-facebook-square.0x80.png)' onMouseOver='this.style.backgroundImage="url(/site/assets/files/1045/icons-facebook-square2.0x80.png)"' onMouseOut='this.style.backgroundImage="url(/site/assets/files/1045/icons-facebook-square.0x80.png)"'> </div> </a> <a href='https://www.instagram.com/'> <div class='image_link' style='background-image:url(/site/assets/files/1046/icons-instagram-square.0x80.png)' onMouseOver='this.style.backgroundImage="url(/site/assets/files/1046/icons-instagram-square2.0x80.png)"' onMouseOut='this.style.backgroundImage="url(/site/assets/files/1046/icons-instagram-square.0x80.png)"'> </div> </a> </p> Removing the JavaScript has no effect. I'm probably missing something obvious, but am at a loss here.
       
      Thank you in advance!
    • By Marvin
      Hello, excuse me
      I'm new at processwire, i want to ask about a master detail system (Inheritance system) using a processwire. Can we create a Inheritance table using a processwire, and how we create it? Thank you for the help
    • By Marvin
      Hi,
      I'm still new at processwire, i want to ask, i was create a website with sign in system, but i want to add a access roles/permission for each user at my website. For now, i just can create a login user without any permission and the user data became as a pages in my processwire.
      Here i attach my code for login
      <?php $note = $note2 = $hidden =""; if($input->get->id == "logout") { $session->remove('login_id'); } if($input->post->submit) { $email = $sanitizer->email($input->post->email); $pass = $sanitizer->text($input->post->pass); $result = $pages->find("email=$email, text_1=$pass"); if(!$email || !$pass) { $note = "Data belum lengkap"; } else { if($result->count > 0) { $session->login_id = "$result"; $hidden = "style = 'diplay:none'"; $url=$pages->get("/files/")->httpUrl; header("Location:$url"); die(); } else { $note = "Akun tidak ditemukan"; } } } ?> And this code for login form
      <div class="frow-container"> <div class="frow centered mt-50"> <div class="col-md-1-3"> <div class="box p-40 shadow-light"> <h2 class="mb-20 text-center" <?=$hidden?>>Database Partitur<br>GII HIT</h2> <form method="post" <?=$hidden?>> <label>Username <input type="text" name="email"></label> <label>Password <input type="password" name="pass"></label> <input type="submit" name="submit" value="Masuk"> </form> <p class="notif"><?=$note;?></p> <div class="text-center"><?=$note2;?></div> </div> </div> </div> </div> Just for remember, my user data now is a pages, and i cannot give any permission to user data.
      Thank you very much for help.
    • By Marvin
      Hello,
      I'm new at process wire and i want to make an web using upload file and showing it at the table as a link to open it at the new tab. I wa succed while upload a file, but how i showing it as a link at the table to open it at the new tab of my browser? Any suggestion may helpfull
      Here i attach my code below :
      This code is for upload it to back-end (process wire)
      <?php $note = $note2 = $hidden =""; if($input->post->submit){ $upload_path = $config->paths->assets.'files/upload/'; if(!is_dir($upload_path)){ if(!wireMkdir($upload_path)) throw new WireException("No upload path"); } $original = $sanitizer->text($input->post->original); $indonesia = $sanitizer->text($input->post->indonesia); $other = $sanitizer->text($input->post->other); $composer = $sanitizer->text($input->post->composer); if(!$original || !$indonesia || !$other || !$composer){ $note = "Data tidak lengkap"; } else { $newFile = new WireUpload("song_files"); $newFile->setMaxFiles(1); $newFile->setOverwrite(false); $newFile->setDestinationPath($upload_path); $newFile->setValidExtensions(array('pdf','docx','doc')); $files = $newFile->execute(); if(!count($files)) { $newFile->error("No files received, so not creating page."); return false; } $newImg = new WireUpload("img_files"); $newImg->setMaxFiles(1); $newImg->setOverwrite(false); $newImg->setDestinationPath($upload_path); $newImg->setValidExtensions(array('jpeg','jpg','png','gif')); $files = $newImg->execute(); if(!count($files)) { $newImg->error("No files received, so not creating page."); return false; } $newPage = new Page(); $newPage->template = "files"; $newPage->parent = $pages->get("/files/"); $newPage->title = $original; $newPage->text_1 = $indonesia; $newPage->text_2 = $other; $newPage->text_3 = $composer; $newPage->of(false); $newPage->save(); foreach($files as $filename) { $filepath = $upload_path . $filename; $newPage->files->add($filepath); $newPage->message("Add file : $filename"); unlink($filepath); } $newPage->save(); } } ?> and this code to showing it as a link at the table
      <table class="border"> <tr> <th>No.</th> <th>Original Song Title</th> <th>Indonesia Song Title</th> <th>Other Song Title</th> <th>Composer</th> <th>File (pdf)</th> </tr> <?php $num = 1; $song; foreach($pages->get("/files/")->children as $child) { //showing every child at files parent directory $page == $child; $song = $pages->get("/files/".$child->id."/")->files; //showing uploaded files at child directory echo $child->id; echo "<tr><td>".$num++.".</td><td>".$child->title."</td><td>".$child->text_1."</td><td>".$child->text_2."</td><td>".$child->text_3."</td><td><a href='".$song->httpUrl."'</a>".$song->name."</td></tr>"; } ?> </table> Thank you for any suggestion
    • By picarica
      so i am trying to fetch dimensions of image using getimagesize() but it returns nothing, at least i think so, i want to feed it to data attribute, bit its emtpy, i tried feeding it the image directly or just image->url
      here is my source code

       
      foreach($page->repeat_body as $r_body) { /* other code here*/ if ($r_body->gallery_check == 1) { echo "<div class='my-gallery' id='grid-gallery' itemscope itemtype='http://schema.org/ImageGallery'>"; foreach($r_body->image as $image) { $options = array('quality' => 80, 'upscaling' => true, 'cropping' => 'north', 'sharpening'=>'medium'); $thumb = $image->size(400, 400, $options); $large = $image->size(1280, 0, $options); list($width, $height) = getimagesize($image->url); echo " <figure itemprop='associatedMedia' itemscope itemtype='http://schema.org/ImageObject'> <a href='$large->url' itemprop='contentUrl' data-size='$widthx$height' data-index='0'> <img src='$thumb->url' height='$height' width='$width' itemprop='thumbnail' alt='Beach'> </a> </figure>"; } echo "</div>"; } /* other code here*/ } now, the images are outputted correctly, i can open then and browse them
×
×
  • Create New...