Jul
11
2011
0

Notice: Undefined variable: site_name_and_slogan in include()

Drupal 7x

If you have copied the Garland theme and renamed the directory and garland.info file you need to change all references of garland in the template.php file to your new theme name.

Written by Pete in: Drupal |
Jul
08
2011
0

Windows 7 Recycle Bin Desktop Missing

Problem: The link to the Recycle Bin on the desktop has gone missing.

Fix: Right click on the desktop and click personalise.

Click Change Desktop Icons

Click the Recycle Bin box and click OK

Written by Pete in: windows 7 |
Jul
07
2011
0

Find Most Recent Comments

To find the most recent comments in WordPress use the following code:


$number=30; // number of recent comments desired
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
if ( $comments ) : foreach ( (array) $comments as $comment) :
echo sprintf(__('%1$s on %2$s'), get_comment_author_link(), '' . get_the_title($comment->comment_post_ID) . ' - ') . $comment->comment_date;
endforeach;
endif;

Written by Pete in: wordpress |
Jul
07
2011
0

Find the most recent posts from a specific category

In WordPress sometimes you will want to show the most recent post from a specific category.

To do this use the following code:


global $post;
//change the category=1442 to the category number you want to pull the content from
//change numberposts=1 to the number of posts you want to return from the category
$myposts = get_posts('numberposts=1&category=1442&order=DESC');
foreach($myposts as $post) :
setup_postdata($post);
$catpost= " ". get_the_title() ."";
endforeach;

echo $catpost;

Written by Pete in: wordpress |
Jul
07
2011
0

Store the_permalink() as a variable

The wordpress function the_permalink() automatically echos the content to the screen.

Sometimes you want to store this value in a variable.

In this case use:


$string = get_permalink();

Written by Pete in: wordpress |
Jul
07
2011
0

Store the_title() in a variable

The wordpress function the_title() automatically echos the content to the screen.

Sometimes you want to store this value in a variable.

In this case use:


$string = get_the_title();

Written by Pete in: wordpress |
Jul
07
2011
0

PHP: Write to a file

The following code writes to a file, it will overwrite the current contents of the file:


$string = "file contents goes here";
$myFile = "file.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $string);
fclose($fh);

Make sure you give file.php write access on the server (Apache chmod 775 normally works).

Written by Pete in: php |
Jul
07
2011
0

PHP: Limit a strings characters

This function will limit the number of words shown if the total character limit is over a certain number and add … after the string. Very useful if you want to trim titles or anywhere where you are limited by space:


function limitCharacters($string){
$count = strlen($string);
// change 50 to the number of characters you want to check for
if($count > 50){
//change 5 to the number of words you want to limit to.
//change ... to anything you want to use to show its clipped
$newstring = implode(' ',array_slice(explode(' ',$string),0,5)).'...';
}else{
$newstring = $string;
}
return $newstring;
}

To call the function simply use:

limitCharacters($mystring);

Written by Pete in: php |
Jul
07
2011
0

Dreamweaver Locked Files

When opening a file in dreamweaver in OSX you get the following message:

“index.html is a locked files and can be viewed but not changed.”

1. To fix this open finder.
2. Right click on the file or folder.
3. Under sharing and permissions give everyone read and write access.
4. If its a folder click the cog and select ‘Apply to enclosed items’

Written by Pete in: dreamweaver,OS X |
Jul
06
2011
0

BES Server Logs

Here are the abbreviations for the BES Server Logs:

ACNV = BlackBerry Attachment Conversion
ALRT = BlackBerry Alert
ASRV = BlackBerry Attachment Service
BBUA = BlackBerry User Admin Service
CBCK = Backup Connector
CEXC = Exchange Connector
CMNG = Management Connector
CNTS = Notes Connector
CONN = BlackBerry Synchronization Connector
CTRL = BlackBerry Controller
DISP = BlackBerry Dispatcher
HHCG = BlackBerry Configuration Tool
MAGT = BlackBerry Messaging Agent
MDAT = BlackBerry Mobile Data Service
MDBC = BlackBerry Database Consistency Service
MNGR = BlackBerry Manager
POLC = BlackBerry Policy Service
ROUT = BlackBerry Router
SYNC = BlackBerry Synchronization Service

These are located in:

C:\Program Files\Research In Motion\BlackBerry Enterprise Server\Logs

Written by Pete in: Blackberry |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes