PDA

View Full Version : V3 Articles: Mod Rewrite : Archive


tfw2005
01-07-2005, 10:43 AM
Looking for someone to do the following. I gave it a shot, but I couldnt quite get it.

A mod rewrite for articles similar to the forum mod rewrite seen here:

http://www.daniweb.com/techtalkforums/thread9379.html

I have it on my boards, helps immensely.

Second, an articles "archive" per say. I currently have a template driven articles archive in place, but due to the lack of mod rewrite for article urls and category urls, google is not digging it. Seen it in there a couple times, but it keeps on going. Yet I have 5-30 Google Spiders in my forum archives at all times. Both are using the same stylesheet/CSS. So I am thinking it has to be the lack of proper mod rewrite.

You can see my current articles here:
http://www.tfw2005.com/boards/article.php

You can see my attempt at an articles archive here:
http://www.tfw2005.com/boards/article2.php

Even if someone can just make a good rewrite, a full "archive" system may not be necessary. I can make available my article2.php file and the templates using the stripped design/CSS, and it should be good to go for everyone.

Ive seen other article systems, some with archive like support or forum archive support, but I like this one, because it is seperate from the board system. As you can tell, Ive modified the listing pages to be bare bones, and want to keep it that way.

Any help appreciated. Thanks!

WetWired
01-07-2005, 11:56 AM
Looking for someone to do the following. I gave it a shot, but I couldnt quite get it.

A mod rewrite for articles similar to the forum mod rewrite seen here:

http://www.daniweb.com/techtalkforums/thread9379.html

I have it on my boards, helps immensely.

Second, an articles "archive" per say. I currently have a template driven articles archive in place, but due to the lack of mod rewrite for article urls and category urls, google is not digging it. Seen it in there a couple times, but it keeps on going. Yet I have 5-30 Google Spiders in my forum archives at all times. Both are using the same stylesheet/CSS. So I am thinking it has to be the lack of proper mod rewrite.

You can see my current articles here:
http://www.tfw2005.com/boards/article.php

You can see my attempt at an articles archive here:
http://www.tfw2005.com/boards/article2.php

Even if someone can just make a good rewrite, a full "archive" system may not be necessary. I can make available my article2.php file and the templates using the stripped design/CSS, and it should be good to go for everyone.

Ive seen other article systems, some with archive like support or forum archive support, but I like this one, because it is seperate from the board system. As you can tell, Ive modified the listing pages to be bare bones, and want to keep it that way.

Any help appreciated. Thanks!
Why is mod_rewrite neccessary? Why can't you just do it like the vB3 standard archive system, where a php file poses as a directory and extracts and uses that path beyond it as the parameters? If you're concerned about having a directory with an extention, you can use a php file without an extention and use forcetype to make apache use it as a php file.

tfw2005
01-07-2005, 12:18 PM
Well, I would like mod rewrite for the regular style that all visitors see regardless if it is used in the archive system. Helps minorly with Google Ive found, and, cleaner for linking purposes generally.

As for the archive version, whatever method gets rid of the php strings in the URL I think will suffice, whether it is in the default VB forum archive style, or a mod rewrite style does not matter to me.

I personally dont have the skill set to write an article archive file from scratch like the VB one, and, my attempts at modding the VB forum archive file to work for articles have been unsuccessful.

What I did here, for myself, at least gives me a "printable page" version of the article. One that with a mod-rewrite, will serve it's purpose as an archive.

If you guys can help out in either method, I think alot of people would desire the end result.

WetWired
01-07-2005, 10:17 PM
To access your system by paths instead of parameters, add the following to the .htaccess in the directory containing articles.php , creating the file .htaccess if neccesary:
<Files article>
ForceType application/x-httpd-php
</Files>


Then, make a copy of article.php , renaming it to article without an extention. Add to that file before the c= and a= parameters are decoded:

//find the path past this file
$pageName='article';
$pageUrl=$_SERVER['REQUEST_URI'];
$pageUrl=substr($pageUrl,strpos($pageUrl,'/'.$pageName)+strlen($pageName)+2);
$fetchType=0; //default to an index load
if(substr($pageUrl,0,2)=='c/'){
$fetchType=1;
}else if(substr($pageUrl,0,2)=='a/'){
$fetchType=2;
}
$partNumber=intval(substr($pageUrl,2));
if($partNumber==0){
$fetchType=0;
}

if($fetchType==1){
$c=$partNumber;
}else if($fetchType==2){
$a=$partNumber;
}


If you use $_GET['a'] and $_GET['c'] or $_REQUEST['a'] and $REQUEST['c'], then use those instead of $a and $c in the last 5 lines.

This will allow you to access articles like:
article/a/100
or
article/a/100.html

and catagories like
article/c/100
or
article/c/100.html

Then, change the code to generate this type of URLs and change all image paths to absolute references.

AlexanderT
01-08-2005, 02:44 PM
This will put extra stress on your server though, for extra single page queries in your forum.

tfw2005
01-19-2005, 05:49 AM
I utilized a regular styled mod rewrite for both the regular articles section, and the "archive" articles section, which in this method is just a new set of templates with stripped html, streamlined CSS, and the new hardcoded links to the mod rewrites.

After i get my bearings straight, I will try and put together a package with instructions, and the more experienced people here can judge if it is worthy or not, and pick any problems out.

Overall, no change in speed for site, cleaner for direct links, and google has been active in the archive version of it hardcore since it went live. Been watching whos online very closely. Most of my incoming google Guest traffic also now goes to the archive for articles and of course the board archive.

Can see it in action here:

www.tfw2005.com/boards/transformers-articles.html

www.tfw2005.com/boards/transformers-archive.php

Natch
01-19-2005, 07:04 PM
The reason we were able to get so much information out without increasing load in the hack defined on dani-web, was soley because of the forumcache; to do the same thing for the articles hack, you will need to create an articlecache to ensure that you can get access to your information, without heavy query load.

tfw2005
01-20-2005, 01:06 AM
The reason we were able to get so much information out without increasing load in the hack defined on dani-web, was soley because of the forumcache; to do the same thing for the articles hack, you will need to create an articlecache to ensure that you can get access to your information, without heavy query load.
Well, the way it is currently set up now, I am not seeing any change in load time/stress. In fact, pages are loading quicker over the last couple days, minus a few server hiccups, which are common here anyway.