Multiple sites on 1 konstrukt base

6 views
Skip to first unread message

Karan

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

I want to run two sites on a similar code base with konstrukt. I've
already built a mobile site at m.example.com. I now want to build the
desktop version at example.com (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?

Thanks

-Karan

troels knak-nielsen

unread,
Nov 2, 2010, 5:20:36 PM11/2/10
to kons...@googlegroups.com
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.

--
troels

> --
> You received this message because you are subscribed to the Google Groups "Konstrukt" group.
> To post to this group, send email to kons...@googlegroups.com.
> To unsubscribe from this group, send email to konstrukt+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/konstrukt?hl=en.
>
>

Karan

unread,
Nov 2, 2010, 7:32:29 PM11/2/10
to kons...@googlegroups.com
Troels,

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

unread,
Nov 3, 2010, 3:14:42 AM11/3/10
to kons...@googlegroups.com
Hi,
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.

/Anders
Reply all
Reply to author
Forward
0 new messages