The thing is that you can never reach a full separation. When using
MVC you just try to separate more, that's the whole point. It's not a
black or white thing. Try working on a project where you have
specialised CSS devs and PHP devs, then you will see some of the
benefits of MVC.

- Ammar

On Mon, Jun 30, 2008 at 12:32 PM, Al-Faisal El-Dajani
<[EMAIL PROTECTED]> wrote:
> I don't see any problem in mixing PHP with HTML. In fact, the MVC pattern
> forces you to do so (as opposed to most frameworks that state that the view
> should be HTML only). All I was asking is how to do it without creating a
> mess.
>
> Now about your example: MVC fanatics state that the title shouldn't be
> outside the view, and to be honest this is the point that get me thinking
> about the entire practicality of using MVC. I'm not asking here as an MVC
> die-hard. On the contrary, I'm asking here becasue I'm losing faith in it,
> and wanted to see if it was doable (full view separation) in a practical
> manner.
>
> So far, I can't see any practical implementation that truely separates the
> view, and -at least in my mind- this casts doubt over the entire MVC
> pattern. The pattern requires full separation, which is not attainable in a
> practical manner. We can mix model into the view, title in the controller,
> and whatnot, but then we are not doing MVC. And at the end of the day, I
> care about getting my job done. Which brought me to the question: Why bother
> with MVC?
>
> On Mon, Jun 30, 2008 at 10:55 AM, Ammar Ibrahim <[EMAIL PROTECTED]>
> wrote:
>>
>> Let me give you an example, the title of the page is usually driven by
>> a business logic decision. Let's assume you are generating mobile and
>> normal version of your site, the title of the page would stay the
>> same, all you might do is supply a different CSS and maybe a different
>> HTML template. So setting the title of the page, IMHO is a controller
>> thingie.
>>
>> Now, what's wrong with using PHP & HTML together? If you separate
>> business logic from view? PHP *IS* a templating language. I don't see
>> the problem.
>>
>> On Mon, Jun 30, 2008 at 9:16 AM, Al-Faisal El-Dajani
>> <[EMAIL PROTECTED]> wrote:
>> > Anyone?
>> >
>> > To reiterate: Has anyone managed to implement MVC such that all view
>> > related
>> > matters, and only view related matters are in the view? Without creating
>> > a
>> > mess of php and html in the view?
>> >
>> > On Sun, Jun 29, 2008 at 9:09 AM, Al-Faisal El-Dajani
>> > <[EMAIL PROTECTED]> wrote:
>> >>
>> >> To use template variables you have to set them somewhere. Since the
>> >> view
>> >> is a tpl file, you need to set them in the controller. Thus you broke
>> >> the
>> >> isolation between the view and the controller.
>> >>
>> >> True, You can use models from views, or set i18n strings in the
>> >> controller
>> >> or whatever. But my original question was if anybody managed to create
>> >> a
>> >> *true* implementation of MVC. A true implementation of MVC means view
>> >> related stuff are only in the view, and since you need some form of
>> >> logic in
>> >> the view, you will need to intermix the tpl files with php code. Hence
>> >> my
>> >> original question of how to do this without creating a mess.
>> >>
>> >> The MVC design pattern/philosophy/guideline states that view related
>> >> stuff
>> >> are in the view, domain related stuff are in the model and
>> >> routing/dispatching and event handling are in the controller. If a
>> >> framework
>> >> does not follow this rule, then it is not an MVC implementation. You
>> >> might
>> >> have multiple different implementations of the singleton design
>> >> pattern, but
>> >> if any implementation allows you to have multiple instances, it is not
>> >> considered a different implementation, it's considered a) crap or b)
>> >> not a
>> >> singleton implementation.
>> >>
>> >> On Sun, Jun 29, 2008 at 1:10 AM, Ammar Ibrahim
>> >> <[EMAIL PROTECTED]>
>> >> wrote:
>> >>>
>> >>> > I base my judgement on this factor: Does the framework aggresively
>> >>> > force me
>> >>> > to separate into true MVC?
>> >>>
>> >>> This sentence is deeply flawed :). What is the definition of a "true
>> >>> MVC". MVC is a design pattern, and like any other design pattern, it
>> >>> has many implementations.
>> >>>
>> >>> > If not then it's a crap framework. If I can set
>> >>> > internationalization strings in the model, If I can set page titles
>> >>> > in
>> >>> > the
>> >>> > controller, or If I can call model functions from the view, the
>> >>> > framework is
>> >>> > crap. It should enforce clean MVC by preventing me from falling into
>> >>> > pitfalls where possible.
>> >>>
>> >>> I actually like using models from views, it's not necessarily a bad
>> >>> thing, and there are lots of arguments supporting that. MVC is not a
>> >>> religion, it's just a 'guideline' on how to write software. You are
>> >>> free to transform this guideline into a framework/software. But
>> >>> claiming that most frameworks are not true MVC is not very accurate.
>> >>> Every developer uses the framework that closely matches their needs,
>> >>> and style of programming.
>> >>>
>> >>> I think of MVC as a container that has 3 main sections, and lots of
>> >>> small drawers. I think of MVC frameworks as glue that puts everything
>> >>> together. The part that usually defines the framework is the
>> >>> controller. Hence, there are many frameworks that borrow the Model
>> >>> (e.g. a DB abstraction layer like PEAR). They might provide a generic
>> >>> interface for views; in a plugin API architecture, which allows you to
>> >>> use any view you like (e.g. Smarty, or plain old PHP). But the
>> >>> controller is almost always the unique identifier of an MVC. But then
>> >>> again, this is not always 100% correct, MVC is just a "philosophy"
>> >>> with a million interpretations.
>> >>>
>> >>> - Ammar
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Al-Faisal El-Dajani
>> >> Phone: +962-7-79737050
>> >> P.O Box: 140056
>> >> 11814 Amman, Jordan
>> >
>> >
>> > --
>> > Al-Faisal El-Dajani
>> > Phone: +962-7-79737050
>> > P.O Box: 140056
>> > 11814 Amman, Jordan
>> > >
>> >
>>
>>
>
>
>
> --
> Al-Faisal El-Dajani
> Phone: +962-7-79737050
> P.O Box: 140056
> 11814 Amman, Jordan
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---

Reply via email to