Wordpress plugins, examples on PHP, MySQL, JavaScript, MooTools and CSS

  • SlideItMoo Wordpress Plugin
  • MooTools Fancy Animated Tabs
  • Wordpress YouTube playlist plugin
  • MooTooltips – easy to make good looking tooltips
  • SlideItMoo – image slider

JavaScript drop down menu using Mootools 1.2

July 31st, 2008 in Mootools | 110 comments

I’ve been using for some time by now but this is my first article on it. For those of you that don’t know what is, I’ll tell you only this: It’s my life saver when it comes to . The moment I found out it exists, I started using it and enjoyed every moment. Go check the official page for more details.

In this example I will present you a very easy, unobtrusive way to create a drop down menu. We will need the core build and the Fx.Slide component found in the More Builder. …view full post

Write more compact php code

July 10th, 2008 in PHP | 4 comments

I’ve been programming using and MySQL for about 4 years by now. One thing that I’ve always hated was to write code. Don’t get me wrong, I love coding, what I hate is writing in 10 lines what I could do in 5. Besides the fact that is a terrible waste of time and effort, when I was put in the position of revising the code at a later time (to make changes or just for the sake of improving the code) I found myself in trouble trying to understand what the hell I was thinking back then. Another scenario is when someone else is taking what you started ( I know this because I had to take on someone else’s projects ).

Giving this, why not spend a little time thinking first and then start coding? Below are a few things I’ve found out with time. …view full post

Output folder content in XML file

July 3rd, 2008 in PHP | 58 comments

xml output Usually in a Flash gallery the images are shown using an XML file generated by the server (in our case using ). So, how do you create that XML file used to output the contents of your images folder?

Starting with 5, we have some new tools added that ease out work. One in particular is of interest and that’s SimpleXML. In plain english, it offers the possibility to convert XML to an object and that may be used later in the code with simple array iterators. More than that, it can also output XML valid code to generate XML files.

For this example, besides SimpleXML, we’ll need one more thing: a way to read the folder containing the images. And for that we have readdir. So the process will go like this: first we need to read the entire directory with readdir() and after that we need to generate the XML output using SimpleXML. Remember, SimpleXML is available in starting with version 5, so make sure you have it installed on your server.

To check your server version, simply create a file called phpinfo.php and inside it put only this: <?php phpinfo(); ?> – after that, upload the file on your web hosting service. Open your favourite web browser and point it at this file ( www.mywebaddress.com/phpinfo.php ). The first this you’ll see will be the server version ( something like Version 5.x.x ). Remember to delete the file after you’re done. …view full post

PHP highlight search keywords

April 11th, 2008 in PHP | 30 comments

php highlight keywords While performing a search, it’s ofter very useful to highlight in different colors, backgrounds or styles the search keywords in the results returned. This keeps focus on the keywords and helps scan the page faster to find the more relevant results.

But how exactly can that be done? As a basic idea, the following code ( a class ) practically takes as parameters the text that needs to be highlighted and the particular keywords that need to stand out. Using a regular expression, every keyword in the text is replaced with a span HTML element having different styles applied according to the keyword it matches.

Please remember that the code below is just an example, it can be and should be extended; I’m only presenting it for demonstration and “how to” purposes. …view full post

Useful PHP classes and other great tools

February 16th, 2008 in Tools of the trade | 2 comments

From time to time there is a task that needs to be accomplished and it’s a quite difficult one. When that happens and the deadline is tight it’s a very good solution to search the web for what you need. Below, I’ll put some good stuff I found on the web. …view full post

Gzip output, minify CSS and JavaScript

February 13th, 2008 in PHP, Tools of the trade | 11 comments

Smaller pages mean smaller downloads and faster page loading. As a programmer, my primary goal is to develop code that parses fast and consumes the minimum amount of resources. Bandwidth and filesize were not a problem that I realized until lately. So, what can you do to reduce filesize and as a consequence to that to use less bandwidth? …view full post

