Welcome Guest, Not a member yet? Register   Sign In
Blog application breakdown...
#4

[eluser]jedd[/eluser]
[quote author="CodeTroll" date="1262455164"]
No specific design goal as such - other than to get the ability to use the same verbs for both editing entries and comments.
[/quote]

You could denote the type of object being edited using the first param to the method.

foo/blog/edit/b/27 (edits blog id #27)
foo/blog/edit/c/42 (edit comment id #42)

I'm assuming comments and blogs are in separate tables? If not, then you don't need to differentiate, as you can deduce type from ID#.

If they are, you could have:
Code:
// in controller Blog
function edit ( $type = 'c', $id = 'new' )  {
    if ($id == 'new')
        // it's a new post / comment

I've digressed into a merging of initial post() and subsequent edit() functions there. A matter of taste, but DRY tends to lead you down that path.


Messages In This Thread
Blog application breakdown... - by El Forum - 12-31-2009, 06:42 AM
Blog application breakdown... - by El Forum - 12-31-2009, 10:05 AM
Blog application breakdown... - by El Forum - 01-02-2010, 05:59 AM
Blog application breakdown... - by El Forum - 01-02-2010, 06:44 AM
Blog application breakdown... - by El Forum - 01-04-2010, 01:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB