1

Is it possible to make path alias that is not storing in database, like using system hook menu path I want to make url for en/weather and rs/vreme.

e.g

<?php
function weather_menu() {
    $items = array();
    $items['weather'] = array(
      'title' => 'title',
      'description' => t('description hook menu'),
      'page callback' => 'weather_page',
      'access callback' => TRUE,
      'type' => MENU_CALLBACK
    );
     return $items;
}
?>

2 Answers 2

1

Follow below steps to add path aliases to "weather" menu path

  • Enable locale module
  • Go to admin/config/search/path/add
  • Select language rs and add path alias as "vreme" and Existing system path as "weather"

That should work !:-)

6
  • yes i know that, but i want to make system path. e.g. if i want rebuild url alias table i also have to make manually all aliases i have 4 languages and this few similar pages
    – Nikola
    Commented Sep 24, 2012 at 16:32
  • What do you mean by system path ? Do you want to return different data for rs language and different data for english language ? using two different menu callbacks for different languages...
    – Anil Sagar
    Commented Sep 24, 2012 at 16:34
  • sorry anil i posted before i finished the reply. i mean default $items['weather'] path or arg(0)
    – Nikola
    Commented Sep 24, 2012 at 16:35
  • Why cannot you use basic page that supports locale so that you can associate all 4 languages nodes together ? what is the data you are returning in page callback ? Is it just html ?
    – Anil Sagar
    Commented Sep 24, 2012 at 16:37
  • dynamic data in different languages. I'm parsing JSON data in different languages, and i also want because of SEO
    – Nikola
    Commented Sep 24, 2012 at 16:45
0

Oh, I know perfectly what you mean. This is a nightmare in Drupal, to be frank. I don't know why we cannot filter aliases by their module signature and bulk operations are destructive to manually created aliases... But anyway:

If this is a non-Views page, in hook_init() of a module, you could check if the alias exists and if not, create it using path_save(). Then bind it into a path translation set via i18n_translation_set_create()

If this is a Views-generated page you could give a try to http://drupal.org/project/i18_page_views.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.