Hello world, Ramaas II is here

Ramaas Software Logo

Ramaas Software Logo

Hello world and welcome to Ramaas, your old pal in web design, web development, software development and scaling, SEO, social media management, web hosting, domain name registration and all the cool, web based is stuff.

Since the big kick-off in 2002, we were providing bespoke online solutions for small and medium sized businesses and organisations around the world. For more information check our portfolio page, read more about us, see our services and shoot us a message using the contact form.

If you would like us build your online identity, you can request a free quote via our online quotation form. Meanwhile don’t forget to follow us on Twitter (@ramaas_com) and become our fan on Facebook. By the way, subscribe our blog updates via RSS.

WordPress 3.0 and the Custom Post Type

Well, enough have been said about the bunch of the new features the upcoming WordPress 3.0 carries. Custom background support, new navigation/menu settings UI and above all, the networking tool which enables you the solution to expand your WordPress installation to multi-blog version a.k.a. WordPress MU.

I was recently designing a portfolio/showcase site for our company and I fancied the new Custom Post Types function which enables you to expand the post types from post and page to as many post types as you would imagine. Say portfolio, movies, gallery, etc…

The post type I wanted to create was portfolio and I came up with the code below:

<?php
// aditional post types
function rms2_post_type_portfolio() {

register_post_type( 'folio', array(	'label' => __( 'Portfolio' ),
'singular_label' => __( 'Portfolio Item ' ),
'public' => true,
'show_ui' => true,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields')
));

register_taxonomy_for_object_type('post_tag', 'folio');
}
add_action('init', 'rms2_post_type_portfolio');
?>

The arguments and parameters supported are described here on WP Engineer. I will only add the following arguments and parameters which are not discussed on WP Engineer.

  • title: shows the title bar in the  edit page. The title bar will not appear in the add new/edit page if you leave this parameter.
  • editor: enables the post editor in the add new/edit page. The editor will disappear if you leave this parameter.
  • author: enables the author meta-box so you can choose to set the post author to another user.

Also you can add 'page-attributes' parameter in the supported parameters if you want to use custom templates for your custom post type.

Enjoy.

Disable Non-admins from Seeing the WP Version Update Notification

One of the many, many reasons I love WordPress is that it lets you know when a newer version is up for grabs and is only a couple of clicks away. That’s sweet, but sometimes I feel annoyed when a client calls me in a busy mid-week day and tells me that I should update their website.

The following snippet lets only the administrators know the fact that there is a newer version of WordPress. Copy and pate the code below into your active theme’s functions.php.


function hide_update_notice() {
	if ( !current_user_can( 'edit_users' ) ) :
	remove_action( 'admin_notices', 'update_nag', 3 );
	endif;
}
add_action( 'admin_notices', 'hide_update_notice', 1 );

This will check if the current user can edit other users’ profiles, if it returns true, then the user is administrator and the update nag will be shown, but if the currently logged in user cannot edit the other people’s profiles it will not bother notifying them any WordPress version updates.

Have a great day and happy new year!

Installing MovableType Pro 4 on XAMPP on Windows XP Machine

Anybody there using MovableType? I got my hands dirty with it today and honestly, I am admitting that unlike our very own sweet, easy and popular WordPress, the world is different there, MovableType is the most difficult content publishing tool I have ever installed.

I installed everything Perl required (including the DBI and the DBD::mysql) to run a Perl based app on XAMPP, however MovableType is so weird that it still says DBD::mysql is missing, attempt to reload DBD/mysql.pm failed and such crap… but I swear I had all that stuff, updated and genuinely running… weird!

Then, I remembered SQLite. mt-check.cgi says its installed.

DBD::SQLite

Your server has DBD::SQLite installed (version 1.25).

How to install MovableType Pro on XAMPP running on Windows XP

Download and install XAMPP. The version I am currently using is XAMPP 1.7.2 (the latest). The good news is that the guys at Apache Friends decided to include the Perl Add-On in the basic package of XAMPP so you don’t need to install Perl Add-On separately.

