How to provide a function in all system files?

Asked

Viewed 33 times

2

I would like to have my function go through all the files within the system. What they have in common is the header.php. I would like the header function to be available in all files that enter below it.

header.php
----------

function urlbase(){
    $url = "meusite.com.br";
}

      Corpo com include header e footer
      ---------------------------------
      contato.php | usuarios.php | fornecedores.php | noticias.php


footer.php

Question: How to make the function available in all body files?

  • 2

    It’s not just putting the function inside the header.php ? Since the header.php goes on all pages, the function goes along. I’m not sure I understand what you need.

  • 2

    Create the function inside a php file and then include that same file inside the other pages, using include or require.

  • @That’s what Taopaipai is, but I can’t seem to do it :)

  • But gives some error ? Or does not work its function ?

  • 2

    Guys, thanks for your help. There’s a time when it gets really crazy :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.