Load a back directory with Ext.Loader.require - extjs

Consider I have defined this namespace Boo as this path /Plugins/Content/App.
Now I need to load a script with Ext.Loader.require from /Plugins/Content.
How can I load a content from a backward folder with Boo namespace? Is there any solution like Ext.Loader.require("Boo/../") that set the cursor to /Plugins/Content?

I never tried that but you should be able to archive this with setPath() for your defined namespace. After that you can use Ext.Loader.require() on a class of this namespace.
To take credit to the comments:
No, this isn't possible.
The ClassManager will not be able to identify a possible classname and
will so not be able to find a possible namespace to use for loading.
Why?
The ClassManager does not take care about the nav part /../ which would then cause problems

Related

Is it possible to override BakeTasks in a plugin

I want Bake to add a custom TimestampBehavior to every table which has the fields created_at, modified_at, proved_at. I also want to remove the Validators for these fields.
Whether a model is added the TimestampBehavior is programmed in Bake/src/Shell/Task/ModelTask.php. I don't want to edit the file in the vendor folder, because my file might be overridden by an update.
Moving the file to my plugins folder doesn't work since i get the error message "class ModelTask is already defined".
Is it possible to extend the ModelTask somehow or to use a custom ModelTask.php in my plugins folder for bake to achieve my goal?
Thanks for your help!
Moving the file to my plugins folder doesn't work since i get the error message "class ModelTask is already defined".
It doesn't work because you probably haven't changed the namespace. Fix the namespace to the one the plugin uses and you're done. You can even extend classes of the same name by using uses Foo as Bar and then Foo extends Bar.

Best configuration and parameters for ctags in a CakePHP project