I am not going to tell you how to install XAMPP, you will find a lot of documentation about it if you google it.

I installed mine at C:\web-server\.

Now, download MovableType Pro 4 from the MT website. I downloaded the free blogger version, which costs you nothing!

Your downloaded MT package should be something similar to MT-4.32-en.tar.gz, the version and language may be different.

Extract your downloaded MT package into a temporary folder. There is something called the Perl shebang at the top of every Perl script, and it tells the web server where to find the Perl executable. This way it knows how to run the code following that shebang. The Perl shebang is written as #!/usr/bin/perl.

By default all the .CGI files in your extracted package use the Linux based shebang. We need to correct this. Using Notepad (or other plain text editor), open every .CGI file and at the top of the file change #!/usr/bin/perl -w to #!C:/web-server/perl/bin/perl -w, use the forward-slash (/), not the backward-slash (\). Remember to use your exact path to Perl.exe.

Next, create a folder inside C:\web-server\cgi-bin, I called mine mt. Then copy all the files inside the extracted MT package except mt-static folder and paste them in C:\web-server\cgi-bin\mt\, then copy mt-static folder and its contents to C:\web-server\htdocs\.

Create another folder called sqlite-db under C:\web-server, then create an empty file called mt-database.db under C:\web-server\sqlite-db\, this will be the SQLite database file of your MovableType installation.

Open the MovableType configuration file (mt-config.cgi-original) found at C:\web-server\cgi-bin\mt\mt-config.cgi-original. Save the file as mt-config.cgi, and make the changes below:


CGIPath    http://localhost/cgi-bin/mt/
StaticWebPath    http://localhost/mt-static

Since we are going to use SQLite we don’t need the MySQL and PostgreSQL properties in our configuration file. Either delete or comment the following lines:


##### MYSQL #####
ObjectDriver DBI::mysql
Database DATABASE_NAME
DBUser DATABASE_USERNAME
DBPassword DATABASE_PASSWORD
DBHost localhost

##### POSTGRESQL #####
ObjectDriver DBI::postgres
Database DATABASE_NAME
DBUser DATABASE_USERNAME
DBPassword DATABASE_PASSWORD
DBHost localhost

Now, make the following changes to the SQLite settings:


ObjectDriver DBI::sqlite
Database C:/web-server/sqlite-db/mt-database.db

Note the forward-slash used for the database path.

Go to http://localhost/cgi-bin/mt/mt-check.cgi, we don’t care if DBD::mysql and DBD::SQLite2 were reported missing, only make sure that the other requirements are OK.

If everything went well, visit http://localhost/cgi-bin/mt/mt.cgi and install MT on your machine.

Enjoy.

A Tip for the PHP Noobs: Get the Description of the Error or Function Causing the Error

I am a self thought PHP coder and when I was new to this fantastic language I always wanted to know why errors are errors and why certain functions are causing errors. Also I was clueless of why errors are (sometimes) hyplerlinked?

Likewise, every PHP newbie would ask the same frustrating question and would want a description of the mystery behind the error.

Here, I will show you a quick tip to turn your test environment into a study center. Follow the steps below and enjoy your time with PHP.

Hint: I assume you are using XAMPP (the all-in-one suite of Apache, mySQL and PHP) running on Windows machine. You can still implement this technique in any PHP installation though.

Preparation

Download and install XAMPP on your computer.

Visit the PHP manual download page, and select one of the downloads under the ‘Many HTML files’ column. There are many languages to choose from but the English version is the most accurate.

Extract the downloaded archive. Inside the extracted archive you should find a folder named ‘html’. Copy that folder —and its contents— into the following directory:


C:\<your-xampp-installation-path>\

After successfully copying the folder into the XAMPP installation directory, rename your copied folder to ‘phpmanual’. It should be something like this:


C:\<your-xampp-installation-path>\phpmanual

