MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Sat, Jul 28, 2012 10:26 pm

Printing Boolean Values as Yes or No

If you have a PHP variable that is storing Boolean data, i.e. 0 for "false" or "no" and 1 for "true" or "yes", but want to display the value as "no" when a zero is stored in the variable and "yes" when a one is stored in the variable, you can print the value using the ternary operator, ?, which is described in the Ternary Operator section of the manual page Comparison Operators.

E.g., suppose I have an array named swinfo that has information on various software packages that has an array variable Free that has a 0 stored in it if the software is not free and a 1 stored in it if the software is free. If I have a software package that isn't free, if I just print the contents of the variable as in the first instance below, I get a zero, but by using ther ternary operator, i.e., the ?, I can specify that I want "yes" or "no" displayed, instead as for the second instance where it is displayed below.

      echo "<table>\n" .

      "<tr>\n" .
       "<td><b>Free:</b></td><td>" .
        $swinfo['Free'] . "</td>" .
       "</tr>\n" .

       "<tr>\n" .
       "<td><b>Free:</b></td><td>" .
        ($swinfo['Free'] ? 'yes' : 'no') . "</td>" .
       "</tr>\n" .


For an instance where the software isn't free, I would see the following displayed:



  1. Echo boolean field as yes/no or other values
    Stack Overflow
  2. Comparison Operators
    PHP: Hypertext Preprocessor

[/languages/php] permanent link

Sat, Jul 28, 2012 9:12 pm

Printing an array with print_r

The contents of an array can be printed in PHP using print_r. E.g., suppose that the information to be displayed is stored in a database in a table called tests that has student test scores with each student identified by a student id. The following PHP code could be used to fetch the test information for a student whose id is stored in the variable $num and then print the entire array named testinfo.

$result1 = mysql_query("SELECT * FROM tests WHERE ID = $num");
$testinfo = mysql_fetch_array($result1);
print_r ($testinfo);


  1. Print_r () PHP Function
    By Angela Bradley PHP/MySQL

[/languages/php] permanent link

Sat, Jul 14, 2012 5:17 pm

Attachment and Avatar Settings for SMF 2.0

To modify the attachment and avatar settings of an Simple Machines Forum (SMF) 2.0 forum click on Admin, then select Forum, then Attachments and Avatars, and then either Avatar Settings or Attachment Settings.

For the avatar settings, there is an Avatars directory setting and an Avatars URL setting. If the directory specified for Avatars directory doesn't exist, then "Avatars directory" is displayed as red text.

For the attachment settings, you specify an Attachments directory. If you specify a directory that doesn't exist, the words "Attachments directory" will be displayed as red text.

If you change any of the settings, click on the Save button at the bottom of the page to save the new settings.

[/network/web/forums/smf] permanent link

Sat, Jul 14, 2012 1:11 pm

Deleting a Theme for a SMF 2.0 Forum

To delete a theme for a Simle Machines Forum (SMF) 2.0 forum, take the following steps from an account with administrator privileges:
  1. Click on Admin then select Features and Options.
  2. Click on Configuration then select Themes and Layout then Theme Settings.
  3. To the right of each theme listed is an icon of a piece of paper with a folded corner with a red "X" over it. Click on that icon to delete the theme.
  4. You will also need to delete the relevant subdirectory beneath the SMF Themes directory on the web server where the forum resides. E.g., for the Blue Moonlight theme the directory would be Themes/Blue_Moonlight_SMF2.

[/network/web/forums/smf] permanent link

Mon, Jul 09, 2012 10:16 pm

SMF 2.0 Forum Smileys Location

After I moved a Simple Machines Forum (SMF) forum from one domain name to another, I found the smileys, aka emoticons, were no longer accessible. The steps for pointing the SMF software to look in a different directory for the smileys is listed below.
  1. Click on Admin.
  2. Click on Smileys and Message Icons.
  3. Click on Settings.
  4. Change the values for "Base URL to all smiley sets" and "Absolute path to all smiley sets". Note: If you see "Absolute path to all smiley sets" as red text, then there is a problem with the path you specified.

[/network/web/forums/smf] permanent link

Sun, Jul 08, 2012 9:14 pm

Comparing Two Directories with Diff

If you need to compare two directories to determine which files are in one directory, but not another, on a Unix, Linux, or Mac OS X system, you can use the diff command. E.g., suppose the directories are named dir1 and dir2; they can be compared with diff dir1 dir2
$ diff dir1 dir2
Only in dir2: index.html
Common subdirectories dir1/temp and dir2/temp
Only in dir2: a.png
Only in dir2: b.png
Only in dir1: 123.png
Only in dir1: 456.png

If you wish to see only the differences and not common directories and subdirectories, you can use diff dir1 dir2 | grep "Only". To perform the comparision recursively through the various subdirectories within the two directories use diff --recursive dir1 dir2.


  1. Find files in one directory not in another
    Server Fault

[/os/unix/commands] permanent link

Sat, Jul 07, 2012 9:21 pm

Google Member Map 2.6 SMF Mod Installation

I moved a Simple Machines Forum (SMF) forum from one domain to another, which required updating the Google Member Map mod. Google no longer requires a key for using the map service provided by Google and the latest version of the mod doesn't even provide a means to specify a key.

[More Info]

[/network/web/forums/smf] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo