Page 1 of 1

How to: change news url to your own language News -> e.g. Niews

Posted: Fri Dec 05, 2008 7:26 pm
by hadion
Hello all,

For a website of my customer I wanted to change toe URL of the news module. In CMS MS 1.5.1 it's standard like:
http://domain.com/news/1/55/Test/description/

This topic is going to teach u guys how to change it to the `news` part to your own language!
For example: http://domain.com/nieuws/1/55/Test/description/ ( nieuws = dutch for news )

'Replace by' are examples, can also choose your own word instead "News".

On your server change:
modules/news/action.default.php:
rule 325:
    $onerow->file_location = $config['uploads_url'].'/news/id'.$row['news_id'];

replace by:
    $onerow->file_location = $config['uploads_url'].'/nieuws/id'.$row['news_id'];

rule 339:
    $prettyurl = 'news/'.$row['news_id'].'/'.($detailpage!=''?$detailpage:$returnid)."/$aliased_title";
replace by:
    $prettyurl = 'nieuws/'.$row['news_id'].'/'.($detailpage!=''?$detailpage:$returnid)."/$aliased_title";

modules/news/action.detail.php:
rule 91:
$onerow->file_location = $config['uploads_url'].'/news/id'.$row['news_id'];
replace by:
$onerow->file_location = $config['uploads_url'].'/nieuws/id'.$row['news_id'];


modules/news/News.module.php:
$this->RegisterRoute('/[nN]ews\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)\/d,(?P.*?)$/');
$this->RegisterRoute('/[nN]ews\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)$/');
$this->RegisterRoute('/[nN]ews\/(?P[0-9]+)\/(?P[0-9]+)$/');
$this->RegisterRoute('/[nN]ews\/(?P[0-9]+)$/');
replace by:
$this->RegisterRoute('/[nN]ieuws\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)\/d,(?P.*?)$/');
$this->RegisterRoute('/[nN]ieuws\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)$/');
$this->RegisterRoute('/[nN]ieuws\/(?P[0-9]+)\/(?P[0-9]+)$/');
$this->RegisterRoute('/[nN]ieuws\/(?P[0-9]+)$/');

Hope to help you guys out with it :) GL.

Re: How to: change news url to your own language News -> e.g. Niews

Posted: Fri Dec 05, 2008 7:27 pm
by calguy1000

Re: How to: change news url to your own language News -> e.g. Niews

Posted: Fri Dec 05, 2008 8:17 pm
by JeremyBASS
Thought I think there are many times when we have no choice but to "hack" the install ... this may not one of them...

do this...

{assign var=utmpNEWS value=$entry->moreurl|replace:'news':'nieuws '}

then use place {utmpNEWS} in place of {$entry->moreurl}

don't remember but I think you can do this as well for
$entry->titlelink

but moreurl is the href,  so for the title link you'd just do the normal with the moreurl and title

you can even go crazy with it and change the landing page... since there is no way to assign one...  ;)

{assign var=utmpNEWS value=$entry->moreurl|replace:'news':'nieuws '|replace:'/15/':'/72/'|replace:'/72/15/':'/15/72/'}
if shown on page with id 15 having the landing page as pageid 72

no file hacking needed...  ;D

need proof?  vist my sandbox and note that 1.) the news is in the domain of .biz and 2.) that the links on .com go there to the landing page in biz from com...  you can see the same thing with the blog list on the right as it's shown on all domains but only goes to one and a landing page...

http://www.corbensproducts.com/

cheers
jeremyBass

Re: How to: change news url to your own language News -> e.g. Niews

Posted: Fri Dec 05, 2008 9:59 pm
by calguy1000
good post JermeyBaSS

even though your details might not be correct, you illustrate that with a bit of reading, there is alot you you can do with CMS without having to modify any CMS sources.

Re: How to: change news url to your own language News -> e.g. Niews

Posted: Fri Dec 05, 2008 10:14 pm
by JeremyBASS
yeah I should have said I didn't test
{assign var=utmpNEWS value=$entry->moreurl|replace:'news':'nieuws '}

but this does work

{assign var=utmpNEWS value=$entry->moreurl|replace:'/15/':'/72/'|replace:'/72/15/':'/15/72/'}

sorry I thought I said that :D

Re: How to: change news url to your own language News -> e.g. Niews

Posted: Sat Dec 06, 2008 1:37 am
by JeremyBASS
ok so I tested that and it does not work... the
|replace:'news':'nieuws '
part, not the rest... the rest works as I have it in action now in my sandbox...

may-be a "more acceptable” route would be to make news part of the lang file?  that why it could be added to the mod?

my2cents... at least the rest of what i wrote works... lol...  ;D

jeremyBass