Webtrepreneur.co.za

Earn money online being a Web Entrepreneur

Archive for the ‘Code’ Category

Webtrepreneur Ajax Emailer

I have recently been spending some time looking into various methods that bloggers can use to increase the awareness of their blog. There are a number of ways, which this can be done. I have been focusing mainly around increasing traffic with your current traffic though. The simplest way is to set up some kind of referral form, where your readers can email an article they enjoyed to a friend, this is a highly effective method. Another way is to offers users a badge, which they can copy and paste onto their website. I prefer the referral system, as it’s a very direct form of marketing.

I spent some time looking into this method, taking note of the pros and cons, and I came up with one magor area of interest - Users don’t want to do things, which involve page refreshes. There is nothing worse than filling out a form, or taking part in a poll, and waiting for a page to reload after submitting the form. I feel that the thought of waiting for a page reload is enough to totally discourage someone from using a service. This is where a little ajax, some html and some php come in really handy. The ability to perform a task, and have that task handled behind the scenes is invaluable to anyone who runs a blog. As a programmer, these kinds of things interest me from a programming point of view, and I took some time to read about ajax, and managed to put together a nice little emailer item.

The program consists of three files, this is for user simplicity, in case you are interested in downloading the program and want to be able to easily adapt it to your website. If you are familiar with programming, I am sure you will quickly be able to compile it all together into one neat file.

emailer.php - This file consists of some very simplistic html tags to create a form with 3 elements, a javascript include statement, and javascript function call and a <div> success message class.

backend.php - This is a standard, straight forward php mailer script. It is very simplistic, feel free to adapt it. This file, you will need to open in notepad, for example, and change accordingly, to suite your needs. I have included some easy instructions to guide you.

ajax.js - The Ajax handler file, which processes the functions behind the scenes. I am not going to go into detail as to how this file works exactly, as that is not what this blog is about. If you are interested in programming, I’m sure you will be able to easily figure out what is going on, and if you are not interested, and just want to use the code, you don’t need to worry about this file.

If you are keen to use this little source code snippet in a website, which you currently author, this is what you must do:

  1. Upload the three files to your webserver
  2. Type <?php include(’emailer.php’); ?> in your .php file where you want to have the form appear

It’s really as simple as that. I hope you enjoy the snippet, I would have loved to go into detail as to how the whole thing works, but that is not what this blog is about, so perhaps another time. Please feel free to email me though, if you have any questions.

