Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: hiding prefix for default language not working? how to order language switch links?

Status Resolved
Add-on / Version Publisher 1.1.4
Severity Critical
EE Version 2.7.3

Janine Dalton

Feb 14, 2014

First time implementing Publisher on an existing EE site which was just in English originally and now needs to be in more languages.

I would like that the original site URLs will continue to be used for the English version and that the other versions will use a prefix, but I can’t seem to get this working correctly.

I have the following settings:
Add URL prefix - Yes
Force URL prefix - No
Force default language - No
Force default language in the Control Panel - Yes
Get language from browser - Yes

I have also added the following to my config file:
$config[‘publisher_hide_prefix_on_default_language’] = ‘y’;

While the original site URLs would still work, when I load mydomain.com (or choose the English version from the language switch links), all the links through the site still have the en prefix.
I was hoping that the idea of hiding the prefix for the default language was that I would never see URLs with the en prefix?

Another query is that if I load up mydomain.com it’s shown in the last language I switched to. Is there a way of ensuring that the non prefixed URLs will always show the default English version of the site?

Finally, my client wants the language switch links listed in a certain order but I can’t see any ordering parameters for {exp:publisher:languages}. I tried renaming the languages I had set up so that the IDs were in the right order, but this had no effect, and setting the order in the show parameter didn’t work either. How can I set the order the languages are listed in? Here is my current code:

{exp:publisher:languages}
<li{if is_active} class="current"{/if}><a href=" {switch_language_url}">{short_name}</a></li>
{/exp:publisher:languages}

Many thanks for your time.

#1

BoldMinded (Brian)

1.2 emailed

#2

Janine Dalton

Many thanks for the instant reply and build. This removed most of the default English URL prefixes and loads the default English version consistently on mydomain.com, but it has introduced new and bigger problems:

1) when switching language, the default English version no longer loads if there is no version in the language - I get a 404 page

2) related problem - I’m using Structure 3.3.14 and the Structure nav for each language now only shows the pages that are available in that language, instead of all the links for all versions.

3) On a projects landing page, I list out the entries from the projects channel (using page_url for the links) and these still have the en prefix in them but now the URLs with en in them show a redirect loop error. If the en is removed, the English project version loads fine and all the foreign language prefixes either load fine or show a 404 (consistent with problem 1)

#3

BoldMinded (Brian)

I’m going to need more information to help with this. 1) what does the entries tag look like? Did you try testing this with the most basic template and entries tag?

2) Did you change the persistent_entries hidden setting value? I don’t see what could have caused this to change based on the changes I’ve made in 1.2. Also, did you try re-saving the entries?

3) Not following, so links have /en/en in them?

Can you point me to actual working URLs where I can see the issues happening? You may also need to provide CP and FTP access for me to debug this… I’m not really seeing much information to go off of at this point.

#4

Janine Dalton

When I go to edit this ticket to add site details, it won’t submit because the add-on, request type and severity are missing, but the select menus for these are empty?

I uploaded the new files again just to be sure. When I went to resave an entry, I got the following PHP errors:

A PHP Error was encountered Severity: Notice Message: Undefined property: Publisher_site_pages::$EE Filename: models/publisher_site_pages.php Line Number: 1393 A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: models/publisher_site_pages.php

Line Number: 1393

Also, I noticed that language switching on the site home page also won’t work now because each language link just ends up reloading mydomain.com, even though mydomain.com/fr etc do work.

Re 1) I have made no changes to any template code since upgrading Publisher and all parts of the site were loading the fallback English versions fine before and re 2) the Structure nav was fine before too. I’ve done nothing with the persistent_entries setting either.

Re 3) what I meant was that the one thing the 1.2 build did do was remove the /en/ prefixes from most of the links throughout the site (whether in the structure nav or channel entries tags etc). But the projects list page is an exception. There, the links are still mydomain.com/en/projects/one and it is those links that give the redirect loop browser error while mydomain.com/projects/one loads fine and mydomain.com/projects/anyotherlang/one also either 404s (consistent with issue 1) or loads fine. The project listing channel entries code here is:

{exp:channel:entries channel="projects" dynamic="no" disable="categories|member_data|pagination"}
<h2><a href="http://{page_url}">{title}</a></h2>

And the page channel entries tag used before this (which would be similar to that used on the rest of the site pages) is:

{exp:channel:entries channel="pages" limit="1" disable="categories|member_data|pagination" require_entry="yes"}
#5

Janine Dalton

Just to confirm that I’ve replied directly to your email on this. Thanks

#6

BoldMinded (Brian)

Moved to email support. Closing.

Login to reply