controller

CodeIgniter + Doctrine: CRUD in Controller?

Hi all, I am a newbie to MVC, CodeIgniter and Doctrine, so maybe my question is not that relevant. Pardon me if thats the case. I've been reading the CodeIgniter + Doctrine tutorials on PHPandStuff.com. I really like whatever I have seen of Doctrine and wish to use it for my project. However, since all database related operations shoul...

ASP.NET MVC save data between controllers

Hi everyone, another ASP.NET MVC question. Assume the following scenario. You have three controllers: getFirstData getSecondData useFirstData The workflow of your site requires that the user first uses the getFirstData controller, and inputs some data (lets say an int) in the view. I then need to use the second controller (getSecon...

Rails passing @variable from one show page to another

I have a Gallery application that has Album and Photo models. I have the user search in the Album's show view (search in the specific album) and I store the results in a variable named @search in the show action of the controller. I want to pass this variable to the Photo model's show page so when a user clicked on a particular pictur...

How to test if correct layout was used in controller using RSpec and Rails 3

I want to write a rspec test that tests if correct layout is used for controller. (Actually I want to test that no layout is used :) ). I did some googling and also Looked here http://stackoverflow.com/questions/109284/testing-rendering-of-a-given-layout-with-rspec-rails But all of this does not work for Rails3. I have used: controll...

What are typical ASP.NET MVC - Controller Action Name conventions ?

I'm struggling to choose appropriate names for my actions. I want to distinguish between actions that return a view to: Create Edit Edit-Create Here is what I have so far: Create --> Show the Empty Form for Create Add --> Receives data from Create and Save New Entity Edit --> Shows Existing Entity in a form for editi...

Can I cancel a Zend Controller action in the init() method?

During Zend_Controller_Action::init(), is there a way to cancel the action (so it won't be called)? <?php class JsonApiController extends Zend_Controller_Action { function init() { // try JSON decoding the raw request body if ($jsonDecodingFailed) { echo '{"error":"invalid JSON"}'; $this->...

ASP.net MVC - Multiple Forms on View, each calling a different action, but need to show the same view again

I have 3 forms on my View. Each of these all post back to a different action. When the action is complete, I call my original Action that led the user to the page originally, but MVC is looking for a view of the postback Action. How can I get MVC to post to an action of a different name of the current view, while still having it reloa...

Zend doesn't seem to want to load the form I've created

Hey, I seem to be climbing a pretty horrible learning curve. It's taking me hours to even get to the point where I can structure/write code. I originally wanted to be able to store a form or a model inside its respective module, for example: ./application/module/ModuleName/forms/ClassName.php but when I tried to instantiate a class w...

CakePHP: Registering user does not save correct date

Hi, I have a CakePHP application that allows a user to register and post projects. At some point whilst I have been tinkering with it I have managed to change the way the current date is captured when the user record is created :( when a new user account is created the date is defaulted to Jan 19th 1970, 01:00 Here is my register ac...

Rails after_filter get javascript and stylesheet values

Is it possible in rails using a filter that appears, after the view (after_filter), to collect the data that has appeared inside of the javascript_include_tag and stylesheet_link_tag methods? for example: ---rails view starts javascript_include_tag 'file.js' ---rails view is complete and after_filter runs @js_files = get_included_java...

flowplayer hide video display for mp3 player

how can i hide video display, im just trying to display controlbar only for audios. btw im using javascript control bar http://flowplayer.org/demos/plugins/javascript/index.html ...

Using sanitize within a Rails controller

I'm trying to call sanitize within a controller. Here's what I tried: class FooController < ApplicationController include ActionView::Helpers::SanitizeHelper # ... end However, I'm getting this error: undefined method `white_list_sanitizer' for FooController:Class I searched around and people recommended switching the include l...

How to call a method before the mehtod of requested controller is executed : magento

Hello Experts, I want to call a method before the execution of every and each controller's method. I don't want to go and call the method in every method. I just want to call it from one place and it will be called before any method of any controller in magento. And I am sure we can do this but I don't know how it can be accomplished. ...

List of Controller Routes in Rails 3?

Hey everybody! What I'm trying to do: I create some controllers, for example: Home About Gallery Contact Now I want to create a navigation automatically. So is there a way to programmatically fetch the list of controllers/actions to build this navigation? I don't want to fix the navigation everytime I add a controller. ...

Rspec: testing nested controllers

Hello. I have a nested controller that works fine, and I'd like to setup rspec to also test a nested controlled, but it doesn't test the controller unless I specify it. i.e. my rspec test controller is here: /spec/controllers/organizations/memberships_controller.rb but when I run rspec to test everything, it tests everything except th...

How can I write a Controller without making it a God object?

In my app I have a Controller that's started by the main method. The controller initializes hooks, database connections, the UI, another connection, and other things. It holds most of the state of the program (no, its not a Singleton). In another example there's a controller for the bot that handles interpreting and sending out of comman...

ASP.NET MVC View and Controller Output Caching

What is the difference between using output cache in view: <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Mahmure.WebUI.ViewModels.NewsletterVM>" %> <%@ OutputCache Duration="120" VaryByParam="none" %> and in controller: [OutputCache(Duration = 120, VaryByParam = "none")] public ActionResult Index() ...

retaincount of ViewController +4 when pushed by NavigationController

I was wondering why the retainCount of a viewController is raised by 4 when pushed onto the stack of a Navigationcontroller e.g. from a tableView. What dependencies are created? ...

ASP.Net MVC: How to redirect an uathenticated user from any page if they do not satisfy a condition

I need to redirect any Authenticated user to a specific page if they do not satisfy a condition. I have implemented a base controller from which all controllers inherit. In its OnActionExecuting override I plan to perform my test for the condition and redirect to the specific action if the condition is not met. Is this the most sens...

ASP.NET MVC2 Strongly-typed view databinding question

I'll start off by saying my terminology might be off, which is why I might be having trouble finding an answer to this question, and apologising for the wall of text. I have a strongly-typed view that inherits from a custom type called Record. Record has a dictionary of named fields of varying datatypes - some strings, some ints, some D...