If In Each Page

in my add-on file:

controlers/frontend/init.post.php

if (Registry::get('runtime.controller') == 'index' && Registry::get('runtime.mode') == 'index') {

//my code

}

But this Conditional code, only works in Index Page. I want it to work in All pages Not only in the Main page.
Thanks.

Hello,

Check this code

    if (Registry::get('runtime.controller') && Registry::get('runtime.mode')) {
//my code
 
}

Hello,

Check this code

    if (Registry::get('runtime.controller') && Registry::get('runtime.mode')) {
//my code
 
}

hi my friend. not worked!

Hello,

Check this code

    if (Registry::get('runtime.controller') && Registry::get('runtime.mode')) {
//my code
 
}

i want if empty $geo['country_code'] redirect to an another page, i want to apply this condition for all pages.

i want if empty $geo['country_code'] redirect to an another page, i want to apply this condition for all pages.

i use this code but not work:

if (Registry::get('runtime.controller') !== 'unavailable_country ' && Registry::get('runtime.mode') !== 'unavailable_country ') {
if(empty($geo_select)) {

    return array(CONTROLLER_STATUS_REDIRECT,'unavailable_country.select_country');

}

}

Do you receive error page or continuous redirect?

i use this code but not work:

if (Registry::get('runtime.controller') !== 'unavailable_country ' && Registry::get('runtime.mode') !== 'unavailable_country ') {
if(empty($geo_select)) {

    return array(CONTROLLER_STATUS_REDIRECT,'unavailable_country.select_country');

}

}

Hello

You have useless 1 space after unavailable_country

Best regards

Robert