Jump to content

How to use wireSetting in Hanna code?


LAPS
 Share

Recommended Posts

Hi, in the /site/init.php file I've stated:

wireSetting([
  'a_key' => [
    'value1', 'value2', 'valueN'
  ],
  '...' => '...'
])

I normally use with success the wireSetting in my template files like this: wireSetting('a_key').

I would like to use this wireSetting in an Hanna code, but when I do this I get the error "Method ProcessWire::wireSetting does not exist or is not callable in this context".

How can I use wireSetting in Hanna code?

 

Link to comment
Share on other sites

39 minutes ago, LAPS said:

Maybe there is something better...

Just have a look at the Hanna Code Module Example 😉 
https://processwire.com/modules/process-hanna-code/

<?php namespace ProcessWire;
foreach($page->children as $child) {
  echo "<p><a href='$child->url'>$child->title</a>";
}

You are probably missing the processwire namespace in the php file 😉 

Link to comment
Share on other sites

1 hour ago, zoeck said:

You are probably missing the processwire namespace in the php file 😉

I tried to state the namespace ProcessWire at the top of the Hanna code without success. I've to state the inline \ProcessWire\ namespace to make it work. 🤷🏻‍♂️

It would be great if someone explains why this happens. 😃

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
 Share

×
×
  • Create New...