Installation

Well, we placed the PHP manual above the DocumentRoot, just in an out-of-web-reach directory, the reason is that there may be multiple domains or hostnames maintained on the machine via VirtualHost containers, so we need to make the manual work on every domain or hostname on the machine.

Open the XAMPP configuration file:


C:\<your-xampp-installation-path>\apache\conf\extra\httpd-xampp.conf

…then insert these lines in it:


Alias /phpmanual "C:/<your-xampp-installation-path>/phpmanual/"
<Directory "C:/<your-xampp-installation-path>/phpmanual">
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>

Just make sure to change C:/<your-xampp-installation-path> to your XAMPP installation drive and path, respectively.

Configuration

Next, open your PHP.INI file found at: C:\<your-xampp-installation-path>\PHP\php.ini and find the following line:

;html_errors = Off

Uncomment the above directive, then turn it on like this:

html_errors = On

Find these two lines:


;docref_root = "/phpmanual/"
;docref_ext = .html

Uncomment the above two directives, they should match the code below:


docref_root = "/phpmanual/"
docref_ext = .html

Save your changes and close the file.

Restart Apache.

Testing

Now, lets see if our effort is working properly. Create a PHP file with the following code inside it:


<?php

include 'a-php-file-that-does-not-exist.php';

?>

Save the file as test-manual.php in C:\<your-xampp-installation-path>\htdocs\, then visit the following URL in your browser:

http://localhost/test-manual.php

If everything was correct, you should receive an error like the following one:


Warning: include(a-php-file-that-does-not-exist.php) [function.include.html]: failed to open stream: No such file or directory in C:\web-server\htdocs\localhost\test-manual.php on line 3

