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.
Related
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
I'm following the CKFinder 2 to 3 upgrade guide and it's not making much sense. In CKFinder 2, the PHP code provided could be used to generate the JS snippet with appropriate config and params, like this:
require_once 'ckfinder/core/ckfinder_php5.php';
$finder = new CKFinder() ;
$finder->SelectFunction = 'ShowFileInfo' ;
$finder->DisableThumbnailSelection = true;
$finder->RememberLastFolder = true;
$finder->Id = $name;
$finder->StartupFolderExpanded = true;
$finder->Width = $width;
$finder->Height = $height;
echo $finder->CreateHtml();
This code picks up the config and incorporates it into the generated JS.
In 3 this seems to have disappeared entirely - the upgrade guide describes the changes needed in config.php, but there is no indication of how this is ever used since there is no other PHP involved, and it says
It is no longer possible to enable CKFinder on a page from the PHP level
All that is shown is how to create the JS snippet, which does not contain any config, and so will use incorrect settings. There is no indication of how the config properties set in config.php ever get to the JS code - as far as I can see there is no connection at all and no mention of any other PHP files, even though some are provided but not documented.
This makes no sense - PHP can quite happily generate HTML and JS that is run on the page, which is all the old CreateHTML function did. I don't understand why there is no mention of this mechanism since it was how we were supposed to use CKFinder previously - it's as if the migration guide is for some unrelated package!
If I update the config file and use the default JS widget code as suggested, it breaks the page completely, altering the MIME output type so it does not get rendered as HTML and appends this error:
{"error":{"number":10,"message":"Invalid command."}}
The docs cover various fine details of what PHP config settings mean, but nowhere that I've found says how it's ever loaded, triggered or associated with the JS. How is this supposed to work?
Indeed the CKFinder 3 documentation was lacking some important information. We're gradually adding new articles there. Based on topics you mentioned I just added:
Explanation how PHP code that worked for CKFinder 2 can be refactored to plain JavaScript in CKFinder 3. Should look familiar ;)
A table with Configuration Options Migration - JavaScript Settings which should help you with discovering again options like rememberLastFolder
I am trying to make a multi-language application on Symfony2 and I was wondering why when I use this $this->get('session')->setLocale('fr'); it works (finds the file /src/ggirtsou/MyBundle/Resources/Translations/messages.fr.xliff) but when I set it to something like: el_GR it won't work.
I tried many variations (el, GR, EL, GR_el) but none of them worked. Kept getting the non-translated string.
I know I am missing something here and can't figure this out!
Make sure you have messages.gr.xliff file in Resources/Translations folder. After adding languages always clear the cache.
What are some popular ways (and their caveats) of handling dependency path changes in scripted languages that will need to occur when deploying to a different directory structure?
Let the build tool do a textual replace? (such as an Ant replace?)
Say for example the src path in a HTML tag would need to change, maybe also a AJAX path in a javascript file and an include in a PHP file.
Update
I've pretty much sorted out what I need.
The only problem left is the URL that gets posted to via AJAX. At the moment this URL is in a JS config file amongst many other parameters. It is however the only parameter that changes between development, QA and production.
Unfortunately dynamically generated URLs as #prodigitalson suggested aren't desirable here--I have to support multiple server side technologies and it would get messy.
At the moment I'm leaning towards putting the URL parameter into its own JS file, deploying a different version of it for each of development, QA and production, additionally concatenating to the main config file when deployed.
IMO if you need to do this then youe developed in the wrong way. All of this shoul dbe managed in configuration file(s). On th ephp side you should have some kin dof helper that ouputs the path based on the config value... for example:
<?php echo image_tag('myimage.jpg', array('alt'=>'My Image')); ?>
<?php echo echo javascript_include('myscript.js'); ?>
In both these cases the function would look up the path to the javascript and image directories based on deployment.
For links you should be bale to generate a link based on the local install of the application and a set of parameters like:
<?php echo link_to('/user/profile', array('user_id' => 7)); // output a tag ?>
<?php echo url('/user/profile', array('user_id'=>7)); // jsut get the url ?>
As far as javascript goes you shouldnt have any paths hardcoded in a js file that need to be changed. You should make your ajax or things that are path dependent accept parameters and then you send these parameters from the view where you have the ability to use the same scripted configuration.. so oyu might have something like:
<script type="text/javascript">
siteNamespace.callAjax(
'<?php echo url('/user/profile/like', array('user_id' => 7)); ?>',
{'other': 'option'}
);
</script>
This way you can change all this in a central location based on any number of variables. Most MVC frameworks are going to do something like this though the code will look a bit different and the configuration options will vary.
I would take a look at Zend Framework MVC - specifcally the Config, Router, and View Helpers, or Symfony 1.4 and its Config, Routing and Asset and Url Helpers for example implementations.
I've been using Textmate for Ruby/Python scripting for awhile and now have a need to hack on some PHP. I'm having some troubles with the bundle:
The code-highlighting doesn't support HTML...
When I type php + tab TM spits out:
?><?php>
instead of:
<?php ?>
Anyone know where I could possibly be going wrong? Thanks in advance...
Change your file type to HTML (even if you are editing a .php file!) would solve the problem.
The reason for this is documented at http://wiki.macromates.com/Troubleshooting/PHPSyntaxHighlight
No, the best way is to set language to "HTML" in the bottom status bar.
you can still have the file name ended with php