Search

Greetings!

I've got a remote DS setup and am transfomring the xml fine.

I have 2 languages in the XML and a url param called lang as the first url param.

Now I'd like to know if there is a way to redirect to the page and include the first language url param if one is not set.. so I'm thinking of allowing the 'en' part of the URL to be present as a default language..

Reason for this is that I'm filtering the remote DS xml on a language attribute... but when the attribute/url param is empty... some of my html is empty.

Make sense?

Make sense?

Nope :)

and include the first language url param if one is not set.

What does this mean? if one is not set. Who is one?

Hah.. mind dump :)

if a url has no initial language param set.. redirect to the url with default language set..

I can't use Language Redirect cos the langages will be added into the remote DS over time... so needs to remain dynamic..

The one constant I can assume is the default/fallback language can be 'en'

Any clearer? :)

you mean if I go to yoursite.com I would be redirected to yoursite.com/en/?

Use GET param instead of Symphony URL Param.

www.remote-url.com/fancy-path/
www.remote-url.com/fancy-path/?lang=fr

In XSL use a variable:

<xsl:variable name="lang">
    <xsl:choose>
        <xsl:when test="/data/params/url-lang and /data/params/url-lang != ''">
            <xsl:value-of select="/data/params/url-lang"/>
        </xsl:when
        <xsl:otherwise>en</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Thanks both. Gunglien that's what I'm after.

I think my lang variable may be conflicting with the url param somehow.

Maybe a htaccess rule may help here? instead of messing with php redirects? Not 100% sure on best solution but looking for neatest/simplest/quickest way to force default lang when one isn't present in url.

What about using Page Headers and check in your homepage whether you need to redirect or not?

Could the language redirect extension pick it's 2 string language codes from a Remote DS xml file? or a transformed xsl node at all?

Client seems to want the language element at the very start of the url structure instead of after the page:

http://domain.com/en/page rather than http://domain.com/page/en like I had planned.

But Lang redirect takes it's values from the config right?

It's cool!

Language Re-direct seems to work for the 2 languages for now.. I'll try altering the code to retrieve the list of 2 string langs from a cached XML instead.

Hi Mono sorry didn't check again yesterday. What we've used is htaccess rules, we use separate domains / language so an htaccess rule sets the default language. works both with language redirect and the new frontend languages. In case you still need it I can look up the htaccess rule & share :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details