CodeIgniter Forums

Full Version: HMVC question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]NiconPhantom[/eluser]
Hi all

I need load some data from one module(controller/view) to another...

Is it possible use something like this?:

$data['message'] = $this->load->view('../modules/firstpage/views/firstpage');



This solution doesn't work plese help do something similar...

El Forum

[eluser]NateL[/eluser]
[quote author="NiconPhantom" date="1233594024"]Hi all

I need load some data from one module(controller/view) to another...

Is it possible use something like this?:

$data['message'] = $this->load->view('../modules/firstpage/views/firstpage');



This solution doesn't work plese help do something similar...[/quote]

Have you tried this?

$data['message'] = $this->load->view('firstpage/views/firstpage');

El Forum

[eluser]NiconPhantom[/eluser]
[quote author="NateL" date="1233614534"][quote author="NiconPhantom" date="1233594024"]Hi all

I need load some data from one module(controller/view) to another...

Is it possible use something like this?:

$data['message'] = $this->load->view('../modules/firstpage/views/firstpage');



This solution doesn't work plese help do something similar...[/quote]

Have you tried this?

$data['message'] = $this->load->view('firstpage/views/firstpage');[/quote]


Yes, all good but this code load view firstpage to the top of the site but not to: <?php


if (isset($message) AND $message!='')

{

echo $message;

}?>

of my main view template :-(

El Forum

[eluser]NateL[/eluser]
see if == works.. ?

if (isset($message) && $message!==’‘)

El Forum

[eluser]NiconPhantom[/eluser]
same effect, on the top of site :-(

El Forum

[eluser]NateL[/eluser]
sorry, $message!='' was right

if (isset($message) && ($message!=’‘)){

El Forum

[eluser]NiconPhantom[/eluser]
If i do $data['message'] = "Text"; all is good, the "Text" is in normal place of template...

El Forum

[eluser]MikeHibbert[/eluser]
Thats not really the way CI works, try this:

in your controller:

Code:
$data['message'] = "some message";

$this->load->view(‘firstpage/views/firstpage’, $data);

Then in your view:

Code:
if(isset($message)) {
  echo $message;
}

Thats normal way of passing special case text into a page when using CI

Hope that helps

Mike

El Forum

[eluser]NiconPhantom[/eluser]
Yes that's ok but i found another solution! In my template i use:

<?=modules::run('firstpage/left'); ?>

Now i can use one controller in another... Sometimes it's useful for my project


Thank you for your help!!!

Alex