User account menu

  • Log in
BXTra.net

Breadcrumb

  • Home
  • Articles
  • Know Base Path function for Drupal with Multilanguage (i18n version 2.1)

Know Base Path function for Drupal with Multilanguage (i18n version 2.1)

By BXTra | 10:50 AM PDT, Sun May 13, 2007
Drupal 5.1
Drupal

My problem was that I want imagefield that user can click in Teaser view, then, bring user into the node. (Default without contemplate, the click will do nothing. By clicking at the title is the only option.)

By wring the code in contemplate, there are 3 parts that I need to do.

1. A function to get Basepath (Ex.www.bxtra.net)
2. A function to get i18n path (Ex.en, fr, etc.)
3. A function to get node that the link will go to.
It will end up like this -> http://www.bxtra.net/en/node/4

I'm not a drupal expert at all and I just did online search for what I want and tried that. So, I've tried a few options below :

1. <a href="nid ?>">  

Result : http://www.bxtra.net/en/node/4

2. <a href="nid ?>">   

Result : http://www.bxtra.net/node/4

3. <a href="nid"); ?>">   

Result : http://www.bxtra.net/en/node/4

 

For option 2, it works fine since the i18n will pick current language for you. So, no need to put /en/ at all. Whatever language you're using, it will stick to that language.

I also had tried using the function base_path() in the option 2 before I found $base_path and the result was not what I'd expected. I got http://node/4 which was not correct. I had no idea why the same function, just without i18n_get_lang() showed a different result.

Actually, I'd used option 1 for quite a while and looked into something different than option 1 because I usually got error page like

          ->  http://www.bxtra.net/en// (Double trailing slash) 

I don't know why the program generated that page and I thought that it could be because of the code I'd used. So, right now, I switched to option 3 and see if I still got the same problem or not.

About text formats
  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Anonymous

17 years 7 months ago

Permalink

Correct call to link

Hi friend. I don't speak in enlgish very well. But I understand you question. All the links in Drupal should called via "l" function, so, if you have activated the i18n the function "l" will convert the link to correct Drupal link. I hope you understand. Best, Dario dario.php@gmail.com
  • Reply
  • Add new comment

  • Will the router get the Openvpn as a client option?
    6 years ago
  • cancellation
    6 years 1 month ago
  • Router ASUS RT-N12 D1 tomatoes passwort falsch
    7 years 8 months ago
  • WPS button = 30/30/30 hard reset button
    7 years 9 months ago
  • Save my day!
    8 years 3 months ago
  • How to
    8 years 6 months ago
  • Can i still access my modem (the one with the ISP provided)?
    8 years 6 months ago
  • A saving step!
    8 years 10 months ago
  • Problem with Asus n12e-c1
    8 years 11 months ago
  • don't use Hostgator
    9 years 2 months ago

© 2007 - 2023 BXTra.net. All Rights Reserved. 
Certain other content, photos and artwork displayed on BXTra.net are protected by copyright and are the property of their respective owners.

Privacy Policy