Полная документация по CMS Drupal (создание сайта, локализация)

Установка и настройка сайта, а также системного окружения. Исключая вопросы программирования новых модулей и тем.

См. документацию на английском: http://drupal.org/node/258

Замена node на content в адресной строке CMS Drupal

.:
лично не проверял, но говорят что делается это так:
:
<?php

 
// Example for Drupal 4.7.x
function custom_url_rewrite($type$path$original) {
  
// This path was already aliased, skip rewriting it
  
if ($path != $original) {
    return 
$path;
  }
  if (
arg(0) =="node" || arg(0) =="" ) {
        
// the system path to change or cloak
        
$patterns[0] = '!^node/(\d+)$!';
        
$patterns[1] = '!^node/add(/)?(\w+)?$!';
        
$patterns[2] = '!^node/(\d+)/edit$!';
        
// the new cloaked name
        
$replacements[0] = 'content/\1';
        
$replacements[1] = 'content/add\1\2';
        
$replacements[2] = 'content/\1/edit';
    return 
preg_replace($patterns$replacements$path);
  }
  if (
$type == 'source') { // URL coming from a client
        // match the patterns created by the path change
        
$patterns[0] = '!^content/(\d+)$!';
        
$patterns[1] = '!^content/(\d+)/edit$!';
        
$patterns[2] = '!^content/add(/)?(\w+)?$!';
        
// send on to the correct system path
        
$replacements[0] = 'node/\1';
        
$replacements[1] = 'node/\1/edit';
        
$replacements[2] = 'node/add/\2';
    return 
preg_replace($patterns$replacements$path);
  }
  elseif (
$type == 'alias') { // URL going out to a client
    
return preg_replace('!^node/(\d+)$!''conent/\1'$path);
  }
}
?>
 
a Visitor posted on: Sun, 2007-01-21 21:55.

i followed the notes, but didnt' work.. i think it has something to do with this line...
return preg_replace('!^node/(\d+)$!', 'display/\1', $path);

all my links showed us as /display/#/ .. changing that line to 'content' fixed it.

leftover from an old implementation?

-bruce

Hiveminds posted on: Tue, 2007-01-23 13:37.

I tested and confirmed that the code was effecting the usage of aliasing because of the typo. The snippet is now correct.

a Visitor posted on: Mon, 2007-02-26 04:13.

You make a very valid point for footprinting. I want to change my 5.0 install node to content... Can you confirm that this works in 5.0 and do I need the PHP tags in there? The settings.php I have now has an opening PHP tag but no closing tag and lots of remarks...

Thanks.

a Visitor posted on: Fri, 2007-03-02 16:23.

i tried it in 5.1 and it didn't work.

a Visitor posted on: Fri, 2007-04-20 03:19.

Isn't line 32 'conent/\1'
supposed to be 'content/\1' ?

a Visitor posted on: Tue, 2007-06-12 21:34.

using post I think is more logical unless I'm overlooking something.. I mean my site is majorly based on forum content so the users know what a post is most likley. I mean some of my users I know don't even understand the word content that well.

I'm wondering, are there any problems in changing /node/ with the settings script that can effect a site in the future?

Also, do you think /post/ is more suitable?

a Visitor posted on: Sat, 2007-06-23 17:27.

If you are the type that has to upgrade with every release then you may no want to do this. It can be done in 4.7 but not in 5.1 and 6.0 is an unknown.

 http://www.hiveminds.co.uk/node/3185
-----------
 
еще способ:
----------- 
 

По умолчанию, после названия домена, Drupal добавляет слово node. Но его можно заменить любым другим словом. Делается это следующим образом.

Добавьте в файл settings.ini следующий код:

function custom_url_rewrite($type, $path, $original) {
  if ($path != $original) {
   return $path; }
  if ($type == 'source') {
   return preg_replace('!^document/(\d+)$!', 'node/\1', $path); }
  elseif ($type == 'alias') {
   return preg_replace('!^node/(\d+)$!', 'document/\1', $path); }
}

Примечание

По умолчанию этот файл доступен только для чтения, поэтому сначала разрешите запись в этот файл, а после внесения изменений обязательно верните атрибут «только для чтения» обратно.

http://setegnom.com/node/280 

-------