Frage

I would like to change the site content in realation to a GET variable from the URL for exmaple:

www.example.com/index.php?a=products
www.example.com/index.php?a=contact

My site contains 3 blocks:

  • navigator
  • left block
  • right block

The block that would be dynamic is the right one. Using require/include is impossible because it's not the first thing I print and then I'll probably get a headers already sent error.

<?php
echo "Navigator will be printed here";
echo "Left block will be printed here";
require 'dynamic_content.php';

So how can I do that?

Keine korrekte Lösung

Andere Tipps

Either redesign your project structure (recommended) or use Output Buffering functions:

<?php

ob_start();

echo "Navigator will be printed here";
echo "Left block will be printed here";
require 'dynamic_content.php';

ob_end_flush();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top