You are here:  » header.php

Support Forum



header.php

Submitted by rolli1 on Thu, 2012-12-06 09:36 in

Hi David,

in products.php e.g. there is the following code:

require("html/header.php");

Would it be possibe to code this in a way, that it is not only header.php called, but even a header1.php, header2.php......headerx.php

Regards

Roland

Submitted by support on Thu, 2012-12-06 09:50

Hi Roland,

For sure - simply create your required additional header content files e.g. html/header1.php etc. and then add the necessary require() lines to your products.php so you might have:

  require("html/header.php");
  require("html/header1.php");
  require("html/header2.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by rolli1 on Thu, 2012-12-06 12:18

Hi David,

ok and thanks, but what I meant is an array of header.phps where the script takes on new in each pageload.

E.g.
if the product A is clicked, the header.php is token
if product B is clicked the header1.php is token
if product C is clicked the header2.php is token

and if possible the header.php is randomly picked.

Would this be able to be coded?

Regards

Roland

Submitted by support on Thu, 2012-12-06 12:22

Hi Roland,

Ah I understand - no problem!

In place of the default:

  require("html/header.php");

Have a go with something like this:

  $headers = array("header.php","header1.php","header2.php");
  require("html/".$headers[rand(0,2)]);

If you add additional headers to the $headers array e.g. "header3.php" change the max value in the call to rand() accordingly, e.g. rand(0,3)...

Cheers!
David.
--
PriceTapestry.com

Submitted by rolli1 on Thu, 2012-12-06 14:38

Thank you very much.....
Regards

Rolan