contao 4.4 - how to congfigure a multilanguage instance - contao

I want to create a multilanguage site in contao.
What I did so far:
At first I copied the Page tree of current language.
At second I added domains like example.com/de and example.com/en in site-structure "Domain name" of both root pages.
Edit: Finally I added app/config/config.yml
contao:
prepend_locale: true
For my assumption it should work now but it doesnt.
What else is necessary to make it work.

In your case you do not configure any DNS names for your website roots, since you are using only one domain. Instead, you should use the following in your app/config/config.yml:
contao:
prepend_locale: true
Clear and warmup the production cache afterwards. This will generate URLs like example.com/de/… and example.com/en/….
See also https://github.com/contao/core-bundle#configuration

Related

Suddenly new URLs with "table/"?

I'm running a simple site based on Joomla. The SEF URLs are defined by SH404SEF and look like https://[domain]/[category]/[sub category]/[article title alias].html. In some cases there is a 1-to-1 relationship between category and article but in some cases one category has several articles.
Suddenly I have URLs requested following https://[domain]/table/[category]/[sub category]/. Not only does these new URLs in some cases create 404s, they also view my articles in the wrong way and when there is not a 1-to-1 relationship between category and article the link adds several articles on one page.
The correct non-SEF URL ends with &view=article and the new, uncorrect non-SEF URL ends with &view=category. I have no table/ in my correct URLs, neither in any internal link, in the articles' html code, in menu items nor in my sitemap.xml. I've discussed this with the few extension providers I am using and none of them see their extension as doing this request new.
Is there any way to find out what is making these requests?
I cannot make a redirect for these URLs since all of them do not
correspond to one article, but several. Can you see any risk with
making a rewrite rule that puts a 410 on all URLs that starts with
table/?
This is actually a misconfiugration in sh404SEF. Here's what to do:
Login to the backend of your Joomla site
Go to the sh404SEF configuration
Set the field "Insert Content Table Name" to "No"
Flush all URLs and clear your Joomla cache
This should do it.

Full URL for one specific page content only in Typo3 while the rest follows the base URL constant

I am managing an association's site using typo 3 version 4.5.30. The site has the config setup for [baseURL] = http://www.afj-japon.org/ in its template.
Everything works fine, but I need ONE page only to have the URLs written in full in the code.
Right now the page code indicates
and the URLs are written in full for the redirections to other pages, but as for the images.
I need to have the code to actually be as
How can I set this to affect only this one page and not the whole site ?
Thank you in advance for your help.
Regards,
Gilles
if I understand the question right you want to have absolute URLs on one certain page, right?
TYPO3 comes with a setting called config.absRefPrefix.
If said one page has no child-pages you can set up an extension template on that page and have this line in there:
config.absRefPrefix = http://www.afj-japon.org/
If the page has child-pages underneath it, you will have to use a condition in the ID of that page.
[globalVar = TSFE:id = PAGE-UID]
config.absRefPrefix = http://www.afj-japon.org/
[global]
Mind that every condition has to be evaluated prior to caching so having a lot of conditions might make your website slower.

built-in language change doesn't work at Grails2

I have Grails 2 application where I've already added i18n/messages_ru.properties. So, according to documentation I use request ?lang=ru (f.e. userOperations/index?lang=es) but nothing changed. Languages is still default, lang cookies wasn't created.
What's wrong? How can I fix it up?
PS. I use Oracle Java7 on Ubuntu
What are you expecting to change? If you look at the default index page (the one that lists controllers, etc) it doesn't use messages - it's all hard-coded.
I just tested and it works for me in 2.0.3. Here is what I did:
Create new Application
Create domain class with single field (String name)
Run "Generate All" for that class
The gsp's created will have something like this:
<g:message code="yourDomainClass.name.label" default="Name" />
Now if I don't do anything and look at the page, even with lang=ru or lang=es it is STILL going to say Name. But then I went in and added to the messages_es.properties file the following:
yourDomainClass.name.label=Nombre
and when I refreshed the page it says "Nombre" instead of "Name."
There are defaults in the message files for certain messages like "default.home.label" and when I used the lang=es those did change to Spanish like they should without me doing anything.
The problem is that you configured url(or it was default "/"(view:"index")) mapping to render view directly without a controller. Create a controller and render a view in it. Without a controller it doesn't work!

Maintain parameter info in the request path for all pages instead of the subdomain

