CodeIgniter Forums
HMVC question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: HMVC question (/thread-15357.html)



HMVC question - El Forum - 02-02-2009

[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...


HMVC question - El Forum - 02-02-2009

[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');


HMVC question - El Forum - 02-02-2009

[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 :-(


HMVC question - El Forum - 02-02-2009

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

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


HMVC question - El Forum - 02-02-2009

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


HMVC question - El Forum - 02-02-2009

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

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


HMVC question - El Forum - 02-03-2009

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


HMVC question - El Forum - 02-04-2009

[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


HMVC question - El Forum - 02-04-2009

[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