I'm trying to create a messages.pot file for my application using the workflow described in the docs. Unfortunately, I can't get this to work. I can render the cached version of my templates, but when running xgettext, no strings are recognized.
After inspecting a cached template, I see calls being made to
echo $this->env->getExtension('translator')->getTranslator()->trans("Yadda", array(), "messages");
I guess xgettext only looks for calls to gettext(), dcgettext(), etc. Am I missing something here? How to fix this?
I'm using Silex 2.0.3-dev, twig 1.24.1, twig-bridge 3.0.7.
i had the same problem... i found no way to get it by the translator component, so i wrote and node js script to parse the twig files...
here is the pastebin link... if u like to update the file or something please contact me probably we can put it on github...
http://pastebin.com/WSDsABfz
Related
I would like to edit the 'regards, {application name}' part in the toMail Notifications without publishing the blade template files. Imo its an overkill to do so
Part in Question is here
I know Laravel provides several functions to change the contents of the Mail but this part seems to always stay the same unless edited via the template files.
Thank you in advance!
So after some digging through the files I found the solution and it's pretty easy:
return (new MailMessage)
->from('info#test.com', 'Testorganisation')
->subject('Your mailsubject')
->greeting("Hello $notifiable->name,")
->salutation("You are welcome"); // Change this for a different salutation
This results in this output
It's handled via the subject-Function inside the SimpleMessage.php file located in /vendor/laravel/framework/src/Illuminate/Notifications/Messages/
Hope this helps someone, since I didn't find a solution other than publishing the blade templates.
I don't know when the function was added, but works in Laravel 8+
Well, I am developing a plugin a and I need to display some stuff from my plugin when TYPO3 page load.
Is there some function how to hook action, like in WordPress when page loads than plugin will execute some controller method? Then this controller will produce some output a HTML, which I would like to dispaly in frontend page. Specially I would like display custom script in the head. So the script should be like this <head>...<script>my content</script>...</head>
Ok, what you probably want to do is to develop a so-called TYPO3 extension - that's what plugins/add-ons are called in TYPO3 (which is the term you will likely find google results for).
To get started fast you can try the TYPO3 extension builder (https://docs.typo3.org/typo3cms/extensions/extension_builder/) - which can generate a skeleton extension for you.
For more information you can also have a look at https://docs.typo3.org/typo3cms/CoreApiReference/latest/ExtensionArchitecture/Index.html which explains the concepts in far more detail.
Additional information is available in https://docs.typo3.org/typo3cms/ExtbaseFluidBook/Index.html
in TYPO3 there is something named plugins, but you should differ to the meaning in other context.
first TYPO3 is a CMS which content is structured in a hierarchical tree of pages. These pages are the basis for navigation. and each page contains individual contentelmenents (CE).
As Susi already told: add ons to TYPO3 are in general 'extensions' which could extend(!) the functinality of TYPO3 in different ways. one way is the definition of (TYPO3-)Plugins. These are special ContentElements which enable to show special information.
While normal CEs have all the information what to show in the record (e.g. Text & Image), plugins can be more flexible.
typical examples are: show a list of records OR one record in detail.
These Plugins can be controlled with typoscript or the plugin-CE could have additional fields to hold information what to display.
For detailed information how a plugin is defined consult the links given by Susi.
And be aware: for security reasons it is not possible to just execute a plain PHP file to echo any output. You need to register your plugin using the API, build your output as string and return the generated HTML as string to the calling function. For beginners the ExtensionBuilder will help you to generate a well formed extension which uses the API to register and output your data.
OK guys, thanks for your answers, but it was not very concrete. I found this solution, is not the best one, but it works! If anybody has better please share.
At first, you have to make a file for the class which will be called from the hook at location /your-plugin-name/Classes/class.tx_contenthook.php. Filename have to have this pattern class.tx_yourname.php Inside we will have a code with one method which will be called by the hook.
class tx_contenthook {
function displayContent(&$params, &$that){
//content of page from param
$content = $params['pObj']->content;
//your content
$inject = '4747474747';
// inject content on
$content = str_replace('</body>', $inject. '</body>', $content);
// save
$params['pObj']->content = $content;
}
}
And next, we have to call it on the hook. So Let's go to /your-plugin-name/ext_localconf.php and add there these two lines, which makes a magic and handles also caching.
// hook is called after caching
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'][] = 'EXT:' . $_EXTKEY . '/Classes/class.tx_contenthook.php:&tx_contenthook->displayContent';
// hook is called before caching
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][] = 'EXT:'. $_EXTKEY .'/Classes/class.tx_contenthook.php:&tx_contenthook->displayContent';
I hope this will help those who struggling with typo3.
I'm not so familiar with Smarty. In the code I'm exploring, I have found such construction:
...
Can't understand, how does that url construction work. Looks like it is some custom method (or whatever it's called) in our project. But the project is quite large and I can't find it's definition just by word url.
Where to look for? What can it be?
url - is a Smarty custom plugin, which you can find in smartys' plugin folder. a.category, a.subcategory, a.nice_url: are params that passed to the url.
The following:
{url ...}
url is the custom Smarty Function. You can find it in Smarty plug-in directory or in a file that keeps all functions (if there is one) for your project.
In case you want to find the ends, just search through your whole web-site directory for the following content:
smarty_function_url
It must be found anyway, because it's the only way you can register custom Smarty function.
EDIT 1:
As correctly stated by sofl, if the plug-in is registered dynamically using registerPlugin method:
$smarty->registerPlugin("function","url", ...)
then you would have to search for the following instead:
registerPlugin("function","url"
or
registerPlugin(" function ", " url "
If it still doesn't work just try searching for ->registerPlugin, I think there is no other options left after all and you will find it!
Is it possible to include a typoscript file via php?
Normally I would include typoscript with this:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/setup/1.ts">
But I want to do this just with php and not typoscript. Is that possible?
My Purpose: I want to dynamically load typoscript in my page
This can be achieved by invoking accordant functions at an early stage, e.g. in calling or delegating it in ext_localconf.php. For example, the bookstrap package is loading TypoScript in PHP like this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY
. '/Configuration/PageTS/Mod/Wizards/newContentElement.txt">'
);
Please consider, that TypoScript is cached before the actual front-end rendering starts. This means, that you should not modify TypoScript if you're plugin class or controller logic has been called already.
May be you need to return a value from the php function and use typoscript conditions for choosing the typoscript file.
You might try the following (if I get you right):
$typoscriptFile .= file_get_contents($someFile);
$parser = t3lib_div::makeInstance('t3lib_TSparser');
$parser->parse($typoscriptFile);
$tsArray = $parser->setup;
I really don't know how well that will play with anything related to global typoscript though.
If you wanted a complete correct parse, you might be able to pull something like this off if you populated a fresh t3lib_TStemplate instance from $GLOBALS['TSFE']->tmpl and than ran the code above. Might work, never tried.
I'm working on a Symfony project and I am seeing this in a view.yml file. What is the meaning of it:
javascript:
- js/jquery.min.js
I can see that this sentence loads the library but, what the difference between that and this:
javascript: [js/jquery.min.js]
Also, I have other problem: When I want load another component, it does not load the jquery library; why is that?
It's a way to do lists in YAML, for example in an app I have:
profileViewSuccess:
javascripts:
- /jquery-ui/js/jquery-ui-1.8.7.custom.min.js
- /js/jquery.periodicalupdater.js
- /js/jgrowl/jquery.jgrowl.js
- /js/jquery-uniform/jquery.uniform.js
- /js/lightbox.js
- /js/profile.view.js
- http://maps.google.com/maps/api/js?sensor=false
This looks nicer than:
profileViewSuccess:
javascripts: [/jquery-ui/js/jquery-ui-1.8.7.custom.min.js, /js/jquery.periodicalupdater.js, /js/jgrowl/jquery.jgrowl.js]
etc. etc. with all the other files.
Did you cleared cache running "symfony cc"? When you change a configuration file you must run such command to apply the changes.
Hope this helps. On the other hand your english is pretty hard to understand XD I'm spanish as well but I think spanish is not allowed here.