I seek some guidedence here ... ( I'm not sure if this is the best title )
At the moment I prepend a "server name" to the url like this:
server10.example.com
This works fine, except that I need to handle all the subdomains on the IIS and I'm not sure google are happy about jumping around from sub to sub to sub, when it seems the links to the other servers.
I'm kind a hoping for a nice way to archive this wioth asp.net mvc.
Most pages are related to a "server" ... there are however a few info pages, contact, home that dont really need a valid "server" name ... but could just be "na" for not available, but the name need to be maintained, if there is already a selected server, when a user are keeps browsing the site. This needs to be as transparent as possible when I need to create the links to the diffenrent pages.
I could extend the Html Action() extensien to automatically add the selected "server" from the previusly request to the page.
In the format:
/{serverParameter}/{controller}/{action}/{parameterInfo}
And if no server is selected, just add "na" as the {server} placeholder.
I'm not sure if more information is needed, but please let me know if ...
I tired of extracting the selected server from the domain part and the other way also seems better, I just can't think of a good way to structure this ...
Updated
90% of all the pages are about a server that the user select at some point. Could be server10, server9, server20 ... just a name. I want to maintain that information across all pages, after the users has selected it or else I just want it to be f.ex: "empty".
I mostly looking for an easy way of doing this or an alternative ... atm I'm prepending the serverParamter to the url so it ends up being: "serverParameter.example.com".
I want to end up with something like
http://example.com/{server}/{controller}/{action}
instread of
http://{server}.example.com/{controller}/{action}
If I understand your question correctly, you just wish to group different collections of content together above the controller/action level. If that's the case, have you considered using ASP.NET MVC areas?
Just right-click on your project, and choose Add -> Area.... Give it a name (what you're calling "server"), and then you can add content, your own controllers, actions, etc. Under this area. You will automatically be able to access it via /AreaName/Controller/Action/etc.
I went with the already impemented routing in ASP.NET MVC.
{server}/{controller}/{action}
When creating the links it takes the set value for {server} and places the value when generating URL's, so I only need to supply controller and action in the #Html.Action helper method ... this could not have been more easy.
I'm not sure why I did not think about this. One just gotta love routing.

Symfony 1.4 and global variables

I've got a very old php application (1999) that has been worked on during the last ten years. At this point the app starts to show it's age so i'm in te progress of migrating to a "new" framework, symfony 1.4. But since the app is very large, i cannot do this at once. So i'm planning to wrap the old app into the new symfony app, and convert functionality by functionality.
First step in this transition was making the old app appear in the new symfony app. So, i've created the "frontend" application, added a "legacy" module, made it the default homepage, and i've put everyhting i had in my index.php (all pages went through this index.php) in the indexSuccess.php file for the indexAction. I've added the code in the "view" because there are also functions in it and changing that setup would take me more time than i want to spend on the old app.
Unfortunately i've now got an issue with global variables. Let me give you an example (i would have never made this register function like this, but it is, so please look past that.
$session = new ps_session;
$demo = "this is a demo variable";
$session->register('demo');
In ps_session i have this method
public function register($var) {
global $$var;
$_SESSION [$var] = $$var;
}
So it should put the content of $demo in a session var named "demo". Clever right :) Anyway, var_dumping shows me the that $$var is "null" and $demo is filled if i var_dump before and after calling the function. Exact same code without symfony and it returns the correct content.
What am i missing? The global call is spread out in all area's of this massive app so i really don't want to switch to something else, so i'm hoping for a quick fix :)
Maybe relevant, the all code except the index.php content are in frontend/lib/legacy/ folder, the index is in frontend/modules/legacy/ (if there is some scope issue i'm missing)
I think that since your indexSuccess.php file is included inside a function (more precisely, here : lib/vendor/symfony/lib/view/sfPHPView.class.php:185 ), this can't work, because $demo is no longer in the global scope. I don't see any easy workaround for this...
I think you should create a legacy folder in /web , and use routing to redirect to it if the url corresponds to something not migrated yet.
I went with putting the entire old site under web/legacy and redirecting from the default index action to the legacy folder. Most of the url's were made by mod_rewrite so easily fixed. The other url's went through a function so fixing was ok, and only a few were hardcoded. To make it totally transparant, i only need to redo the homepage to start from, so i don't have a visible /legacy/ in my url. Thanks for the help!
I agree with greg0ire that this is an issue with the way sfPHPView includes indexSuccess.
Could you simply require index.php in the default/index action?

Resources