Programming

The Chris Keefer Experiment: SEO

Posted in Ramblings, Websites on June 24th, 2010 by Jason – Be the first to comment

Over the past week a friend of mine has endeavored to increase his presence on the web with his blog. He decided to completely rework his blog from the ground up, geared toward better search engine optimization (SEO).

A big change that he has made is in the frequency of his postings which average 1-3 per day. Over the past week he has gone from a unknown page in google search to page one. Currently he has focused mainly on people who search his own name (Chris Keefer). It will be interesting to see how his blog continues to grow over the coming weeks and months and to see what other directions he will be focusing his SEO attentions.

If you would like to get a little idea of the inner workings of Chris, take a gander at his rebuild blog.

http://mynameisreef.com/

Post to Twitter Tweet This Post

PHP error: expecting T_PAAMAYIM_NEKUDOTAYIM

Posted in Programming on May 10th, 2010 by Jason – Be the first to comment

I ran across this error the other day while setting up a nested foreach loop. When looking at the error logs all I found was expecting T_PAAMAYIM_NEKUDOTAYIM. Which was not very helpful. If you find that you have this error, try looking for a missing dollar sign “$” on one of your variables.

Hope this helps, happy coding!

Post to Twitter Tweet This Post

Embedded Related Entries

Posted in Expression Engine on September 16th, 2009 by Jason – Be the first to comment

I came across the problem the other day of how to show a related entry of a reverse related entry of my entry. Confused? Imagine the following scenerio:

You have two separate weblogs, A and B. Each has several entries and are related to each other through a third weblog C. The weblog C holds all the relations and weblog A and B do not have any relations. This means that there can be many entries in C which point to A, and many entries in C that point to B. Still confused? Here is a real world example.

You have several lawyers who practice in a variety of practice areas but not necessarily all areas. The same relation is true for practice areas, where on area can have several attorneys but maybe not all. Each attorney has a statement about his expertise in the practice areas they serve in. In this example, the Lawyer is held in weblog A, the practice area in B and the statement of expertise in weblog C.

Now, lets say you would like to have an Lawyer page for a specific lawyer in weblog A, and you would like to list out all the practice areas (B) on the lawyers page. Because there is no direct relation between A and B you must use the relation between A – C and then the relation from C – B to get the final relation of A – B. To do this you must use a nested related entry in a reverse related entry for the entry of the Lawyer.

Unfortunately, expression engine does not allow nested related items on a page directly. So to make this work, you must use an embed to make the nesting work. Here is the code for the lawyer page:

{reverse_related_entries orderby=”title”}
<div class=”entry”>
{embed=”site/attorney_link” entry_id=”{entry_id}”}
<h3>{title} – {attorney}</h3>
<p>{about_bio}</p>
</div>
{/reverse_related_entries}

All of the above code would be held inside the {weblog:entries} tag for the specific lawyer. Now the code for the embedded file:

{exp:weblog:entries dynamic=”off” entry_id=”{embed:entry_id}”}
{related_entries id=”attorney”}<h4><a href=”{url_title_path=”attorney”}”>{title}</a></h4>{/related_entries} {/exp:weblog:entries}

The key to making the nested related entry work, is to use the embed method. This allows you to send the entry id of the outer reverse related into a separate page. On the new page, you can do a normal exp:weblog call searching for only that id that was passed through. This will then give you access to the post in the intermediary blog (C) and allow you to call a related entry for either A or B.

If you are still confused after reading this, send me a comment and maybe I can clarify a little further. While this may not be something you use everyday, it definitely can come in handy.

Post to Twitter Tweet This Post

Setting A default image with PHPThumb

Posted in Programming, Websites on August 7th, 2009 by Jason – Be the first to comment

For one of the larger projects that I work on, I use phpThumb, which will create a thumbnail of the requested image and cache it for fast downloads. This is great when you have a large number of images that will be viewed at various sizes and you dont want to export all the various sizes.

One of the problems I ran into recently is setting a default image that will appear if for some reason your source file cannot be located. When you are pulling images from a separate provider, this can become a concern.

PhpThumb has made this easy as their is a setting in the config file as shown below.

phpthumbconfig

All you have to do is add the local path to the file you want as a default into the config and then to test it you can set phpThumb to attempt to load a bad source file and it should display your image. If you are having issues seeing the file, make sure that the names match up, and that you have a forward slash before the path. You can also try doing an absolute path with the entire url to the image.

Post to Twitter Tweet This Post

Another Playstation Error (8002AB0B)

Posted in Programming on June 3rd, 2009 by Jason – Be the first to comment

Yet another error message today, this time when trying to send a message to a friend. I first received the message when I tried to reply to a message received. So I canceled out of the message, repeated the process and got the same error message, repeated and got it again for a third time. So I changed what I typed and it went through without a problem. So I tried one last time with the original message and the error came up once more. Maybe it was something I was writing? “what u doing ?” hardly seems like a message to cause problems. The message that did work: “hi”.

After a quick look online I found that some other people were having the same error. They recommended removing the punctuation from the end of the message, and sure enough it worked. To further test this I tried to send another message, “what u playing ?” and once again I got the error message.

