Jump to content

Use variable of module in frontpage


Karamellwuerfel

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...