Adding JavaScript to WordPress

In my Advanced Web (CSC245) class that I’m teaching at Concordia University, St. Paul, the students needed to know how to add JavaScript to their WordPress blog postings.

I put together this demo page walking them through the process along with this video.

Adding JavaScript to WordPress

Here is the source code for the JavaScript function used in the video.

How old is each mask?

edoIvoryMask1500

Ivory Pendant Mask: Court of Benin. Iyoba, Nigeria

ifeKings_Head1100

Yoruba (Ife) bronze casting of Oduduwa

ngady-aMwaashKubaRoyalMask1890

Ngady aMwaash, Kuba Royal Mask, Peabody Museum, Harvard University

Credits:
edoIvoryMask1500Creative Commons, Wikipedia Edo Ivory Mask

ifeKings_Head1100Public domainIFE Kings Head

ngady-aMwaashKubaRoyalMask1890Creative Commons, Wikipedia Ngady aMwaash, Kuba Royal Mask

What is Drupal? A hands-on lab for content editors

Last week I had the opportunity to present at the eLearning Conference held at Northwestern College in St. Paul, Minnesota.
One of the labs I did allowed folks to experience how Drupal works. Each person had their own Drupal account and could experiment learning how easy it is to add content to a site, edit that content. We set up new pages and made menu links to display those pages.

 

What is Drupal?

A hands-on lab for Content Editors

A t

Last week I had the opportunity to present at the eLearning Conference held at Northwestern College in St. Paul, Minnesota. 

One of the labs I did allowed folks to experience how Drupal works. Each person had their own Drupal account and could experiment learning how easy it is to add content to a site, edit that content. We set up new pages and made menu links to display those pages.

One of the things I did was create silly user names such as Missy Sippy, Peg Legg, Marshall Law, Mary Christmas, and Sal A. Mander. Everyone enjoyed picking their names. Here is the original list of names I used http://www.ethanwiner.com/funnames.html  Many of them are very inappropriate for a lab situation, but I was able to cull about 25 very safe ones from the list.

I used a new technique with this tutorial. Keynote (the Apple version of PowerPoint) just doesn’t hold enough information and I wanted the participants as well as anyone sitting at home to be able to see the actual techniques I was presenting long after the conference was over.

To accomplish this I used standard bullet points in the presentation itself as a quick-view text summary of the steps involved. On the same slide I also included a link to a YouTube video demonstrating the actual technique using the same site and basic theme that we used in the lab. Although everyone did really well during the hands-on lab, I think knowing that they could review the steps later took a lot of pressure off the group.

I have a link to the presentation out on my web site:  http://WebExplorations.com  Look along the left column under “Presentations” for “What is Drupal? For Content Editors

Look for the hyperlinks in the upper-right corner of most of the slides to the videos.

Let me know what you think of this technique using videos as part of a slide presentation. Does it work for you?

 

 

 


What is Drupal?

Here is my presentation “What is Drupal? An introduction for Programmers” that I gave at the 2012 Minnebar this last weekend.

 

Here is my presentation “What is Drupal? An introduction for Programmers” that I gave at the 2012 Minnebar  this last weekend. What a great conference!

I’ll be presenting this again at Twin Cities DrupalCamp at the University of Minnesota on May 18-19th.

Use full view in SlideShare and you will get access to the links in the upper right corner of the slides which link out to the demonstration videos I have out on YouTube.

 

 

 

 

South Central College students attending 2012 Minnebar #7Ten of our students from South Central College were able to attend on Saturday. Here is a shot of some of us waiting for the fun to begin.

 

Install Drupal 7 In Five Minutes (or less)

I’m getting my presentation “What is Drupal?” all set up for the 2012 Minn*Bar Conference. Here’s a video I created showing how easy it is to install Drupal 7. I was able to do it in under five minutes.

If you are new to Drupal this will give you a quick overview on the installation process for Drupal.

This is just one part of my presentation. I’ll post the finished presentation as soon as it is ready.

Set up the PHPStorm 3.0 Debugging Environment

PHPStorm allows you to dynamically debug your code using breakpoints, stepping, and many other features. The following steps document how I set up debugging on my MacBook Pro using Lion OSX version 10.7.3 and PHPStorm 3.0.

Debug using Localhost

PHPStorm allows you to dynamically debug your code using breakpoints, stepping, and many other features. The following steps document how I set up debugging on my MacBook Pro using Lion OSX version 10.7.3 and PHPStorm 3.0.

I am running localhost as part of the operating system instead of using MAMP but the overall strategy remain the same.

