[DUG] Multi client website

Pieter De Wit pieter at insync.za.net
Sun Jul 31 21:26:16 NZST 2016


> On 31/07/2016, at 13:42, John C <jc at sunshinesoftware.co.nz> wrote:
> 
> Hi all
>  
> I have a website what will be available to the public but specific for more than one clients. The frame work of the website will be the same for each client but their images and CSS file will be different (making it look differently).
> The plan is to have a sub-domain for each client from where it will jump to the "common" pages on the main domain. The index file on each sub.domain identifies the client and therefore define the directory path to use for the images and the CSS file.
> I was thinking of doing this with cookies for the paths to be used in the main program, but I'm not sure it would be a good plan and if that will work properly (setting a cookie from within a sub.domain to be used in the main domain).
>  
> Any ideas or suggestions of how to do this?
>  
> Thanks a lot in advance
> John C
>  
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz <mailto:delphi at listserver.123.net.nz>
> Admin: http://delphi.org.nz/mailman/listinfo/delphi <http://delphi.org.nz/mailman/listinfo/delphi>
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz <mailto:delphi-request at listserver.123.net.nz> with Subject: unsubscribe

Hi,

Delphi gets the VHOST of the web server into the application code, so you could just use that. No need for “cross-site” cookies. I would personally keep the logo and CSS in the sub.domain and then simply refer to them:

http://sub.domain.com/ <— that is the index call right

Your Logo would then be at:

<img src=“/images/logo.png”/>

While you CSS would be something like “/styles/main.css”

As for your idea of the common pages - are you planning on having a app.exe or something like that, sitting in say http://common.domain.com ?

If so, then you need to either proxy all the requests or iframe them. There is a trick you can do with a referrer, where by you can just redirect the user from the sub.domain to common.domain and capture the referrer, but this sounds ugly….and I am not sure it will be what you want.

The way I am assuming you want to do it is to have 1 VHOST, with a bunch of aliases. This way you have one place where you drop your code. Then you need to look at the VHOST to serve the correct CSS/Logo. You will need to store this somewhere and then work out a way to give it to the client.

I am not sure if you are aware, but Delphi can serve “other” files, as long as the correct content types are set. It’s something like:

headers (“Content-Type: image/png”);

Dump the file to standard out

P.S. My web coding under Delphi is aged - things might have changed a lot by now, but hopefully this will give you some pointers :)

Cheers,

Pieter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20160731/4ba90637/attachment.html 


More information about the Delphi mailing list