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

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
hadion
Forum Members
Forum Members
Posts: 17
Joined: Thu Apr 26, 2007 10:02 am

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

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post by calguy1000 »

Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
JeremyBASS

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

Post 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
Last edited by JeremyBASS on Fri Dec 05, 2008 8:27 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
JeremyBASS

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

Post 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
JeremyBASS

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

Post 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
Locked

Return to “Tips and Tricks”