Karamellwuerfel Posted January 10, 2017 Report Share Posted January 10, 2017 Hey. I want to use a variable of my own module in the frontage main. How I get access to that variable? I tried this Template::Set('MODULE_TEST', $clients); but does not work... Thats the answer from this topic. Many thanks! Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted January 10, 2017 Members Report Share Posted January 10, 2017 usualy it returns as an array have you tried to print_r($MODULE_TEST); and see what it returns ? Quote Link to comment Share on other sites More sharing options...
Karamellwuerfel Posted January 10, 2017 Author Report Share Posted January 10, 2017 26 minutes ago, Vangelis said: usualy it returns as an array have you tried to print_r($MODULE_TEST); and see what it returns ? there's nothing..hm... Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted January 11, 2017 Members Report Share Posted January 11, 2017 What other code doyou have ? Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 12, 2017 Moderators Report Share Posted January 12, 2017 I cannot say that I have understood what do you mean exactly.. Could you please explain it a little bit better? Quote Link to comment Share on other sites More sharing options...
Karamellwuerfel Posted January 12, 2017 Author Report Share Posted January 12, 2017 4 minutes ago, servetas said: I cannot say that I have understood what do you mean exactly.. Could you please explain it a little bit better? I created the InstantWeather Module. Okay. Now I have there an variable for example "$iwm_metar". Now, how can I show THIS $iwm_metar variable on the frontpage_main for example? Now it works only for the Module-page of InstantWeather. Hope you understand now^^ THANKS Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 12, 2017 Moderators Report Share Posted January 12, 2017 I do not know if something like this can be done (directly getting a variable from a function without running it). What you can do is creating a new function in your module and call it in your frontpage using the following part of code: <?php MainController::Run('YOUR_MODULE_NAME', 'YOUR_FUNCTION_NAME', 'SET HERE ANY FUNCTION PARAMETERS IF ANY); ?> And anything you echo inside the function will be shown where you placed the above part of code. Quote Link to comment Share on other sites More sharing options...
Karamellwuerfel Posted January 12, 2017 Author Report Share Posted January 12, 2017 13 minutes ago, servetas said: I do not know if something like this can be done (directly getting a variable from a function without running it). What you can do is creating a new function in your module and call it in your frontpage using the following part of code: <?php MainController::Run('YOUR_MODULE_NAME', 'YOUR_FUNCTION_NAME', 'SET HERE ANY FUNCTION PARAMETERS IF ANY); ?> And anything you echo inside the function will be shown where you placed the above part of code. Mh... I tried something like this, is it correct? I first added a function public function get_metar() { echo "HELLO"; } and then I added the code in my frontpage_main <?php MainController::Run('InstantWeather', 'get_metar()'); ?> Nothing happens. Even if I declare a new variable in the get_metar() function and ask for it in the frontpage. Any ideas? Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 12, 2017 Moderators Report Share Posted January 12, 2017 Use this: <?php MainController::Run('InstantWeather', 'get_metar', ''); ?> 1 Quote Link to comment Share on other sites More sharing options...
Karamellwuerfel Posted January 12, 2017 Author Report Share Posted January 12, 2017 Just now, servetas said: Use this: <?php MainController::Run('InstantWeather', 'get_metar', ''); ?> WORKS for me! Thank you very very much!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.