To narrow the problem down this is what I think causes the issue. It is not the fact that there is a punctuation at the end of the message. But it is due to there being a space and then the punctuation by itself. “_?” When I remove the space the same message sends without a problem. So you might ask, why is there a space in the first place? When using the prediction that is to the right of the keyboard it will always put a space after the word to prepare for the next. So if your whole message is predicted… what u doing… then it will put a space after “doing”. If you don’t remove the space [square on the controller] before you put the punctuation then it will cause an error.

Update: So I have refined the problem a little further, it is not the fact that there is a space between the last word and a punctuation, but it is due to there being a space between the last work and a punctuation when the space was created due to the word predictor. If you put in a space your self, then it does not trigger the error. But if you use the word predictor and then a punctuation without removing the space, like clock work the error comes up.

Post to Twitter Tweet This Post

Changing your default homepage

Posted in Programming, Websites on April 23rd, 2009 by Jason – Be the first to comment

There is a quick and simple way that you can change the default page that is loaded when you open up a website. For almost every server, the default value is to first look for the index file. On my server it will first look for an index.php file, if that is not found, it will then look for the index.html file and if neither are found, it will just say page cannot be found, or something to that effect.

If you want to change those settings, your can do it with the server files… or a much easier way, especially for a temp page during website construction is to define the default file within the .htaccess file.

Working with the .htaccess file can be tricky at times, depending on what you are wanting to accomplish, but luckily changing the default start page is simple. First you will need to create a .htaccess file within the root directory of you website. Likewise you can create one inside subfolders, and change the default page for a subfolder as well.

Once you have your file created, you must add the following code.

DirectoryIndex filename.html index.cgi index.pl default.htm

Within this code is where you can specify what you want the default page to be. If you only want one option, just specify one file. If you want multiple options as listed, this will first check for the “filename.html” and if not found it will then check the next file “index.cgi” and so on. Upload that .htaccess file to your server and your in business.

I should clarify that this is for a server with an apache web server, usually that is a linux server.

Post to Twitter Tweet This Post

EE Users post with status Closed

Posted in Ramblings, Websites on April 22nd, 2009 by Jason – Be the first to comment

I recently had a problem where all the users added to expression engine would post to weblogs with a closed status and they did not have the option to change it to open even though they had permissions to do so. It took me a while to figure this one out, but like many things with expression engine, I have found that their are simple solutions to almost all of the issues that I have found, it was just a matter of finding the solutions.

If your having problems with other members publishing as closed status and cant figure out why, try checking the following setting. Select publish and then edit weblogs. For the weblog that you are having problems with, and this could be all of them, you will need to select to edit groups, and from there you will need to make sure that the default option is NOT None, but set to either the Default Status Group or a custom one.

Default Status Group

Post to Twitter Tweet This Post

Quick EE tip, RSS feed not working

Posted in Ramblings, Websites on April 22nd, 2009 by Jason – Be the first to comment

This is not so much a tip for what to do but what not to do. I recently had an RSS page that was giving some strange errors in expression engine. The fix was simple, when you create your template, make sure you select it to be an RSS page. Seems simple enough, but if you select it to be a webpage, everything will look as it should with the exception of just one thing.

When I created the template, I would get the following error in the safari web browser, and would not get results in other web browsers.

The error was: “The feed could not be loaded because the content is not in a known feed format.” (PubSub:2)

After looking at the source code, the only thing that I could see which was different than that of a standard RSS feed was the following line of code.

<ee:last_update>

Why expression engine adds that line, I dont know, but if you see this, be sure to check that your template is set to be an RSS template and not a webpage.

Post to Twitter Tweet This Post

Quickly Delete all emails in Horde Mail

Posted in Programming on April 22nd, 2009 by Jason – 5 Comments

I recently ran into a problem with an email account getting over 3,000 emails within a very short amount of time. The webmail client that was being used is Horde, and there did not seem to be an easy way to just delete all of the emails in the inbox. After a little searching around I found this solution.

First you will need to select Folders from the top navigation. This should bring up a list of all your folders, including your inbox. This screen shot was taken after I already emptied the inbox, which is why it shows (0/0).

picture-4

Once you have selected the folders that you want to empty, you can use the drop down menu above it to empty the folders of all the emails that they have.

picture-7

It should ask for confirmation and then you should no longer have any emails in your inbox.

picture-5

Post to Twitter Tweet This Post

WordPress 7.2.1

Posted in Ramblings, Websites on March 30th, 2009 by Jason – Be the first to comment

After only a few hickups along the way I finished updating the blog to the latest version of wordpress. The main issue I had, and due to not following the upgrade instructions was that after the install the screen would be totally blank, with no error messages. I finally realized that since I had not kept all of my wp-contents files, the theme I was using was not in the new version and so it was causing a blank screen to appear. After I uploaded the theme I use, it worked great. If you want to avoid this problem, you can set the theme to the classic or default theme that come with wordpress, that way when you upload the latest version, it will already have those two themes standard.

Post to Twitter Tweet This Post