문제

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?

올바른 솔루션이 없습니다

다른 팁

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top