Elxis CMS Forum
Support => Language => Topic started by: mazzeltof on July 24, 2009, 16:25:54
-
I have a site (momentarley in 2 language's)
is it possible to change title discription and meta tags allong with the changing of the language.
iff yes how
T.I.A.
-
Yes you can easily do that.
How to guide
We will do this by overwriting configuration variables on runtime.
The overwrite must be done exactly after the elxis loader run and before the mainframe initialize.
Open Elxis' index.php (you will have to do the same procedure for index2.php later).
Go to line 30 (Elxis 2009.0 Pandora):
require_once($mosConfig_absolute_path.'/includes/Core/loader.php');
Add bellow something like this:
if ($lang == 'italian') {
$mosConfig_sitename = 'site name in italian';
$mosConfig_MetaDesc = 'site description in italian';
$mosConfig_MetaKeys = 'site, keywords, in, italian, comma, separated';
} else if ($lang == 'german') {
$mosConfig_sitename = 'site name in german';
$mosConfig_MetaDesc = 'site description in german';
$mosConfig_MetaKeys = 'site, keywords, in, german, comma, separated';
} else {
//do nothing (use default configuration for the site main language)
}
You can add as many languages you like. When finish save the file as UTF-8 without BOM (by default it is saved as ANSI as it contains only latin-1 characters).
If you have only 2 languages published the above code should be written like this:
if ($lang == 'the secondary language here') {
$mosConfig_sitename = 'site name in italian';
$mosConfig_MetaDesc = 'site description in italian';
$mosConfig_MetaKeys = 'site, keywords, in, italian, comma, separated';
}
Do the same for index2.php file.
-
sorry tried it but it does not work
go look at http://comsalon.nl and try changing the lang.
I know the logo and subtitle stay the same because they are in the template.
but look at title and meta discription and tags
-
Read this:
http://wiki.elxis.org/wiki/Change_logo_depending_on_language (http://wiki.elxis.org/wiki/Change_logo_depending_on_language)
-
sorry tried it but it does not work
go look at http://comsalon.nl and try changing the lang.
I know the logo and subtitle stay the same because they are in the template.
but look at title and meta discription and tags
-
Read this:
http://wiki.elxis.org/wiki/Change_logo_depending_on_language (http://wiki.elxis.org/wiki/Change_logo_depending_on_language)
the solution to it
also
read for multilingual site-title-meta without the need to hard-code
http://wiki.elxis.org/wiki/Frontpage_setup#Multilingual_Site_Title
-
It would be a good idea kostas to add the ability to set the site title and meta data to the component front-page link. This way we would be able to set multilingual title and meta data easily. It is easy to be implemented and useful.
-
i agree ... another multilingual(and seo) characteristic ....a few db fields for the next version
but.. in frontpage-link or in global-config(expand the current functionality)? which is best?
what about other pages that uses global-config values for meta-tags? wrappers...etc
-
No other pages uses global meta data and title or at least, if any exist, they are too few. Elxis adds automatically meta data in each page except from the front-page. So I guess the trick with the front-page link's XML parameters will be enough.
...a few db tables for the next version
db tables for what?
-
So I guess the trick with the front-page link's XML parameters will be enough
i suppose that no need for db table or fields...
something must be done for frontpage... also is more-seo to avoid duplicated meta and titles ... we get 2 in 1
-
Hi ,
I have a question , How we can add meta data and titles for all components ? for example for main of gallery , main downloads ... and etc ?
-
The components control the page title and META data by themselves. To change this (not recommended) you have to edit each component.
The following elxis functions are used to set the page title and the meta data.
Page Title
$mainframe->setPageTitle('Page title here');
Meta Description
$mainframe->setMetaTag('description', 'meta description here');
Meta Keywords
$mainframe->setMetaTag('keywords', 'comma, separated, list, of, keywords');
The above functions should run before html is shown on screen.
-
is it better to include this feature in menu item of the components?
-
No, the page title and the meta data changes depending on the selected task. So by placing such a feature in the XML parameters you will overwrite the proper meta data set automatically by the component. For example IOS Gallery will use the multilingual categories titles to generate meta keywords for the component front-page and will enrich these keywords by others that fits to an image gallery. This is done automatically and with multilingualism included. You can not achieve this with static XML parameters. The system as is, is perfect.
-
ok, thank you
-
is it not better to create db fields for this and ad extra fields into global metadata , wich you can read in, the same as now, but then with a language selection.
the what you with artikels
-
You don't have to create db tables or db fields. If you wish to store these info in db then you should use SoftDisk. SoftDisk in Elxis is a virtual storage area (virtual memory) that you can use for anything you wish. The system would be like the multilingual registration terms.
Sample SoftDisk setup for multilingual page titles and meta data
Section: METADATA
sdtype: STRING
sdname: METAKEYS_GREEK
sdvalue: comma, separated, meta, keywords, in, greek
sdtype: STRING
sdname: METAKEYS_ITALIAN
sdvalue: comma, separated, meta, keywords, in, italian
sdtype: TEXT
sdname: METADESC_GREEK
sdvalue: meta description in greek
sdtype: TEXT
sdname: METADESC_ITALIAN
sdvalue: meta description in italian
sdtype: STRING
sdname: SITENAME_GREEK
sdvalue: Site title in Greek
sdtype: STRING
sdname: SITENAME_ITALIAN
sdvalue: Site title in Italian
Links
SoftDisk for developers (https://forum.elxis.org/index.php?topic=1065.0)
SoftDisk and Static cache (http://wiki.elxis.org/wiki/Static_cache)
SoftDisk and multilingual terms and conditions (http://wiki.elxis.org/wiki/Multilingual_terms_and_conditions)
SoftDisk and users profile (http://wiki.elxis.org/wiki/User_Manager)
SoftDisk and content submission (https://forum.elxis.org/index.php?topic=3673.0)
-
so can i use it for this
I have a site (momentarley in 2 language's)
is it possible to change title discription and meta tags allong with the changing of the language.
iff yes how
T.I.A.
because the first hint did not work