Multiple sites on 1 konstrukt base

Skip to first unread message


Oct 30, 2010, 9:24:49 PM10/30/10
to Konstrukt

I want to run two sites on a similar code base with konstrukt. I've
already built a mobile site at I now want to build the
desktop version at (I know, unorthodox order). I don't
want to run two separate projects since the URLs don't map 1-to-1, but
use a lot of similar code (libraries, models, configuration, etc). As
a side note, both return content type text/html, so even if the URLs
did map 1-to-1, splitting the render method would be a bit hacky.

I'm considering creating a separate front controller for each site. Is
this the recommended approach? Any ideas on how I can implement this?



troels knak-nielsen

Nov 2, 2010, 5:20:36 PM11/2/10
Hi Karan.

I wouldn't say definitely that one way or another is the only way to
go about this, but I would probably take the same approach as you have
suggested. You can always later see if there are some commonalities
between the two sites and move those parts out into abstract
controllers and reuse them across.


> --
> You received this message because you are subscribed to the Google Groups "Konstrukt" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at


Nov 2, 2010, 7:32:29 PM11/2/10

Thanks for the reply. I started taking this approach after i sent the
original message, and so far it's working well.

I have another similar question. How can I render something
differently in the same controller and the same content type? For
example, depending on the subdomain (m vs. t) i want to return
different templates in renderHtml() of the same controller. One
solution is to just have an if statement in each renderHtml and then
delegate to two different private methods, but this logic is going to
be the same in every renderer (if foo == n, else). Is there one place
this can be done?

Anders Ekdahl

Nov 3, 2010, 3:14:42 AM11/3/10
Do you use your own base controller? If you do, you can always override the subview()-method on the controller to return "mobile" if it's a mobile device. That way, the call goes to renderHtmlMobile instead of renderHtml.

Reply all
Reply to author
0 new messages