Author |
Message |
phoenix-cms
Worker


Joined: Aug 05, 2005
Posts: 139
|
Posted:
Thu Sep 22, 2005 11:17 am |
|
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&file=article&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 |
|
|
|
 |
phoenix-cms

|
Posted:
Thu Sep 22, 2005 11:46 am |
|
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: 1164
|
Posted:
Fri Sep 23, 2005 1:42 am |
|
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
100% Section 508 and W3C HTML5 and CSS Compliant (Truly) Code, because I love compliance. |
|
|
 |
phoenix-cms

|
Posted:
Fri Sep 23, 2005 12:07 pm |
|
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

|
Posted:
Fri Sep 23, 2005 2:41 pm |
|
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&file=article&title=([a-zA-Z0-9_-]*)&mode=([a-z]*)&order=([0-9]*)&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:
http://yourdomain.com/article-[article-title]-[whatever-mode]-[whatever-order]-[whatever-threshold].html
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&file=article&sid=$s_sid$r_options\">";
| where you would make the change to be:
Code:$story_link = "<a href=\"modules.php?name=News&file=article&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&file=article&title=([a-zA-Z0-9_-]*)'",
|
Out:
.htaccess
Code:RewriteRule ^article-([a-zA-Z0-9_-]*).html modules.php?name=News&file=article&title=$1 [L]
|
This produces:
http://yourdomain.code/article-[article-title].html
Short and sweet. |
|
|
|
 |
phoenix-cms

|
Posted:
Mon Oct 03, 2005 4:58 pm |
|
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 |
|
|
|
 |
|