Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard
Author Message
phoenix-cms
Worker
Worker


Joined: Aug 05, 2005
Posts: 139

PostPosted: Thu Sep 22, 2005 11:17 am Reply with quote

in .htaccess add the following

Code:
RewriteRule ^article-([0-9]*)-([a-z]*)-([0-9]*)-([0-9]*)-([[:punct:]/:\-\'(){}.&=_a-zA-Z0-9\ ]*).html modules.php?name=News&file=article&sid=$1&mode=$2&order=$3&thold=$4&btitleme=$5 [L]


Open modules/News/index.php

FIND:
Code:
$story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;sid=$s_sid$r_options\">";


REPLACE WITH:

Code:
$title = str_replace(" ", "_", $title);

$story_link = "<a href=\"article-$s_sid-flat-0-0-$title.html\">";


now you get titles in html

but its still on long side i need to remove -flat-0-0- i think its cookie but not 100% on this
does anyone know hoe i can remove this without breaking the code

thanks

steve
 
View user's profile Send private message Send e-mail
phoenix-cms
PostPosted: Thu Sep 22, 2005 11:46 am Reply with quote

i found tht you can remove -flat- by replacing it with -$cookie[4]- but html now looks like this article-1--0-0-just_small_test.html
 
64bitguy
The Mouse Is Extension Of Arm


Joined: Mar 06, 2004
Posts: 1159
Location: Sanbornton, NH USA

PostPosted: Fri Sep 23, 2005 1:42 am Reply with quote

Actually, the News/index.php should read
Code:
$title = str_replace(" ", "_", $title); 

$story_link="<a href=\"article-$s_sid-$mode-$order-$thold-$title.html\">";


Or you could simply remove all of that (as the comments function will define it if needed) and just have it as:
Code:
$story_link="<a href=\"article-$title.html\">";
but you'd need to create a seperate rule for having it this way that didn't include the article ID (converted in the rule to use title) nor include mode order and threshold.

At minimum, you should have it as:
Code:
$story_link="<a href=\"article-$s_sid-$mode-0-0-$title.html\">";
so that the user's rules for the mode of displaying comments is correctly applied.

_________________
Steph Benoit Only registered users can see links on this board! Get registered or login!
1CMS, 100% Section 508 and W3C XHTML/CSS Compliant (Truly) 
View user's profile Send private message Visit poster's website
phoenix-cms
PostPosted: Fri Sep 23, 2005 12:07 pm Reply with quote

there one thing removing some of - for the html becuase you get something like article-01---some_news_topic.html

you got any idears maybe better way of writing htaccess
 
64bitguy
PostPosted: Fri Sep 23, 2005 2:41 pm Reply with quote

Well, ideally, you wouldn't edit those files at all other than to change the global variable of that "function", and to add the "replace" call that changes title blank space to underscores. The only other change would be the link itself in replacing the article number variable with the title variable.

Then, you would create in/out rules and .htaccess rules to change the index.php results.

In GT-Nextgen it would be like this
In:
Code:
"'(?<!/)modules.php\?name=News&amp;file=article&amp;title=([a-zA-Z0-9_-]*)&amp;mode=([a-z]*)&amp;order=([0-9]*)&amp;thold=([0-9\-]*)'",


Out:
Code:
"article-\\1-\\2-\\3-\\4.html",


.htaccess:
Code:
RewriteRule ^article-([a-zA-Z0-9_-]*)-([a-z]*)-([0-9]*)-([0-9\-]*).html modules.php?name=News&file=article&title=$1&mode=$2&order=$3&thold=$4 [L] 


Which would make the link: Only registered users can see links on this board! Get registered or login!

As you are simply creating a new function to replace the article number with a title variable, you would add that variable to the global call of that particular "function" in the index.php of the module as in:
Code:
 global $title, $mode, $order, $s_sid, $thold, etc....

and then change the call in link by replacing the article number variable with the title variable in the index.php

To complicate matters, there are so many functions that use the article number to do what they do, this adds a level of serious complexity to the result links. Things like comments, etc... make this a living hell to add this function without seriously altering nuke core code.

If you just want to stick to the front page for the morelink though and not use those function at all (as they are only needed for comments and the like) you would not touch anything but the function's global and simply change the moreline, we're talking about the:
Code:
$story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;sid=$s_sid$r_options\">";
where you would make the change to be:
Code:
$story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;title=$title\">";

and of course don't forget the global after the:
Code:
function theindex($new_topic=0) {

in the index.php too.

Then the googetap variables =:
In:
Code:
"'(?<!/)modules.php\?name=News&amp;file=article&amp;title=([a-zA-Z0-9_-]*)'",

Out:
Code:
"article-\\1.html",

.htaccess
Code:
RewriteRule ^article-([a-zA-Z0-9_-]*).html modules.php?name=News&file=article&title=$1 [L]


This produces: Only registered users can see links on this board! Get registered or login!

Short and sweet.
 
phoenix-cms
PostPosted: Mon Oct 03, 2005 4:58 pm Reply with quote

hi 64bitguy, i been using your code here, and using same techniqe over other modules,
but one thing that bothers me titles show up as .html but its always redirected to modules.php?name=
is there way to show html or something i done wrong

thanks

steve
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©