PHP Links Directory and WordPress
I read once that having a links directory on your website is good for helping to promote your site. Searching around a bit, I finally found just what I was looking for, and it was free! The solution: PHP Links Directory (from phplinkdirectory.com - the free version is in the left sidebar).
It did everything I could ask for: it stored the links in a database, so updating was extremely easy; you could add a description of the link; you could specify whether the link would open in a new window; you can select specific links as featured links (always on top and set apart from the rest of the links on the page); the links were arranged into categories (which helps eliminate long link lists, which google and other search engines frown upon); you could click a button to have the program check all reciprocal links, and the look was highly customizable! Perfect…until I switched to WordPress.
Problem 1: Writing PHP In The .tpl Files [SOLVED]
Since PHP is written alot differently in PHPLD’s template files (which end in .tpl, rather than php), it took me quite a while to even figure out how to include a file, which ends up looking like this:
{php}
include(filename.php);
{/php}
Problem 2: Conflicting PHP Variables
Even with that, trying to include my WordPress header is a mess. At first, all I would get was PHP errors. After spending way too much freakin’ time, I discovered this was because PHPLD runs 2 functions (in a functions.php file) that WordPress also runs: get_page() and get_category(). I ended up working around this by changing those to get_pagex() and get_categorys(), then updating those changes in PHPLD’s index.php file.
UPDATE: Do Not Do This! It screws up a lot more than just the index.php file, and is quite the hassle.
Problem 3: Include Path [SOLVED 06.10.07]
After all that, my header still wouldn’t appear. Since the PHPLD is in it’s own subfolder on The Mind’s Chew Toy, WordPress isn’t finding the files it needs to run the PHP variables in my header file. Plus, somewhere in the PHP folder, it’s setting the include path to point to the subfolder as a base, despite my every effort to the contrary.
Starting to get desperate, I googled every word/phrase combination I could think of to try to help me with this problem…with no success. I did discover how to include the WordPress header and footer on a static page (thanks to the wordpress.org forums), but since the include path is being overriden by something in the directory, that doesn’t work in this case.
While working on something totally different, I finally figured this part out! If you are trying to put the include in another folder that is LOWER than WordPress(ie…themindschewtoy/google rather than themindschewtoy/blog/google), you have to include the ABSOLUTE path to the file (ie home/html/themindschewtoy/google rather than ./google). Now that I’ve finally figured that out, I’m going to have to take another look at this links program and see what I can do!
UPDATE: Even with the correct directory, this still produced php errors for me.
Is This Even Possible?
At this point, I was beginning to think it couldn’t be done, as I hadn’t seen any working examples of integrating PHPLD with WordPress yet. As I got more and more desperate to try to find a solution to my dilemma, I begin to click-through each and every poster on the PHPLD forum…and stumbled across someone who looked to be doing exactly what I wanted to do (check it out here)!
Does AJAX Include Solve It? [NO]
Now bolstered by knowing that it could be done, I reopened the PHPLD template files and begin messing around again. When that failed, I tried doing an AJAX include (from dynamicdrive.com) on a page template in WordPress. That worked…with one problem. Since it’s an included file, clicking a link doesn’t change the page address. This is a real problem for reciprocal links, as you need to provide the address the page is on.
Now What?
After spending way too much time working on this, I decided to put this aside for the moment, and get back to transferring the old PezXPress pages into the new WordPress version of The Mind’s Chew Toy.
If anyone has any ideas on ways to work this, please comment and let me know. Or, if you’ve discovered a link directory with the same types of options (especially the automatic reciprocal link checker and the featured links, which rules out the Links Setup included in WordPress) that you’ve been able to integrate with WordPress, let me know! Heck, even if you’re having the same sort of problems, add a comment and I’ll commiserate.
If I ever get this to work, I’ll post the solution. Until then, no links page will be found connected with the new WordPress’ed version of The Mind’s Chew Toy.



Leave a Reply