Warning: include() [function.include.html]: Failed opening 'a-php-file-that-does-not-exist.php' for inclusion (include_path='.;C:\web-server\php\pear\') in C:\web-server\htdocs\localhost\test-manual.php on line 3

function.include.html should be hyperlinked and when you click it you should see a page describing the error, otherwise, there is something wrong with your configuration.

Warning

Never use this feature for production boxes. This feature was intended to support your development since it makes it easy to look-up an error or function description. However it should never be used on live websites (e.g. systems connected to the Internet).

WordPress: Display Recent, Related or Random Posts in Your Sidebar

You may have noticed that I have dynamic sidebar that changes slightly as you browse the different parts of the site. For example, I have random posts in my home sidebar, while this changes to related posts when browsing a specific post.

One visitor emailed me recently asking me if I could tell her how I managed to display recent, related or random posts in my sidebar.

Well, I neither use a plugin nor SQL statements for this part.

I used the conditional tags to check the current page and to execute the right part of the code.

The Code in Pieces

I divided the code into three pieces, so you can understand it easily.

Recent Posts


<div class="widget">
<h2>Recent Posts</h2>
<ul>
<?php $posts = get_posts('numberposts=3'); foreach($posts as $post) { ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?><br />
<span><?php the_excerpt(); ?><br /><em>&mdash;Posted on <?php the_time('n/j/Y') ?></em></span></a>
</li>
<?php } ?>
</ul>
</div>

The above code picks the latest three posts. You can change the number of posts displayed by changing number in get_posts('numberposts=3'); to whatever you like.

Related Posts by Category


<div class="widget">
<h2>Related Posts</h2>
<ul>
<?php $posts = get_posts('numberposts=3&category='.$category->cat_ID.'&exclude='.$current_post);
foreach($posts as $post) {
?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title() ?>"><?php the_title() ?><br />
<span><?php the_excerpt(); ?><br /><em>&mdash;Posted on <?php the_time('n/j/Y') ?></em></span></a>
</li>
<?php } ?>
</ul>
</div>

We used get_posts('numberposts=3&category='.$category->cat_ID.'&exclude='.$current_post); to make all the business easier. $category->cat_ID pulls the current post’s category, exclude='.$current_post makes sure to exclude the current post from the related ones.

You may use related posts by tag alsoWP Recipes

Random Posts


<div class="widget">
<h2>Random Posts</h2>
<ul>
<?php $posts = get_posts('orderby=rand&numberposts=3'); foreach($posts as $post) { ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?><br />
<span><?php the_excerpt(); ?><br /><em>&mdash;Posted on <?php the_time('n/j/Y') ?></em></span></a>
</li>
<?php } ?>
</ul>
</div>

Our code uses orderby=rand. So WordPress will pick 3 random posts from the database every time our site loads.

Final Thoughts

The above codes can be merged together and displayed on the sidebar using the WordPress conditional tags.

If you have enjoyed this post or have any questions or recommendations, please share your views in the comments section.

How to Send Email with XAMPP on Windows XP

When we are working on a new web application we usually test our projects locally before making them public. But, localhost doesn’t have all the good stuff available on the real host. Some functions need to be configured properly and some additional programs need to be implemented.

Problem

I was working on PHP/MySQL based small project which is all about students’ registration system, where the students can register themselves then they’ll be able to receive school transcripts and such stuff by email.

When I finished the project I tested the application to see if it was working properly but I got a problem with PHP‘s mail() function, which was not sending any email messages out.

I was feeling frustrated for a while before coming up with the solution below.

Solution

To make our locally hosted web applications talk to any SMTP server including those on the Internet, we will configure that by using the PHP‘s configuration file called php.ini which can be found in the following locations (assuming you are using XAMPP installed in drive C:/):

C:\<xampp-installation-path>\php\php.ini
C:\<xampp-installation-path>\php\php5.ini
C:\<xampp-installation-path>\apache\bin\php.ini

Okay, that was locating the configuration files; let’s move to the next steps.

Method 1:

- Open php.ini file and uncomment the php_smtp.dll extension. This is required when sending emails to a remote server.

- Scroll down and find the following lines:

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

- From the lines above, uncomment SMTP, smtp_port and sendmail_from
directives, then add SMTP server, SMTP port number and your preferred email address to SMTP, smtp_port and sendmail_from directives respectively, your final code should be similar to the one below:

[mail function]
; For Win32 only.
SMTP = mail.server.com
smtp_port = 25

; For Win32 only.
sendmail_from = something@server.com

- Replace mail.server.com and something@server.com with correct values. The defualt SMTP port number is “25″, therefore, you have 99% chance of not changing this.

- Restart your server.

Everything should work properly now. If not, double check your changes again. If you think you made everything correct, but there is nothing working, try method 2 instead.

NB: You should be aware that once you assign an email address to sendmail_from PHP will force all the senders’ emails to that address.

Method 2:

This method is more easier than the steps described in method 1. We’ll use fake Sendmail Program for Windows (sendmail.exe) which is a simple windows console application that emulates sendmail's "-t" option to deliver emails piped via stdin. sendmail.exe is bundled with XAMPP so you don’t need to install it unless you are using hand made server.

- In method 1 we have enabled SMTP, smtp_port and sendmail_from directives, please make sure that these directives are commented out since we don’t need them anymore. Then scroll down and find the following two lines in your php.ini file:

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\<xampp-installation-path>\sendmail\sendmail.exe -t"

- Make sure that the sendmail_path directive is not commented out, and the path is correct, then save php.ini and close it.

Edit Sendmail Configuration File (sendmail.ini):

The fake Sendmail program is found in the following location:

C:\<xampp-installation-path>\sendmail\sendmail.exe

…and its configuration file is found here:

C:\<xampp-installation-path>\sendmail\sendmail.ini

Okey. That was that. Let’s configure it, so it will work the way we wanted.

- Open sendmail.ini file and use the following settings:


[sendmail]

; you must change mail.mydomain.com to your smtp server,
smtp_server=mail.mydomain.com

; smtp port (normally 25)
smtp_port=25

- Replace mail.mydomain.com with a valid SMTP server and assign port number (usually 25) to smtp_port.

Your SMTP server may require an authentication. If this is the case, scroll down the file and find the following lines:


; if your smtp server requires authentication, modify the following two lines

auth_username=username
auth_password=drowssap

- Modify the above two directives. Add your SMTP server’s username and password.

Some SMTP servers use POP3. If yours is one of those servers, then you need further modifications.


; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines

pop3_server=mail.mydomain.com
pop3_username=username
pop3_password=drowssap

- Change the values of the above three directives to fit your needs and save your file. Then restart your server and try to send a test message to your email address.

If everything is correct, you can send emails to any server now. The following snippet is a header of message sent from my localhost server:


Return-path:
Envelope-to: jmehmett@host.com
Delivery-date: Sun, 15 Jun 2009 17:18:55 +0200
Received: from [192.168.3.134] (helo=mehmett)
     by host.server.com with esmtpa (Exim 4.62)
     (envelope-from )
     id 1MFrTy-000CQx-OY
     for jmehmett@host.com; Sun, 15 Jun 2009 17:18:55 +0200
To: jmehmett@host.com
Subject: Taste email from localhost
Date: Sun, 15 Jun 2009 19:18:39 +0400
From: J Mehmett
Message-ID:
X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="UTF-8"

That was easy, huh?

Final Thoughts

This is a simple mail configuration. I tested it using the SMTP settings of my host and it worked properly.

Gmail users may check Brett Shaffer’s solution, alternatively, AOL users may see KahWee’s solution.

If you have enjoyed reading this post don’t forget to share your thoughts in the comments section.

WordPress 2.8: Features and Tips

With the long waited WordPress 2.8 aka Baker being out, there is a ton of features including 2.8 being a way faster to use, widgets are remixed, some DB tables columns are dropped and JS script loader is improved. Experts and gurus have contributed with new tips to make the business even better.

There is an announcement post on the official Development Blog with an eye-catching introduction video.

Features, Tips and Tricks

  1. A full list of more than 180 new features, improvements, changes and upgrades.WP Codex
  2. Build A WordPress 2.8 Widget With The New Widget APIWPEngineer
  3. The Improved WordPress Widget APIWP Codex
  4. The complete guide to creating widgets in WordPress 2.8Justin Tadlock
  5. Tutorial: WordPress 2.8 Widget APIJesse Altman
  6. Custom taxonomies in WordPress 2.8Justin Tadlock
  7. Tag description in WordPress 2.8Justin Tadlock
  8. Loading Javascript in Footer in WordPress 2.8Lester Chan
  9. WordPress 2.8 and the body_class() FunctionNathan Rice
  10. Authentication in WordPress 2.8Will Norris
  11. Handling Plugins Options in WordPress 2.8 with register_setting()Planet Ozh
  12. WordPress 2.8 – XML-RPC and AtomPub ChangesJoseph Scott
  13. List of Plugins Compatible with WordPress 2.8WP Codex
  14. WordPress ProxysupportWPEngineer
  15. Escaping API updates for WordPress 2.8Mark Jaquith
  16. Displaying Author Meta Information in WordPress 2.8Zach Dunn
  17. the_author_meta() in WordPress CodexWP Codex

I know there are tons of talks around the new version but these are the only findings I discovered during the development releases of WordPress 2.8.

If you have suggestions and/or some other posts I missed in this collection, please feel free to contribute them in the comments.

I hope you enjoyed with this post.

WordPress now supports Daylight Saving Time

Daylight Saving Time (DST) or Summer Time (as they call it in Britania) was usually something we used to set by hand in WordPress releases beyond the in-development version 2.8. This was not really painful, but being a great software, WordPress guys described it as a “Lame”.

What is daylight saving time?

Daylight saving time (Summer Time) is the convention of advancing clocks so that afternoons have more daylight and mornings have less. Typically clocks are adjusted forward one hour near the start of spring and are adjusted backward in autumn. Modern DST was first proposed in 1895 by George Vernon Hudson, a New Zealand entomologist. Many countries have used it since then; details vary by location and change occasionally.

Wikipedia

In WordPress 2.8, they added Timezone enhancements for PHP 5 so you can choose a city in the same timezone as you for Timezone in Administration > Settings > General.

Old WP time settings

Old WP time settings

New WP DST settings

New WP DST settings

See also

10 Free Icons Sets For Your Projects!

Since the revolution of GUI, icons were playing a vital role in the visual composition of design industry. People were using icons for both offline and online projects, and, apart from the rest, webmasters were using icons for both accessibility and decoration purposes. Simply having icons on your blog or website doesn’t mean that you have a beautiful design. But in somehow, it’s mystery that icons did not disappear in the doom of design era.

Below, I listed some of the world’s most popular icon resources… wait… they are free to download… you don’t need to spend a penny to have them.

1. FAMFAMFAM

FAMFAMFAM Silk Icons

Everybody, yes, even the internet fool, knows or heard about the famous silk icons of Mark James. There are about one thousand icons, a huge collection indeed.

FAMFAMFAM icons are the most popular, as I think. Firefox’s web developer toolbar uses them, a large sum of WP themes uses them, I use them and of course, you may use them, too!

2. Function Icon Set

Function Icon Set

Function Icons Set contains fabulous 128 icons for free. The features of this icons include shiny style, 48x48px, social media icons such as Design Float, Digg, Delicious, Furl, Technorati, Flickr, Stumble Upon, Twitter, etc… and blogging icons include RSS icons, email icons and so forth…

3. Project Icon Set

Project Icon Set

Project Icon Set is the work of Navdeep Raj from DezinerFolio. This set contains 18 great icons specialized for project management. This set can be used for free and paid projects and is ideal for business related works.

The designer released this icon set for Smashing Magazine readers.

4. On Stage Icon Set

On-Stage: Free Vector PSD Icon Set

Yet another DezinerFolio icon set. This one contains 49 free vector icons with PSD source.

The reason I love such thing is that the sky is the only restriction for the usage of this set, you can use them for free.

5. Stationary Icon Set

Stationary Icon Set

Still on DezinerFolio. This icon set contains 22 256 x 256 icons related office and studio elements and includes Fireworks source.

6. Simplistica Icons

Simplistica

Simplistica Icons set is free icon pack from DryIcons‘ creative team. Simplistica icons are glossy and shinny and come with 16x16px, 32x32px, 48x48px and 128x128px and all are 32-bit transparent PNGs.

7. Blogging Icons Set

Blogging Icons Set

Blogging icons set by BlogPerfume is a set containing 12 high quality shiny icons designed for bloggers. This set comes with 3 sizes 24x24px, 36x36px and 48x48px.

8. Web Application Icons Set

Web Application Icons Set

Web Application Icons Set is a 3D glossy and shiny icon set from WebAppers for free for both personal and commercial projects! There are 20 icons designed specially for web applications (e.g. Charts, Profile, Search, Add, Delete, Email, Print, Warning and etc…). Icons come in 3 sizes; 48×48 px, 32×32 px, and 24×24 px. All in PNG format with transparent background.

9. Antique Icons Set

Antique Icons

Designed by Nawfal from DeviantArt, Antique Icons set contains 33 realistic, beautiful and grungy icons in 28x28px size and comes with both transparent PNG format and ICO format.

10. 3D Cartoon Icons Pack

3D Cartoon Icons Pack

This pack contains 111 .PNG, .ICO (Win) and .ICNS (Mac) icons in 3D shape. These icons come in 300x300px size.

Finally

I hope this post will help some of you. Icons are not limited in this 10 and there are tens of thousands of free icons sets on the Internet.s

Any suggestions, comments and corrections are welcome. The comment form is open for everyon.

Page 1 of 212

Login to your Account



I forgot my password.