Welcome Guest, Not a member yet? Register   Sign In
HMVC question
#1

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

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

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

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

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

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

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

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

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

[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
#9

[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




Theme © iAndrew 2016 - Forum software by © MyBB