0
votes

I have a custom template file I'm using for a page.

Say the page is www.mydomain.com/hello-world The content of this page is taken from a template file called hello-world.tpl.php

Now I need to have a variable prepared in advance for that page, so I took a look at how core modules achieve this and tried to implement in the same way, only the variables are always null..

for hello-world.tpl.php I created in my module file a function called:

function template_preprocess_hello_world(&$variables) {
$variables['test'] = "test";
}

As I said $test doesn't get any value on www.mydomain.com/hello-world (I receive NULL when var dumping it)

I spent an hour or so double checking that I don't have any typos or anything like that.

Is what I'm doing worng??

1

1 Answers

0
votes

Try renaming the function to mymodulename_preprocess_hello_world(&$variables). Don't forget to clear the cache as well.