I'm using TYPO3 7.6.11 and realurl 2.0.15
my translated versions got this url:
http://url.de/3/services
is there a way to replace the 3 with the language code? for 3 it should be en for example?
thanks a lot
You need to add the 'preVars' configuration array for your languages to realurl.
It is straigtly described in the manual:
Realurl manual - language example config deep-link
Excerpt/Example:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'] ['realurl'] ['_DEFAULT'] ['preVars'] => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
# 'noMatch' => 'bypass',
),
);
Alternatively you could just use the 'automatic configuration' shipped with realurl. AFAIR it usually adds also lang-configs.
The Auto-Conf feature is to be enabled via Extension-Manager.
Please, see how to set up languages correctly: https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages There are instructions and examples there.
Related
I've extended TYPO3 9.5.x with news extension 7.2.x with some custom properties.
I used the manual I found here.
In general, everything works, but somehow the custom properties I created seem to be blank at the frontend. After clearing the cache, everything works again, but after some time the same issue appears again.
What am I doing wrong? Maybe it has something to do that I'm working with TYPO3 9.5.x and the manual is written for TYPO3 7.6.x?
Thanks for your help!
move your TCA modifying code (from ext_tables) to /typo3conf/ext/yourEXT/Configuration/TCA/Overrides/tx_news_domain_model_news.php
something like this:
defined('TYPO3_MODE') or die();
( function( &$tca) {
$tempColumns = array(
'NEW_FIELD' => array(
'exclude' => 0,
'label' => 'LLL:EXT:yourEXT/Resources/Private/Language/locallang_be.xlf:tx_newsextend_domain_model_news.NEW_FIELD',
'config' => array(
'type' => 'check',
'default' => 0
),
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tx_news_domain_model_news',
$tempColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes("tx_news_domain_model_news", 'NEW_FIELD', '', 'after:title');
})( $GLOBALS['TCA']['tx_news_domain_model_news']);
For an extension i like to use sys_categories that are stored in a dedicated folder. How do I configure the folder and access the configuration inside the TCA setup?
I tried this approach. I use the method \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable inside Configuration/TCA/Overrides/tx_xref_domain_model_project.php.
Where I place the hardcoded 333 I would like to use a configuration value in the ideal case tsconfig. Is it parsed and accessible at this point?
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
'xref',
'tx_xref_domain_model_project',
'areas',
array(
'label' => 'Areas',
'exclude' => FALSE,
'fieldConfiguration' => array(
'foreign_table_where' => ' AND sys_category.pid = 333',
)
)
);
Is there a more easy approach to solve this?
Using ExtensionManagementUtility::makeCategorizable() in Configuration/TCA/Overrides/<your_table>.php is exactly the right approach and in fact what TYPO3 itself does.
At least the global extension configuration is accessible at this point.
https://docs.typo3.org/typo3cms/CoreApiReference/ExtensionArchitecture/ConfigurationOptions/Index.html
This is not fully satisfying, as you may want to define a different category source folders for different pages or sys_folders. Yet it will do for many projects:
$areaFolder = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)
->get('xref', 'areaFolder');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
'xref',
'tx_xref_domain_model_project',
'areas',
array(
'label' => 'Areas',
'exclude' => FALSE,
'fieldConfiguration' => array(
'foreign_table_where' => ' AND sys_category.pid = ' . (string) $areaFolder,
)
)
);
I just have setup a typo3 website. Page is running well. But got some error. My Onpage optimization everytime gives me a bad feedback because of the default language tag.
www.mywebsite.com/contact/
and
www.mywebsite.com/contact/?L=0
When I try to redirect it well, with a permanent moved 301 redirect, it creates a loop and I canĀ“t redirect his well.
I tried to redirect it with my_redirects extension and also with htacess, but I got just a bad result.
Lets say your default language is en and your secondary language is es then try this snippet in your <typo3root>/typoconf/realurl_conf.php.
'preVars' => array (
0 => array (
'GETvar' => 'L',
'valueMap' => array (
'es' => '1',
),
'noMatch' => 'bypass',
),
),
I think your missing the 'noMatch' => 'bypass', it allows the L parameter to be absent.
This will result in:
English / default URL: www.mywebsite.com/contact/
Spanish URL: www.mywebsite.com/es/contacto/
When I try to add the wizard named wizard_geo_selector in TCA ,there arised an error "module not registered".Please tell me how to register the wizard properly in the TCA.?
In TYPO3 Version 7.6 new wizards are added like this:
Inside your extension create the directory Configuration/Backend/
In the new directory create a file Routes.php, it will be found automatically, no mentioning in ext_localconf.php or ext_tables.php is required. If you still need Ajax you can add the file AjaxRoutes.php in the same folder.
Content for Routes.php:
return array(
'my_wizard_element' => array(
'path' => '/wizard/tx_geoselecotor/geo_selector_wizard',
'target' => \Path\To\your\class\WizardGeoSelector::class . '::WizardAction'
),
);
Content for AjaxRoutes.php
<?php
/**
* Definitions for routes provided by EXT:backend
* Contains all AJAX-based routes for entry points
*
* Currently the "access" property is only used so no token creation + validation is made
* but will be extended further.
*/
return array('my_ajax_element' => array(
'path' => 'tx_geoselecotor/my_ajax_route',
'target' => \Path\To\your\class\MyAjaxController::class .'::myAjaxFunction'
));
If you're unsure about the notation you can compare with existing entries in the Global Variables in the Backend:
Navigate to System -> Configuration -> Backend Routes
The route of the paths is handled different, for Ajax it's always "ajax" prepended, so you've never to add it to the path, else it's twice in the route. For the common route there is no change concerning the defined string.
Now the wizard can be used and even it never has to be defined in ext_tables.php it has to be mentioned there from any table-field in the configuration-area (module[name]):
'table_field_for_wizard' => array(
'label' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xml:table_name.tx_myextension_wizard',
'config' => array (
'type' => 'user',
'userFunc' => 'Path/to/class/without/wizard->renderForm',
'wizards' => array(
'my_wizard' => array(
'type' => 'popup',
'title' => 'MyTitle',
'JSopenParams' => 'height=700,width=780,status=0,menubar=0,scrollbars=1',
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/img/link_popup.gif',
'module' => array(
'name' => 'my_wizard_element',
'urlParameters' => array(
'mode' => 'wizard',
'ajax' => '0',
'any' => '... parameters you need'
),
),
),
'_VALIGN' => 'middle',
'_PADDING' => '4',
),
# Optional
#'softref'=>'something',
),
),
In the userFunc Path/to/class/without/wizard->renderForm you've to create a button which is linking to the wizard and onClick the wizard will open with the route you defined in Routes.php and the optional urlParameters.
Currently I never found this whole item explained in the core-documentation.
Edit:
Details about routing can be found here: Routing
The rendering process can be found here: Rendering / NodeFactory
You should probably read also the outer context of the linked paragraph.
Edit 2:
An example extension can be found here, some things never work 100% but the wizard is working. The extension is for TYPO3 Version 7:
https://github.com/DavidBruchmann/imagemap_wizard
Ricky's answer doesn't really work anymore, since addModulePath ist deprecated since version 7.
Also, just registering the module like this still give's you said error.
The only thing that keeps the wizard going again is this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('wizard','pbsurvey_answers',"",\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'wizard/');
But when you add this, the module appears as a new point in your TYPO3 backend.
IN TCA add the wizard like follows:
'module' => array(
'name' => 'wizard_geo_selector',
),
In ext_tables.php register the wizard.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'wizard_geo_selector',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/Yourwizardname/'
);
Keep in mind this is deprecated since Typo3 7 and removed in Typo3 8.So you can use this method upto Typo3 7.For Typo3 8 do use the method specified by David below.
I need help =/
I updated TYPO3 to 4.5.5 and an older Version of realurl.
The plugin we're using gets the GET parameters by reading the 't3lib_div::_GET();' variable.. realurl does not let through values that are submited by the original GET method, it only passes the "readable" url parameters....
so:
www.anypage.com/welcome/any
works with config:
array(
'GETvar' => 'tx_plugin_pi1[database]',
'valueMap' => array(
'one' => 'one',
'any' => 'any'
),
'noMatch' => 'bypass'
)
but:
www.anypage.com/welcome/?database=any
does not pass the value ('any') to the plugin...
I second Koopa's answer.
In addition to that the variable must include the prefix:
www.anypage.com/welcome/?tx_plugin_pi1[database]=any
or you update the real url config to:
array(
'GETvar' => 'database',
'valueMap' => array(
'one' => 'one',
'any' => 'any'
),
'noMatch' => 'bypass'
)
The variable should always be accessible through $this->piVars['database'], is it not?