PHP:从特定页面上的模板中删除代码行

I have a site with a common template file. So all the pages have the same header and footer.

I want to remove a line of code from the header on a particular page.

  • Is there a way I can say if the url is not /user/page/**** than print this code?

From your description,

You have pages in format user/page/xxxxx

So, you can directly explode the string with / and get the last element.

That is your current.

$currentPage = current(explode('/'), $yourURL);
if ($currentPage != 'noTemplatePageAddHere') {
  // Add the line you do not want to show on this page.
}