David,
I know PT can create a virtual directory structure using Mod Rewrite for search.php and wondered whether this is possible for The Big Business Directory? I currently have to hand code all the pages to create the directory structure for The Big Business Directory. Is it possible to create a database that will do this based on a limited number of files? If you have a look at the site you will see how the directory pages and merchant pages currently look.
Kind regards


Hi Stephen, It's certainly
Hi Stephen,
It's certainly doable. Could you perhaps post a couple of examples of your existing URLs, and how you would like them to be rewritten? That will let us work out the re-write rules required, and then work out how you want to tie this in with a database...
Cheers,
David.
David, An example from the
David,
An example from the current layout would be:
Homepage - www.the-big-business-directory.co.uk
Books - www.the-big-business-directory.co.uk/books.php
Bookstores - www.the-big-business-directory.co.uk/books/bookstores.php
Amazon - www.the-big-business-directory.co.uk/books/bookstores/amazon.php
Blackwell Books - www.the-big-business-directory.co.uk/books/bookstores/blackwell-books.ph...
Computer Books - www.the-big-business-directory.co.uk/books/bookstores/computer_books.php
Waterstone's - www.the-big-business-directory.co.uk/books/bookstores/waterstones.php
Bookclubs - www.the-big-business-directory.co.uk/books/bookstores/book_clubs.php
Books Direct - www.the-big-business-directory.co.uk/books/bookstores/book_clubs/books_d...
If it is possible I would envisage the database fields to look something like this:
Category1
Category2
Category3
Category4
Category5
MerchantName
MerchantLink
MerchantDescription
This would make the records look like:
Books
Bookstores
BLANK
BLANK
BLANK
Amazon
Link
Description
Books
Bookstores
Book Clubs
BLANK
BLANK
Books Direct
Link
Description
David, your the expert, but what I think we need for this is a Category listing file for each level which links to the next level up and links to the merchants for that level by merchant name (with clickable merchant link) and 'more details' link to the merchant details file. Level 1's list will go on the homepage, as it is at the moment. We would then need to have a merchant details file which shows their category tree, merchant name (with clickable merchant link) and merchant description. All of this is simply manipulating the data that is already used on the site so if you are unsure about anything then please refer to the URLs above.
Kind regards
Stephen Elcombe
Online Shopping For
The Big Business Directory
David, Any movement on this
David,
Any movement on this yet.
Kind regards
Stephen Elcombe
Online Shopping For
The Big Business Directory
Hi Stephen, Are you
Hi Stephen,
Are you currently using a database at all; and if not, assuming that MySQL is installed on this server are you able to create a database for this project?
Secondly, quite a bit of the work involved in projects like this are the "admin" sections where you manage the entries, categories etc, however it can be done using an admin tool like phpMyAdmin. Do you have this installed; and if not is it something you can look at installing on your server so that you can quickly add/remove links by editing the table using it....
http://www.phpmyadmin.net/
Cheers,
David.
David, I am not using a
David,
I am not using a database at the moment for this site, but I do use both MySQL and phpMyAdmin on the server as it is on the same dedicated server as the PT software.
Kind regards
Stephen Elcombe
Online Shopping For
The Big Business Directory
Hi Stephen, OK - here we go!
Hi Stephen,
OK - here we go! I've written a funky little automated directory script.
Rather than have to have separate rewrites for categories etc., the trick is to have a single rewrite that channels all requests to a single file called directory.php.
The script uses a database table exactly as you have proposed (called "merchants"), and uses Price Tapestry's database library "database.php".
Here is a demo running on this server:
http://www.davidmorison.com/examples/directory/
Like Price Tapestry, the script has a config.php file containing $config_baseHREF which you can set to use the directory at the top level or any sub-directory. Because the top level can contain other files, the root of the directory is not automatically redirected - instead, simply require() the directory.php script within index.php (as included in the .zip).
To setup, edit config.php to contain appropriate values for your server, upload the files to your server and rename htaccess.txt to .htaccess after changing RewriteBase to match $config_baseHREF in config.php. Finally, browse to setup.php. This will create the merchants table. Then, simply use phpMyAdmin to add merchants, and browse to index.php to view the top level category directory....
Plenty of scope for tweaking, and of course you will want to edit directory.php to add your common header and footer - this can be done by simply adding require("header.php") at the top and require("footer.php") at the bottom and then creating those files with the HTML markup required to blend the directory with the rest of your site....
Files on way by email...
Cheers,
David.
David, Thanks for all that,
David,
Thanks for all that, it all seems to be working OK so far. Is there any way to hide the affiliate URLs in the same way that PT does? How do I change the Title, Description and Keywords for each page generated based on category and merchant info?
Kind regards
Stephen Elcombe
Online Shopping For
The Big Business Directory
Hi Stephen, Sure - use a
Hi Stephen,
Sure - use a jump script as follows (in the same directory as directory.php)
jump.php
<?phprequire("config.php");
require("database.php");
$sql = "SELECT * FROM `".$config_databaseTablePrefix."merchants` WHERE id='".database_safe($_GET["id"])."'";
database_querySelect($sql,$merchants);
$merchant = $merchants[0];
header("Location: ".$merchant["MerchantLink"]);
exit();
?>
And then in directory.php, change line 65 from:
print "<h4><a href='".$merchant["MerchantLink"]."'>".ucwords($merchant["MerchantName"])."</a></h4>";to:
print "<h4><a href='".$config_baseHREF."jump.php?id=".$merchant["id"]."'>".ucwords($merchant["MerchantName"])."</a></h4>";...and similarly line 131 from:
print "<li><a href='".$row["MerchantLink"]."'>".ucwords($row["MerchantName"])."</a> - <a href='".$path.$row["MerchantName"].".php'>More details...</a></li>";to:
print "<li><a href='".$config_baseHREF."jump.php?id=".$row["id"]."'>".ucwords($row["MerchantName"])."</a> - <a href='".$path.$row["MerchantName"].".php'>More details...</a></li>";Setting the title and meta tags would depend somewhat on what code you have surrounded the directory script by to blend with your current look and feel.
Have you added a header and footer etc.; and if so, could you perhaps post the code you have added (in other words any modifications made to directory.php) and i'll work out how to add the meta tags for you...
(also if you could post a link to your test installation that would help - feel free to email me if you don't want to post the URL)
Cheers,
David.
Hello David, This looks just
Hello David,
This looks just like what I am after (I am interested in implement REST directory structure). Could you please send me your example files?
James
Hi David, Could you perhaps
Hi David,
Could you perhaps send me a copy of the directory script please?
Thanks,
Simon.
Compare Televisions