NYCPHP Meetup

NYPHP.org

[joomla] Learning PHP and Joomla

Gary A. Mort joomla+2012 at gary.mort.net
Fri Sep 14 14:02:32 EDT 2012


        Quite honestly, the way I learned PHP was by doing.  I started with
setting up a family photo gallery for my wife using Menalto Gallery,
http://mandrillapp.com/track/click.php?u=11000867&id=b321e5fac5444c8e9b8b61b00cc6ce9b&url=http%3A%2F%2Fgallery.menalto.com%2F&url_id=486265325&tags=252069,957497
 
 I'd read through the code, make minor tweaks, etc.
 
 The reason I prefer this method of learning is because it completely
bypasses a bunch of learning that is useless in the short term.
 
 Two examples of this are input and databases.
 
 When learning PHP, your going to go through a whole section on how to
connect to a mysql database, create a table, write an update, execute the
query, etc using libmysql or libmysqli.....  NO ONE does this in real life.
 In real life, we use a framework like Joomla! where all of that stuff is
already setup for us!
 
 Instead we might define the layout of a table using JTable and then just
call the get/insert/update methods. For example, if you want to get a user
by userid, you might do:
         // Create the user table object
         $table = $this->getTable();
 
         // Load the JUserModel object based on the user id or throw a
warning.
         if (!$table->load($id))
         {
             // Reset to guest user
             $this->guest = 1;
 
            
JLog::add(JText::sprintf('JLIB_USER_ERROR_UNABLE_TO_LOAD_USER', $id),
JLog::WARNING, 'jerror');
             return false;
         }
 
 
 By the same token, in a book you would be told something like, to get the
value of a field submitted in a form you would do something like:
 
 $myField = $_GET['myField'];
 
 This is bad bad, evil, never ever ever ever ever should you do this!  It
opens up your code to all sorts of security issues.  In Joomla what you
might do is:
 $myField = $jinput->get('myField', '');
 
 
 And even THAT is not a good idea.  It's much better to work at a much
higher level - but at least by doing this your data gets sanitized!
 
 In short....  I think it is probably much better to learn the how to
program Joomla! rather than how to program in PHP.  Once you have learned
how to program in Joomla!, then you can delve further into it by looking at
JInput and seeing just what that code is doing.
 
 And the other item..  I can't really answer....  I learned by learning how
to make changes to open source software...and then broadened my education
from there by seeing how they did things.
 
 
  On 9/14/2012 1:34 PM, Geoffrey Schaller wrote:
 
 
 
  On Fri, Sep 14, 2012 at 1:29 PM, Gary A. Mort <joomla+2012 at gary.mort.net
<mailto:joomla+2012 at gary.mort.net>> wrote:
    Hi Guys,
 
 Something I noticed at last nights meeting was a lot of comments about
individuals who want to learn a bit of PHP, especially as it relates to
Joomla.
 
 
  
 
 As one of the people who wants to learn, I like this idea!
 
 
 On a more simple / practical level -  if one is a complete beginner and
wants to learn PHP, what's a good resource to get your feet wet?  I have a
copy of "PHP and MySQL Development, 4th Edition" by Luke Wellington & Laura
Thomson, but the size of the volume has me a bit intimidated, to be honest.
 Should I just crack it open and begin reading, or are there better
resources for learning PHP from the beginning?
 
 
 -Geoffrey
 
 
  
 _______________________________________________ New York PHP SIG: Joomla!
Mailing List http://mandrillapp.com/track/click.php?u=11000867&id=b321e5fac5444c8e9b8b61b00cc6ce9b&url=http%3A%2F%2Flists.nyphp.org%2Fmailman%2Flistinfo%2Fjoomla&url_id=486265329&tags=252069,957497 NYPHPCon 2006
Presentations Online http://mandrillapp.com/track/click.php?u=11000867&id=b321e5fac5444c8e9b8b61b00cc6ce9b&url=http%3A%2F%2Fwww.nyphpcon.com&url_id=486265333&tags=252069,957497 Show Your Participation in New
York PHP http://mandrillapp.com/track/click.php?u=11000867&id=b321e5fac5444c8e9b8b61b00cc6ce9b&url=http%3A%2F%2Fwww.nyphp.org%2Fshow_participation.php&url_id=486265337&tags=252069,957497
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/joomla/attachments/20120914/5d823b48/attachment.html>


More information about the Joomla mailing list