Welcome Guest, Not a member yet? Register   Sign In
Best Practices for View Embedding
#1

[eluser]Sayian[/eluser]
Yes it's been asked a million times.

Yes I've read the search results.

Everyone seems to have several ways of embedding views within views, however I have just one question.

Is it against the CI way to do something like

Code:
<?php
############################################
## File: example_view.php
############################################

$this->load->view('required/foo');

## Page Content Here

$this->load->view('required/bar');

?>

Thank you.
#2

[eluser]The Wizard[/eluser]
no why should it be?
i do exactly this

Code:
<? $this->load->view( $theme_folder . 'header/user/header.php'); ?>
    
    <? $this->load->view( $theme_folder_vault . 'form_message_send.php') ?>

<? $this->load->view( $theme_folder . 'footer/normal/footer.php') ?>
#3

[eluser]TheFuzzy0ne[/eluser]
Technically, you should not use $this in your view. We should pass through a variable and use that instead.

Code:
$CI->load->view('required/foo');

## Page Content Here

$CI->load->view('required/bar');

But hey, it works. Smile
#4

[eluser]The Wizard[/eluser]
why shouldnt we use it?
#5

[eluser]TheFuzzy0ne[/eluser]
Context.
#6

[eluser]The Wizard[/eluser]
What does this exactly mean?
Could you please explain that
#7

[eluser]TheFuzzy0ne[/eluser]
I think JayTee said it best - http://ellislab.com/forums/viewthread/104538/#544361.




Theme © iAndrew 2016 - Forum software by © MyBB