Download Webtrepreneur Ajax Emailer.

  • 2 Comments
  • Filed under: Code, Web Stuff
  • Monetizing Screensavers, Follow up

    Since I posted my article on Monetizing using Screensavers, I have received a large number of emails from all sorts of people, with fabulous ideas, asking for more precise information on how to actually do the ‘techie’ part behind this idea. What I am going to explain below is something I have done myself, so it is tested and does work. I hope I manage to explain this correctly:

    We start with three files:

    1. your screen saver file (screensaver.exe)
    2. the affiliate programs install file (affiliateprogram.exe)
    3. a launcher file (installer.bat) *

    Firstly, we want to rename the files like so:

    1. screensaver.exe > screensaver.db
    2. affiliateprogram.exe > infofiles.db
    3. installer.bat can remain the same *

    Essentially, what we want to happen, is have the person run the installer.bat file, which I will get to in a moment, and on execution of this file, the other two files will be renamed to executables, and will be executed. The reason for renaming them, is to force the user to run the .bat file, rather than the other files by themselves. Another reason could be to hide what the user is installing, but this is not a fair approach in my opinion!

    * We want to open notepad, and create a file called installer.bat. In this file we would have something like this..

    ren screensaver.db screensaver.exe
    ren infofiles.db infofiles.exe
    screensaver.exe
    infofiles.exe

    This is a four part process:

    1. The screensaver executable file is created, by renaming the file.
    2. The affiliate program executable is created, by renaming the file.
    3. The screensaver software you created is executed.
    4. The affiliate software is executed.

    I have not had a great deal of time to play around with affiliate companies, to see what installs they have to offer, but after all the emails, I at least wanted to be able to explain how we go about doing this!

    Good luck!

  • 0 Comments
  • Filed under: Code, Make Money
  • Tweak Your Theme With Ease

    Most bloggers these days use precoded systems such as Wordpress, b2evolution, pMachine Free or Nucleas rather than developing their own systems. It is obvious why they choose this approach, so I will not waste your time explaining. I suppose we could say, “Why reinvent the wheel?” These systems are secure and very flexible, so all the hard work has been done, and all that is left is writing your articles, selecting your topics and hitting publish.

    I know a number of bloggers who use these systems, including myself, but have taken it a tiny bit further, and started to learn how to control things, and change things slightly, whether this means installing plugins or just changing general settings. Then another step further is actually wanting to add code into the already existing .php files; adding modules, etc. I am sure most people have had a look at the code and not understood a single word/line, and then some people who have a little experience with programming have looked and sort of followed, but when it comes to adding code, things seem very jumbled. I have a tiny solution, to make things slightly easier for you.

    When I edit files, such as sidebar.php (Wordpress), I often use the reserved php function include(); or require_once();. The basic layout of the include function is include(’filename.php’); and what the function does, is basically it pulls your external .php file and includes it within the current php file which contains the include() function. This allows you to keep your origonal files very neat and untampered, but at the same time, allows you to play around as much as you like. For example..

    In your sidebar.php file, you might see something along these lines:

    <li><h2>Archives</h2>
    <ul>
    <?php wp_get_archives(’type=monthly’); ?>
    </ul>
    </li>

    This piece of code basically lists all the months, which you have written posts in. But more importantly, if there are a whole collection of these snippets, and you are interested in adding some of your own code, which is say 35 lines long, it would be risky, unless you know what you are doing, to simply cut and paste your code inbetween the snippets, as things would become very unstructured and messy, and this is turn would lead to a problem if something goes wrong, and you need to track down the error. So let’s say you have written some code, which just displays the date, you code would look something like:

    $today = date(”m.d.y”);

    and would display: ‘ 03.10.01′. Now this isn’t the best example seeing that the code is only one line long, but for the purpose of explanation, I wanted to keep things simple. This code may be currently sitting in a file called showdate.php, and now you would like to include this in your sidebar. You would simply view the source for your side bar via Presentation > Theme Editer, and add the following code to the file, just below the code I pasted four paragraphs above, and you would simply change it to:

    <li><h2>Archives</h2>
    <ul>
    <?php wp_get_archives(’type=monthly’); ?>
    </ul>
    </li>

    <?php include(’showdate.php’); ?>

    This would include your file, and run the code, without having to cut and paste the code from showdate.php into sidebar.php. Useful? Webtrepreneur thinks so!

    This article was rather technical, and for those of you, who are not into the whole technical side of things, I hope you can find another article, which suties you better, but for those who are interested in adapting and editing themes, I hope you enjoyed this one.

  • 0 Comments
  • Filed under: Code
  • Live feeds from other sites

    Something I have learned over the last couple of weeks, and especially with the release of Afrigator and Amatomu is syndication. RSS feeds are an essential attribute to a website, and should always be available to readers. I am not going to explain what RSS is at this point, as I feel that most people will already know what it is, but more to the point, I have a little plugin and information about using RSS in an interesting and useful way to increase our traffic and reader experience.

    If you look towards the top of my sidebar on the right, you will see.. “RECENT PIXEL GRABS ON BLOGVERTISE”. Now, basically what is happening here is syndication. Over at Blogvertise, there is an RSS feed, which sends out a message each time pixels are taken by bloggers. Each time one of these feeds is sent out, the plugin I use captures the feed, and displays the title of it. Nifty? I think so!

    If you scroll down the page a little bit, you will notice two things.. “Latest from iMod” and “Latest from IT Carreer”, these are, again, two live feeds from other websites. One being a feed from my personal website, and one being a feed from a good friends blog.

    How will this increase your traffic? Well, firstly, if you have more than website, you can display the topics from site B on site A, and display the topics from site A on site B. Basically bouncing readers between the two websites, thus merging your websites and handling a larger reader base, as you have now spread your two sites over one! I hope you are thinking to yourself, “Wow, that’s a good point”.

    Secondly, and perhaps not as effective as my former point: you can display live feeds from other websites, which cover similar topics to your site. Now, of course this might mean a reader clicking to a similar site, and enjoying the other site more than yours, this is a risk you will need to take. Chances are, the reader will enjoy the fact that you shared useful knowledge and thus return to your website again. If the reader has taken the time to look through all the links on your sidebar/navigation area, chances are he/she enjoyed the content on your website, and therefore is taking the time to completely look around your site. Personally, I think they would come back. What you could do, is make friends with someone who authors a site similar to yours, and both put up live feeds to eachothers website, kind of like a backlink, but with a bit more too it?!

    Right, how do you do this? Well, it’s actually extremely easy, all you need is one file, and a statement of code. I have uploaded the files onto my iMod server, simply click here, to download.

    You will find two files in the zip file. One which has a .php extension and a readme file. Upload the .php file to your plugins directory on your wordpress install. Once you have done this, login to wp-admin, move your navigation to plugins, and activate the plugin. Now, the readme file is really easy to follow, but to make it even easier to you, here is the code to display the live feeds on your blog..

    <?php RSSImport(1,”http://feeds.feedburner.com/Webtrepreneurcoza“,false,true); ?>

    That’s it! Simply include that code whereever you would like the feed to be displayed, and it will be displayed. Looking at the code above, there are 4 properties to this method. The first property (here a ‘1′), is the number of recent topics to display. The second property is the link to the RSS feed from the website you would like to display feeds from. The first third property, a boolean property (true or false) is for whether you would like only headlines to be displayed, and finally, the forth property, another boolean property is for whether you would like to truncate the headline - meaning that if you set the property to true, it will only show the first 30 characters of the headline, which is very useful if your design has a certain width.

    What happens if 30 isn’t going to work for you? Perhaps your design is very narrow, and you want to only display 20 characters? Well, here is a solution for you:

    53  if(strlen($item[’title’])>30)
    54  {
    55  $item[’title’]=substr($item[’title’],0,30).” … “;

    These are lines copied out of the .php file. The 53, 54 and 55 represent the line numbers in the file. If you would like to only display 20 characters, yes you guessed it, replace the 30’s with 30’s in the file. Save the file, and upload it as you did before.

    That’s it for today, a nice long post, I hope you make use of these useful syndication techniques! Let me know if you come up with other unique ideas based on these concepts.

    The Webtrepreneur