What is the best configuration and parameters for ctags in a CakePHP project?
I want to be able to auto-complete ctp files, Components, Behaviours, Models and Helpers?
Check these github repositories, I have found then and they are so good for work with php and cakephp
https://github.com/amix/vimrc
https://github.com/ndreynolds/vim-cakephp
This solution requires 1 line in your .ctags file and two lines in your .vimrc file, so it's fairly minimal.
tl;dr
.ctags:
--langmap=php:+.ctp
.vimrc:
# Controller -> Component
map <leader>t yiw<cr>:tag /^<C-R>"<CR>
# View -> Helper
map <leader>h yiw<cr>:tag /^<C-R>"Helper<CR>
Add Views to your tags
This solution is mostly for jumping between files. I'll try and add auto-completion at a later date.
Add this to your ~/.ctags options file to include CakePHP views as PHP files:
--langmap=php:+.ctp
Then I'm assuming you've done ctags -R . at the root of your project (that's what I've done at least). This out of the box should pick up PHP syntax and class definitions.
Auto-completion (general)
I found the auto-completion (omni-completion from Ctrl+XCtrl+O) doesn't work very nicely with PHP, e.g. if I type $this-> and then try to auto-complete it doesn't find any tags.
The fix for this was to use install phpcomplete.vim. This will find methods within your class.
However that won't auto-complete connected models.
Models
By default ctags should work for all Controller -> Model jumping as the Model name is the same as the class name.
Behaviors
These again should be fine as you don't specify the name of the behavior you just have the method name which depending on how independent the name is it should get found - or at least it will be in the list of tags.
Components
There's no direct way of mapping these, I couldn't see a way of mapping them through the ctags --regex options. ctags recognises that they are classes but doesn't know the xxx -> xxxComponent mapping.
However there is one slight trick. You can do a tag search on the beginning of the class name (source)
:tag /^Email
will find
class EmailComponent
You can then map this in your .vimrc
map <leader>t yiw<cr>:tag /^<C-R>"<CR>
This copies the word that you've got the cursor over and then pastes it into the tag command and executes it. My leader is set to ,, so I can type ,t and it takes me to the corresponding component under the cursor.
Helpers
Ok, another slight hack in the .vimrc file:
map <leader>h yiw<cr>:tag /^<C-R>"Helper<CR>
Using ,h, this will jump you from $html->... to
class HtmlHelper extends AppHelper {
But it doesn't work for functions inside e.g. if your cursor is over script in $html->script, it will not take you to the HtmlHelper script method. So it's a work in progress.

cakephp Managing Plugin Views how to determine paths

I have a plugin installed that has its own layout overrides for different controllers. However I'm having trouble understanding the mechanism for modifying the paths.
In the plug-in controller if I tell it to use my layout
$this->layout = 'default_dashboard';
Which is in app/Views/Layout and references an image in app/webroot/default_images.
All the relative links work fine to default_images when I do this, but would like to use some of the Plugin template overides for other actions.
However if I modify the default.cpt file to include some of the images, like say a logo that is used in default_dashboard.ctp. It is unable to map to the same image location.
For example in default.ctp:
echo $this->Html->image('default_images/logo.png',array('alt' =>
'Logo','width'=>'284','height'=>'82'));
produces a path to /img/default_images/logo.png. The Plugin is configured to use the /img location, whereas I want to direct to /default_images in this case. I could make this ../default_images/logo.png, but this isn't very clean.
In addition I have js and css which is having a similar problem. Can someone please explain the mechanism for using a site-wide default.ctp so that it works with inherited plugin templates?
From hard coding the links into the template not using the Html Helper, I see that the browser's relative path is confused because of the routing. For example the first one works with the root specified, the second doesn't.
<img src="/default_images/logo.png" alt="works" width='284' height='82'>
<img src="default_images/logo.png" alt="lost" width='284' height='82'>
What's the best way to make sure that the Plugin layouts and non-plugin layouts can all find the correct path to /default_images ?
Following are the steps that you can follow to resolve relative path problem:
Create a file abc_constants.php in app\Config folder.
Include the file in app\Config\bootstrap.php
require_once(abc_constants.php);
abc_constants.php should contain:
define('HTTP_HOST', "http://" . $_SERVER['HTTP_HOST'].'/');
define('SITE_URL', HTTP_HOST.'your_app_name/');
define('IMAGE_HTTP_PATH', SITE_URL.'app/webroot/default_images/');
Use these constants in your view file accordingly.
<?php echo $this->Html->image(IMAGE_HTTP_PATH.'logo.png',array('alt' => 'Logo','width'=>'284','height'=>'82'));
It looks a bit lengthy process at first time, but once implemented, you can use these constants in Ajax calls in view files, controller's code etc.

Can Not Refactor Class Name in XCode

I am trying to rename the class name for a view controller (which has an associated .xib file) via XCode's refactoring tool. After entering a new name, I get this error message (no preview of changes):
The selection is not a type that can be renamed.
Make a different selection and try again.
I have tried all the suggestions in this SO thread, but no luck.
What could prevent XCode from being able to refactor a class (and related file names), when other classes and variables can be refactored without any problem?
I think you tried to change the classname by selecting the file and press refactor or you select it in the #import "classname".
Instead try to select "classname" in the interface definition after #interface
I also met this problem
Here is my solution
Move the whole Project to another place Then it works(to me)

How to avoid doxygen's automatic folder based namespace?

i am going crazy over this and i'm tired of searching - could someone please explain to me, how i can avoid the default namespace of doxygen, which seems to be the base input folder.
Here you can see what i mean: http://trac.sevo.org/doxyvb/html/_v_b6_module_8bas.html
The package "ClassicVB" is only named so, because it's the name of the folder in which this file is in. But is there any way to specify, to which package or namespace a specific file belongs?
You see, if i generate a documentation, i would like to state #namespace inside my .bas file and doxygen should then use this as the namespace of the included functions inside this file. But instead it is using the name of the folder, in which my .bas file is in.
Maybe i am just doing it wrong, but i spend the last couple of hours with this, i'm grateful for any help on this matter!
I had to deal with the same and I managed this way. Go to Doxygen GUI:
Expert->Project-> Set FULL_PATH_NAMES to NO
I think this will be enough. If not let me know. When you change something in Doxygen to not-default it becomes red, so I can quickly check all the boxes I have changed.

Resources