What is the best place for adding TSConfig in an extension? - performance

I see different places for adding Page & User TSConfig in an extension : ext_localconf.php and ext_tables.php.
I'm using \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig and \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig methods.
Is there a difference in terms of performance between these two locations ?

You need to use ext_localconf.php, everything else is wrong. It might work (also depending on caching configuration and TYPO3 version) with other solutions but will certainly fail for many other situations and future usage.

The functions may be used in both (according to the PhpDoc header of the functions), but if you look in the system extensions that are shipped with the core you'll see that these two functions are mostly used in ext_localconf.php (only EXT:recordlist has a call in ext_tables.php). Best practise is to place them in ext_localconf.php.

Related

How to modify com_mailto to fit out needs

I'm developing a site for my company and I also need to modify the native component "mailto" to fit our needs.
I'm working with a joomla 2.5
I was wondering if future updates occur, what will happen to the lines I've added, for example, in "\components\com_mailto\controller.php"...
I haven't find answers on the net.
Also, for the same reason, I've modified the default layout of an article. Should I rename it? and if yes, how, because I couldn't do it (when I've tried the article did not display).
Thanks for your help
Before starting to edit core Joomla components, should should always have a look at the options you have. I don't believe in editing core file as it simply causes problems for updates when released, therefore in my opinion, you have 2 options:
I always make a note of all my requirements and start looking for a 3rd party extension that caters for my requirements.
If I cannot find a 3rd party extension and don't particularly want to start digging into it's code, I would go with developing a plugin. Plugins are used to manipulate the behavior or something and therefore come in extremely handy for when you would require core editing.
Editing the layout of an extension view is completely fine, but it's strongly recommended you make a Template Override so that if the extension does ever get updated, your changes won't get overridden.
So to answer you initial question, any line you have added to the controller.php file will get overridden when you decide to update the extension.
Hope this helps
While the answer from Lodder is totally valid, as a last resource you can also consider forking the com_mailto as a separate component.
This has some disadvantages:
you need to rename all the files involved (controllers, models, views)
you need to maintain it and keep in in sync with future updates (consider than you are now on 2.5.x and in a year you might want to upgrade to 3.x).

Sitecore caching and languages

I have a basic understanding of how Sitecore caching works including how all the different variations work.
But I am not how Sitecore handles languages during caching. Is each language version of a page treated as a different data source and is varybydata the answer then? If not, how can I safely apply caching to different language versions of a page?
Thanks
Sitecore includes the current language in the cache key, among other things, so every sublayout or rendering is treated as a different version in each language. So apply caching to different language versions should be no problem.

Joomla: alternative content for an article

I've just started work on an existing Joomla! site, and have a requirement to add an alternative language version of an article. Note that this isn't a full-internationalization effort - we don't need every part of the interface translated - just the need to have another 'version' of an article. Ideally, though, this would include more than just the core content - for example, title. I don't really want to create a second article because, in essence, this really is just a single article, and I don't want things like comments to be split between two separate articles.
Does anyone know if this can be done using joomla core?
If not, can anyone recommend an existing component that will do this?
A good component for manage translations in Joomla 1.5 is Joom!fish. It allows you to do a whole internationalization that, as you said, isn't exactly what you want to do. However I like to think in the long run so, if there's more change, I have not to restructure again and again just because of I haven't thought it before. Hence, if I were you, I would like to use Joom!fish anyway.
Well, as a short fix - Google Translator works and can be installed into your template you're using.
Then you can set it to be hidden unless the users browser is set to use a different language as default - then a small pop-up box drops down and it asks to translate it using google translate.
If that's not the option you're looking for - joom!fish is a good component others rave about but I don't have much experience with personally. Outside of that I'm not really sure.
Hanny had a good idea that would be really easy to implement in an article with the right extension. You can use this extension -
http://www.nonumber.nl/extensions/tabber
This would allow you to easily create tabs with the translations available anywhere you have them. The page above uses the extension to display the tabs, it would be trivial to implement.

CodeIgniter - modular?

I'm building several sites that need similar "modules." For example, the sites may have the exact same login system, forum, etc.
Is there a way I could build these modules once and just "drop" them in these various sites? Some of the challenges I see:
Keeping the code consistent in the various sites. Any changes made to a module should propagate to all of the sites using that module. I guess I need a way to upgrade?
Database: these functionality need to work as part of a bigger application. Maybe the module needs to define relationships with other tables in its respective site.
I'm sure there are more problems. I think I should be looking at this: https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home, but I don't have any experience with it.
So, I'm looking for solutions, suggestions, or more problems to this idea.
You can create and use third party packages by adding them to the third party folder (which is new for CI 2). There is not much about it in the docs, but i found this.
http://codeigniter.com/user_guide/libraries/loader.html
You can autoload the third party packages in the autoload file. Packages can have their own controllers, models, views etc.
Interestingly, Phil Sturgeon wrote a bit (http://philsturgeon.co.uk/blog/2010/04/codeigniter-packages-modules) about packages not being modules (in the strict sense of the term), but you could probably use third party packages for what you need.
I would write them as libraries and use Git submodules to manage each module. Phil Sturgeon actually just wrote a great post about doing this in CodeIgniter.
If you're not using version control, I can't see an easy way to sync across all of your applications. Yes, HMVC will let you break apart your application into actual modules, but it won't help in syncing those modules across your applications.
Here is my question about 'Database communication in modular software'
that you may find useful.
I'm little bit familiar with Drupal, and as a modular application, I think it can be taken as good example of how relationships between modules should be defined.
Here is one good post about art-of-separation-of-concerns
I would like to hear if you have run into some concrete challenges, solutions and references concerning modular design in CI.

When running phpdoc on a CodeIgniter project, which folders should be included?

On my first try, I've only included system/application/models, system/application/controllers, system/application/helpers, and system/application/libraries. I chose those folders because I think those folders contain the code that you want to be properly documented for future reference. What other folders do you think should be included?
To be thorough in terms of your own code. I would recommend the following folders and where necessary have annotated:
system/application/controllers
system/application/helpers
system/application/hooks - Don't miss this out! Any time that you change/extend the CI core, you should definitely document it
system/application/models
system/application/libraries
system/application/language - This may come in useful when implementing localisation
system/plugins - As you're including libraries, it would make sense to include any external plug-ins being used as well
I think you got it covered. The rest is probably documented in CodeIgniter's documentation already.
If you add any plugin/library/whatever that requires to be outside of these folders, make sure you add them later as well.

Resources