I'm building a .NET MVC application. This is mobile web and i cannot use jQuery.
In my application every process is a 3 step action witch leads me to a 3 aspx per process.
My processes can be categorized so i'd like to code my controllers like: ProcessTypeAController, ProcessTypeBController.
My Views should be like: \ProcessTypeA\Process1\1.aspx, \Views\ProcessTypeA\Process1\2.aspx and \Views\ProcessTypeA\Process1\3.aspx.
By convention this not work because the Controllers dont have the same "location" than Views.
Please Help in this question!
Thank U ALL.
You could specify the location of a view:
return View("~/Views/ProcessTypeA/Process1/1.aspx");
As an alternative you could write a custom view engine in order to modify the default view location conventions. Scott Hanselman wrote an excellent blog post about how this could be achieved.
Related
I'm trying to build a simple content management system based on the Zend Framework 2. The problem is that I don't know how should the folders structure be like.
Until now I have to solutions in mind:
A. Building a general "Admin" module that has multiple controllers like Login Controller, Pages Controller, Posts Controller, each of this controller with his own actions.
B. Building an module for each component, like: Pages Module that has an adminController an an frontendController.
I'm sure that none of the above solution is the corect one, but couldn't find any solid solution or books to provide one. I've taken a look at gotCMS but noticed that this one i.e, saves all the data like layout views in the database, and this is not a solution.
Though it's a very first alpha solution, I work on ensemble which is what I'd rather call a content management framework.
Ensemble's admin runs on ZfcAdmin. So you can drop in a Blog module which just has a admin controller under ZfcAdmin's route. But you can also manage pages (like texts) with a navigational page structure. All content parts (text, blog, etc) are separate modules.
So I'd suggest you take a look at the sample application and you can check out our blog as well, which just hooks in into ensemble. I know currently the documentation is scarce, but if we reach kinda beta stability we will focus more on docs.
The main benefits for "your system B" is you can drop in modules when needed. They all provide their own config, controllers, models and views. It's easy to install them from a developers perspective (load in composer, enable in application config) and you can easily override any view with your own ones.
TL;DR: choose structure B and have a look at Ensemble.
/edit: seeing you comment on Sam's answer: yes you have to do that. In ensemble, you specify a route config for the frontend and create your admin routes as child routes of ZfcAdmin. For both the frontend as the backend you have separate controllers.
There is no right or wrong when it comes to building something new. Personally I'd go with B. I wouldn't even name the Controllers like you did (I'd break them down a lot more, like NewsAddController, NewsEditController, NewsDetailsController, etc...). Then I'd have an AdminModule that would simply display a new Layout with a specific "AdminNavigation". This AdminNavigation can be filled via the other Modules (i.e. NewsModule would inject it's own administrative Routes into the AdminNavigation via module.config.php)
I am currently in the process of building an application with ZF2, everything is going well so far, but I am just having trouble with the page titles (as in the <title> tag in the <head>).
In my layout.phtml I have it statically set a string using $this->headTitle().
I want it to basically include the name of the module, controller and action by default, just like the doc page suggests:
http://framework.zend.com/manual/2.1/en/modules/zend.view.helpers.head-title.html
However when I try and implement the example code, I get an Exception.
Frankly the documentation should at least show you the best place to put this code.
I am looking for an example that a ZF2 noob can follow. I basically want to place some code somewhere (presumably Application\Module.php) so that I can set the default title as "Module - Controller - Action", then I need an example of how to override it easily from each controller or view (whichever is preferred)... please help! :)
As per Sams comment...
Readthedocs has the working example: http://zf2.readthedocs.org/en/latest/modules/zend.view.helpers.html#headtitle-helper
Thanks for your help Sam!
I've created an application with the Zend Framework. Now I was asked to make an iphone webapp for it.
So my solution is to get the useragent and render a different view for it.
My searches on google lead to Zend_UserAgent but my library says it doesn't contain it. ;)
Is there any Zend way to find the useragent to render a different view or should I do it another way?
Thanks in advance!
You can use $_SERVER['HTTP_USER_AGENT'] to determine which view to show. Here's a list of all available user agents.
Hi I'm developing a CMS with zend now My problem is how can I have two or more blog in this CMS I can make module with separate layout but which code I must add to my layout two show blogname or else ... maybe is another way?
You may just add another parameter to the action: module/controller/action/..../whichblog/second/ and create the controller plugin switching the layout and the logic.
You may be interested in creating blog service instead blog module.
what if i have ecommerce application?
like i have
1)sale page
2)list of product page(grid view and list view)
3)detail of product
4) zoom images for that product.
what kind of template should i use?
i refer this post but its not clear.
New iPhone App - How to Choose which Xcode Template to Use?
Thanks
If you have a hierarchy of views in which you go from general to specific information, then you want the navigation template.
However, most of the time, the templates are just starting points for learning. In most cases, you will have an app that is a combination so you start with the generic windows-based template and then flesh it out yourself.
If there is a similar application on the AppStore you may like to see how they have approached it, generally there is something similar that can help you clarify how you would like your application to function.
From the sounds of your application idea you would probably be best served by the Navigation template. But after all it is only a template, you can completely change the structure of the application later without needing to start another project.