Including third party header and footer

I have a small web application. My clients use it on their site. To make it look hassle-free (part of their site), they put my app in an iframe on their site. This way I don't have to worry about the header and footer (branding / styling, etc.). Now for some reason the specs have changed and now the app won't be inside the iframe. This results in me maintaining consistent branding / header and footer styles for each client. I have a lot of clients, and I cannot maintain each of them and update it constantly.

So I am trying to find solutions that will allow me to inherit the header and footer from the client and use it in my site. I was thinking about informing the client to support header and footer html file (and keep it consistent with their branding). Then I will make an AJAX call and call my HTML content in my page. This way I never have to worry about the header and footer.

What other ways can I suggest I can solve this problem? Any experience in situations like this? How did you deal with this?

I know this is not a specific programming question, but I thought this was the best place to answer. Thanks to

+3


source to share


2 answers


Since you are using PHP, I can recommend that you include the templates directory and you can apply the template based on the client profile.

In general, save the location of the client header and footer HTML file in the database and see which template to use. Then, in your PHP header file, include something like:

define('CLIENT_HEADER', '**header string returned from your database**');
define('CLIENT_FOOTER', '**footer string returned from your database**');

define('DEFAULT_HEADER', '**default header location in template dir**');
define('DEFAULT_FOOTER', '**default footer location in template dir**');

if (isset(CLIENT_HEADER)){
  include(CLIENT_HEADER);
} else {
  include(DEFAULT_HEADER);
}
     ...
       the body of your webpage
     ...
if (isset(CLIENT_FOOTER)){
  include(CLIENT_FOOTER);
} else {
  include(DEFAULT_FOOTER);
}

      



You will of course need to customize it in your specific application, but this will automatically load the proper header / footer once loaded into the database. It doesn't think it will work if the header or footer file is not on the PHP server, unless you are using the php.ini file (I'm not an expert at this level, maybe someone can comment on this).

I hope this helps!

0


source


Instead of placing your web app internally, iframe

you can host header

and footer

internally frame

in your web app.



0


source







All Articles