The term “remote” signifies debugging on a web server and your localhost server is just that, a ‘remote’ web server. This is different then debugging say, JavaScript, on a local web page, that doesn’t run on a web server like PHP.

I hope these notes are helpful in getting your debugging sessions set up as quickly as possible on your system.

Make sure php.ini is loaded

You can verify that your php.ini file is being read by creating a simple PHP file and save it in the root of your localhost web folder. You may want to name it test.php:

  <html>
  <head>
    <title>Testing PHP</title>
    </head>
  <body>
  <h1>Testing PHP</h1>
  <h2>Demo Code</h2>
    <?PHP
     echo "This is a test";
     phpinfo( );
   ?>
  </body>
  </html>

The key to this page is the phpinfo( ). This is an invaluable function to help you verify that PHP and all its support programs are up and running.

When you run this page using localhost you should get an information page that looks something like this:

view of the phpInfo( ) test page

Make sure there is a path in the Loaded Configuration File reference. This tells you that PHP
is using your php.ini file.

If not, check the settings in your Apache .conf file. (Mine was located in
private/etc/apache2/httpd.conf. It includes this line of code:

PHPIniDir “/etc/php.ini”

Make certain to reset your server if you change either the .conf or the php.ini files. Apple
logo/System Preferences/Sharing/ Uncheck “Web Sharing” and then recheck it to turn the server
off and back on, rereading both of these initialization files.

Install xDebug

You can get a compiled version of  xDebug from the Komodo website. Select the “PHP Remote Debugging Client” for Mac (Universal).

Download and unzip this file and save the xdebug.so file in /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so. The long folder name designates the version of xdebug which became important later on when I was installing the Google Chrome extension.

Add the following lines to the php.ini file. Make certain you are using the php.ini file that your PHP program is using. (Refer back to the path found when you ran test.php in the first step.)

  ;PKJ  http://files.zend.com/help/Zend-Server/zend_debugger_-_configuration_directives.htm
  ;PKJ  http://drupal.org/node/157609
  ;PKJ  http://stackoverflow.com/questions/1936792/where-can-i-download-xdebug-for-php-and-mac-os-x
  [xdebug]
  zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
  xdebug.remote_enable = 1
  xdebug.remote_host = localhost
  xdebug.remote_port= 9000
  xdebug.remote_log = /users/yourUserNameGoesHere/Desktop/xDebug.log

Notice I listed several web pages you can use as a reference. You can also comment out the xdebug.remote_log if you don’t need that. It should be a path pointing to the spot where you want to have the log created. I just put it on my desktop for quick debugging.

list settings for PHPStorm phpDebug
Run test.php again.

(Don’t forget to run it from localhost.) and you should see two references to xDebug.

Once under PHP Modules and again under Zend Modules. Use CTRL F in your browser to locate these references quickly on the phpInfo web page.

 

Set up PHPStorm

A nice, fast shortcut to access the Preferences Window in PHPStorm is CMD , (comma).

Inside the PHPStorm Preferences select PHP/Debug

phpInfo( ) output showing that xdebug is loaded properly Inside the PHPStorm Preferences select PHP/Debug.

— Set the port to 9000 (matching what you have in the php.ini)

— Check the box “Can accept external connections”

— The next three break options can be left check or unchecked depending on you own preferences.

Also go into PHP/Debug/XDebugProxy and set the following:

— IDE Key: PHPSTORM (This is used to connect the Google Chrome Extension with PHPStorm
xDebug).
— Host: localhost
— Port: 9000

Add Extension to Google Chrome

xDebug extension after installation in Google ChromeIcon showing the Google Chrome icon set to "active debugging"

 

Using Google Chrome Extensions do a search for Xdebug Helper and install it.

The option settings must match what you have in the PHPStorm Preference settings that you made in the previous step.

Use the Remote Debugger

To use the remote debugger, open up the test.php in a browser (using localhost) as well as in PHPStorm. A small grey bug icon will display in the right end of the URL.

turn on remote debugging and set a breakpoint

A session stopped at the breakpoint after refreshing the browser window

 

 

 

 

 

After you refresh the actual web page (CTRL R) you can control the flow of the program and view the variables by switching to PHPStorm and using the controls in the Debug Window.

NOTE: You have to run the debugging session from the browser by refreshing the page. That will trigger off the breakpoint set in the actual code.

Toggling back and forth between the browser and PHPStorm…

  • Step Over (F8) allows you to skip through a function.
  • Step Into (F7) allows you to step into a function.
  • Use the Red X (CMD F4) to stop a debugging session. (At first you might forget this and have several debug sessions all
    piled on top of each other.)