I've started using T4MVC and I'm trying to figure out how use T4MVC with PartialViews.
I currently have
#Html.Partial("LocationGrid", Model.Locations)
I would like to use
#Html.Partial(MVC.Client.Views.LocationGrid, Model.Location)
but MVC.Client.Views.LocationGrid returns the full path not the name
Even though it returns the full path, it works fine as MVC is designed to handle either.
Related
I've been testing out the Imagine Library in my Laravel application and have been running the code straight in the Routes file which has worked fine. However, now when I'm trying to use it in a Model or Controller, it can't seem to find the library anymore even though I've included it the same way I did before with use Imagine\Image\Box; and use Imagine\Gd;. The code is also exactly the same as in the Routes file but I still get class 'App\Imagine\Gd\Imagine' not found.
Do I have to do something different when including stuff in a Model or controller?
Recently I came across someone's code. The Alloy Markup is empty with just <Alloy />. In its controller, it adds a view using $.addTopLevelView().
How come I can't find any documentation regarding this function?
Good point. It might be because it's considered private, although it would normally start with _ to indicate that since JS doesn't actually support private methods.
It is also against the very idea of Alloy to not use the XML file for the markup but instead use "classic" Titanium code in the controller together with this method.
However, it might be a good idea to do a PR against the following file to request this to be documented:
https://github.com/appcelerator/alloy/edit/master/Alloy/lib/alloy/controllers/BaseController.js
I'm reviewing someone's code and I can see that they're using codeigniter. But I'm trying to figure out which version they've used. I've been rooting around in the directory structure to find some information but haven't been successful yet.
Thanks.
Inside the framework, it's defined in 'CI_VERSION'.
Path is system/core/CodeIgniter.php
define('CI_VERSION', '2.1.3');
Simple as this;
echo CI_VERSION;
The constant is globally available and is pre-filled with the release version of the code you have.
Just put the echo in an empty controller and call it in the browser to test it.
I have a controller that is only built in Debug (using #if DEBUG) that I use to house some test methods that I don't want on the production server.
The problem I'm running into is that using T4MVC I get a derived class based on the controller with overloads of all the methods. As soon as I try to build in Release mode that base class and virtual action methods are no longer present and I get build errors.
Ideally I would like to be able to exclude the controller from T4MVC but I can't see a way to do that in the settings file and the answer to this question: T4MVC How to Exclude Individual Files suggests its not possible.
Anyone know of a way to do it or can think of a good work around?
Use the T4MVC Attribute on your controller
[T4MVC(false)]
public Controller ControllerToIgnore //...
Worked for my purposes (to exclude a specific controller from being generated).
From the T4MVC documentation
Consider separating your test methods and controllers into a separate project that depends on your production code. This way you would not need to have #if Debug stuff. I'm not sure what is your set up, but you can try using NonActionAttribute that is wrapped inside #if !Debug clause. So your production code would not run the methods as actions on your controllers. But this stinks with the wrong layout of the project.
I am having problems referencing scripts that should be included in my view, when I access the page using a different route my scripts fail.
The idea is that two routes actually point to the same action:
http://localhost/PaydayWebsite/registration
http://localhost/PaydayWebsite/organizations/p001/departments/vest/employees/chn/registration
where the second just include more params for my action. I have tried using
ResolveUrl, Url.Content and mvccontribs Html.ScriptInclude but neither seem to work. Any ideas?
You should be able to use Url.Content, but you'll need to make your path relative to the root of the application rather than the current path.
Use
Url.Content( "~/Content/Scripts/jquery-1.3.2.min.js" )
rather than
Url.Content( "../../Content/Scripts/jquery-1.3.2.min.js" )