PHP read directory

October 30th, 2007 in PHP | 11 comments

The other day I found myself having a problem with not empty directories. I had to delete a directory that had another directory in it that contained a file. Giving the fact that I’m a lazy programmer, I had to find an easy enough solution to use then and every time I needed it without doing much work every time.

So I came up with a class that reads the whole directory, it stores in 2 different arrays all the files and subdirectories (the full path to them, starting with the given directory) and than it deletes them if one wants to do that. If you need such code use the one below. It worked fine for me so it should read the directories for you too. Here goes: …view full post

PHP login

September 7th, 2007 in PHP, Security | 14 comments

After searching the web for a php login script (and you can find tons of it), I declared myself a little bit unsatisfied. I was looking for something simple yet powerful and I found all sorts of login scripts (a lot of them not safe at all). By the way, as a warning, BEWARE OF THE LOGIN SCRIPTS THAT HAVE SOMETHING LIKE: $_SESSION['has_access'] = true; INTO THEIR CODE followed by the explanation:”and you simply check the pages using if($_SESSION['has_access'])“.They are not safe at all, but that’s another discussion.

So, what was i looking for? Well, as I said before, the login script should be small, reusable, simple to understand and implement, it should check the user on every page (and I mean CHECK like … strip search). Since the www offer was not good enough, I started implementing my own code.

In order to make it reusable, I thought about creating an object to do this task for me. So, what this php login script does it’s actually quite simple: for every secured page it is installed on, it checks using the data stored in session if the user credentials are ok and if they are it returns his/her details from the database. …view full post

Verify your link exchange partner

August 25th, 2007 in Tools of the trade | no comments

This SEO thing is a pain in the @$$ sometimes. You work and try to find good partners with good page rank to help your domain rank higher and in exchange for a link on his website, you put one of his on yours.

Well, some webmasters are honest. But some are not. And that’s when the process starts to get messy. You put his link and than you start the watch: did he put your link on his page? Is the link clean (no rel=’nofollow’, javascript, frames or other things)? So, you start typing his web address in your browser, select the view source option and perform a search. This is time consuming and not very productive. In this time you could do something more useful.

For that particular reason I started the development of a tool I called backlink verifier. For now, what it does is simply crawl your partner’s page that you specify and search for your domain in all the links available on that particular page and when it finds it it checks whether your link has a nofollow attribute on it or not. Simple, no pain, no source code for you to search into. It will also display the number of links available on page, how many are outbound links and how many nofollow links are on the page.

If this tool will provide itself useful, I will develop it further so please feel free to comment on this article any problems, wishes or things you think it should do.

As a future development “to do” list, I have in mind the following:

  • display outbound links available on partner’s webpage
  • user accounts so that you simply log in and start testing all addresses you added to your accound
  • crawling at least 2 levels deep on your partner’s webpage (for now it only crawls the address you insert)
  • cronjob that will e-mail you if one of your links gets changed / is removed
  • listing of the title text used on your link

Again, you can find the backlink verifier tool here.

Coolest web archive ever – wayback machine

August 24th, 2007 in Tools of the trade | no comments

This is so cool. By accident I found the web.archive.org website. It has web pages dating since 1996 from what I’ve found out reading the info available. It looks like it’s based on an open source web crawler called Heritrix. The list of contributors is huge and thanks to them we can now see how the internet was looking like 10 years ago. If you are an internet addict you’ll love this.

Pages available for a certain domain are chronologically ordered (years, months) and you can browse the whole website not just an index page.

I really REALLY recommend you to visit this website. It made me remember of my teenager period with Starcraft (lots of it) and unfortunately no internet.

For fun, this is how various big fishes used to look like not so many years ago.

Google webpage at Nov 11, 1998

Google webpage 1998

Yahoo webpage at Oct 20, 1996

Yahoo homepage 1996

Blizzard webpage at Oct 19, 1996

Blizzard homepage 1996