mvc

MVC as best practice for professional level programming?

Long time lurker, first time poster... I'm now at the point where I'd almost call myself a professional grade PHP programmer and have a lot of code I re-use in various projects. Also, a lot of Open Source packages I've worked with use the MVC model and as a result I've done a lot of research recently into how it all works so I can bette...

MVC dbml and weborb for .net performance.

We have a flex application that runs along side a mvc .net application. Our flex app communicates with .net via Weborb. We recently put our entire database schema into a single dbml file. Previously we had the database schema split out into several dbmls. The problem we have run into since consolodating into one dbml is that our weborb c...

Response.ContentType sporaticly changes for IE8 using ASP.NET MVC

We are running ASP.NET MVC on IIS6. We have started to notice a problem with IE8 clients. Almost all the time, the ContentType returned is 'text/html' but occasionally, it will be returned as 'application/xhtml+xml'. This is causing IE8 to try and download the file instead of rendering the contents in the browsers. I can't find any re...

Blog model or Create_Blog model for MVC framework

I am building a blog based on a self-rolled MVC structure. I want to build my own, not used a 3rd party. What is the best way to handle the creation of a new blog? Heres two options i can see...which is better, or is there something i haven't thought of? Instantiate a blank (doesn't go fetch blog info from db) Blog model, set all the ...

MVC Model get() and set() vs. straight-up $model->var = val

When is the right time to use functions to set variables inside of my models, verse simply directly assigning them? AKA... When do I use: $model->set('status','active'); ...instead of: $model->status = 'active'; ...

MVC ajax calls - where to handle them?

I have a self-rolled MVC framework that I am building, and up to this point have managed to avoid the need for any AJAX calls. Now, however, I'd like to create a real-time updating feed. My question is, where are the handlers for the ajax calls usually stored in an MVC? Should I store them in the same controller that is involved in maki...

How to Force a Method Call on a Property or Method of an Object in PHP?

In my View (using Zend_View so the the view is an object), I make calls to object properties and methods to populate the template like so: <?= $this->user->name ?> // Outputs John Doe <br/> <?= $this->user->getCompany()->name ?> // Outputs Acme <br/> <?= $this->method() ?> // Outputs foobar If I make it so that all property requests (...

CakePHP dynamic element function placement

This site is built using CakePHP 1.2* I have an element that needs to be placed in multiple views under multiple controllers. This element is very dynamic, every time a page is loaded it needs to call a function (which is rather large) and then display what was returned. There are a few options that I have thought of, none of which I ...

Multiple views in codeigniter

Hello, I am working on a codeigniter site, in which a page is built using multiple views, I have come to a point where I need to work with a variable that is being set in another view is it possible to access it from another view? This is code I have Controller: public function index() { // $this->output->enable_profiler(TRUE); ...

How can I convince people to use proper object oriented Perl?

I have been using an Object-Oriented MVC architecture for a web project, and all the models are OO Perl. But I have noticed a couple on the team are reverting to procedural techniques and are essentially using "objects" as dumping grounds for related functions. Their functions basically read/write directly to/from the database. What's t...

Dynamic Background images advice

I am creating a site where users can upload there own background images, after upload they see each background they uploaded in a menu represented by a number, clicking on the number will in theory load in the new background, however I have noticed that does this calls in the view again as well (the view is already loaded from another fu...

MVC - Who formats the model?

Hello! Before rendering into a view model should be formatted: multilingual data localized; date, time values formatted; numbers formatted. Who performs all this formatting - Controller or View? Am I right that all the formatting is performed by the Controller which creates so called ViewModel containing only formatted values a...

How to access session in MVC 1.0

In an MVC 1.0 C# app, what's the different between the following: HttpContext.Current.Session["MyValue"] = "ItsValue"; and Session["MyValue"] = "ItsValue"; ...

Validation issue with ASP.NET MVC AntiForgeryToken

So I have an interesting problem... I'm required to get my webapp to pass through an IBM app scanning appliance before I can push my changes to production. My latest changes include the AntiForgeryToken in ASP.NET MVC. Every browser I've tested this on works just fine, no issues. But when the appliance tries to submit the form, it ge...

MVC one to zero inserting not updating

I am using EntityFramework. I have an "Application" object (which has a field certificateReasonID) which can have one or zero CertificateReasons - so there is a ralationship to the "CertificateReason" table, and visiually on the edmx diagram we do not see the certificateReasonTypeID field. When I update an Application - it INSERTS a new...

Rails flash hash violation of MVC?

I know Rails' flash hash is nothing new, but I keep running into the same problem with it. Controllers should be for business logic and db queries, not formatting strings for display to the user. But the flash hash is always set in the controller. This means that I need to hack and work around Rails to use Helpers that I made to format ...

MVC - How best to organize commonly used drop-down lists in many views

I am trying to understand how best to organize some common Dropdown lists used in several views (some are cascading) Is it best to create a single \Models\CommonQueries then create a webservice for each dropdown used in cascading situation then have a single controller that contains actions for each dropdowns This way I can follow DR...

asp.net mvc: pass information between 2 controllers to the view

Hi, hope i can explain myself... i have a login control in the masterpage. when you click the login button you go to the accountcontroller's logon method which checks your credentials. whether it is ok or not, you will be redirected to the homepage with a redirecttoaction("home","index"). but, in case login failed, i want to show a mess...

Codeigniter JQuery Ajax

Hello, I'm a heavy Codeignitor user and currently I have to build a page with extensive AJAX bits and pieces. I have been using JQuery all along the website and it's AJAX handling was perfect up until now. There is something that just doesn't feel right when i use a MVC with JQuery. For example: in Jquery I setup the callback URL easily...

ASP.NET MVC 2 RC Caching Problem

Since upgrading from mvc 2 beta 2 to rc I'm having trouble with an ajax submission in Internet Explorer. Upon carrying out a jquery form post, the function returns a url to a controller action. This worked fine with the controller action picking up it was a ajaxrequest and then piping back a partial view to update the page. This still...