Jump to content

Run code at the beginning of execution


Recommended Posts

Let's say i want to replace all appearance of word "pretty" by "beautiful", everywhere in the website.

 

An easy way to do it is to place  

ob_start('handlePage')

in the file index.php and then the function handlePage can be

public function treatPage($html) {
   return str_replace("pretty","beautiful",$html);
}

Now, I'm trying to implement this inside the module but it seems that it is not possible as I can't run my code at the beginning of the execution.

Do you know if there is a way to place my ob_start at the beginning of execution within a module ?

Like some init function ?

 

Thanks.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...