ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

auto_path with multi language approach

April 12, 2012 4:47pm

Subscribe [1]
  • #1 / Apr 12, 2012 4:47pm

    outline4

    271 posts

    Hi, I use the following method for multi language approach:
    http://expressionengine.com/wiki/Multi_language_site_alternative

    a lot of stuff works fine, but when it comes to pagination with a different language than the default, it generates a different link

    so here’s my pagination code:
    (nothing fancy)

    {paginate}
       {if total_pages > 0}
        <h1>{gv_pages_{cgv_language_code}}</h1>
       {/if}
          <div class="article_pagination">
           <div class="pagination_left">
            {if "{current_page}" == 1}<span class="pagination_deactivated link">{gv_previous_{cgv_language_code}}</span>{/if}{if previous_page}<a href="http://{auto_path}">{gv_previous_{cgv_language_code}}</a>{/if}
    
            {gv_page_{cgv_language_code}} {current_page} | {total_pages} 
           </div>
           
           <div class="pagination_right">
            {if "{current_page}" == "{total_pages}"} <span class="pagination_deactivated link">{gv_next_{cgv_language_code}}</span>{/if}{if next_page} <a href="http://{auto_path}">{gv_next_{cgv_language_code}}</a>{/if}
     
            {pagination_links}
           </div> 
          </div>
      {/paginate}

    without a /[language_identifier_segment] it all works out:

    when I am on news and I press on next_entry it displays:
    http://www.mysite.ch/news/P2

    when I am on news with a different language it displays the following:
    http://www.mysite.ch/newsindex.php/P2

    somehow a index.php is injected?! and the language identifier is removed…
    I have the same code on a different site with EE 2.3.1 and I don’t have a problem there…

    I am on version 2.4

    actually: where does {auto_path} gets it’s information?

    thanks
    stefan

     

  • #2 / Apr 13, 2012 2:59pm

    Dan Decker

    7338 posts

    Hi Stefan,

    It looks like you may be using .htaccess to remove index.php ?

    If so, you will need a version in each languages’ folder on the server, modified slightly:

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /lang/index.php/$1 [L]
    
            # If 404s, "No Input File" or every URL returns the same thing
            # make it /index.php?/$1 above (add the question mark)
    </IfModule>

    Not the addition of /lang in the RewriteRule - where “lang” would be replaced with the name of the subfolder. Place this modified .htaccess in the folder for the additional languages. One for each language.

    Does that help?

    Cheers,

     

  • #3 / Apr 14, 2012 6:28am

    outline4

    271 posts

    Hi dan, that’s the exact way I have set up my .htaccess files…

    maybe I need to specify, that everything works, exept the {auto_path} variable

    {page_uri} is outputting the correct page uri’s (without the language identifier)
    {page_url} is outputting the correct url (with the language identifier)
    {path="template_group/template"} is working as expected
    structure module is outputting the correct urls

    it’s just the {auto_path} that is behaving strangely when the page is in a different language…

    I am using zoo triggers as well… I tried with zoo triggers deinstalled and installed… it’s all the same!

    without a /[language_identifier_segment] it all works out:

    again:
    when I am on eg.: “/news” and I press on next_entry it displays:
    http://www.mysite.ch/news/P2

    when I am on “/en/news” and I press on next_entry it displays:
    http://www.mysite.ch/newsindex.php/P2 (note, that the language identifier is gone, and index.php/P2 is added

    can you reproduce this?

    stefan

  • #4 / Apr 14, 2012 7:06am

    outline4

    271 posts

    I just installed AB pagination and it does work with it!
    so I’m pretty sure that it must be an EE bug. but I’d like you to confirm it…

    so now I just ask you: can you reproduce the above behavior?

    cheers
    stefan

  • #5 / Apr 18, 2012 1:32pm

    Dan Decker

    7338 posts

    Hi Stefan,

    I’m afraid I wouldn’t be able to replicate because I do not have access to Structure or Zoo Triggers. The only way this could be a bug is if the behavior persists without those add-ons installed.

    Those two specifically intercept and change the way ExpressionEngine handles URLs.

    Have you contacted either add-on author with your questions regarding this?

    Cheers,

  • #6 / Apr 18, 2012 3:35pm

    outline4

    271 posts

    Hi Stefan,

    I’m afraid I wouldn’t be able to replicate because I do not have access to Structure or Zoo Triggers. The only way this could be a bug is if the behavior persists without those add-ons installed.

    Those two specifically intercept and change the way ExpressionEngine handles URLs.

    Have you contacted either add-on author with your questions regarding this?

    Cheers,

    I did disable structure and zoo triggers.
    and I even discovered the same bug with an older EE version 2.3.1.

    stefan

     

  • #7 / Apr 20, 2012 5:42pm

    Dan Decker

    7338 posts

    Hey Stefan,

    Let’s get a little deeper into this then.

    I’ve done a similar multi-language set-up, and used different index.php files to trigger the additional languages. Pretty much the same thing you linked to.

    Can you share with me the variables you have in each index.php ?

    Keep in mind, the trouble you are having can’t be called a bug because what you are doing is unsupported. But since I’ve dealt with mulit-language before, I’m willing to help out 😊

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases