2010-04-30 10 views

Répondre

2

Si je comprends bien, vous devriez être en mesure de faire quelque chose comme ça pour votre contrôleur

<?php 
class Blog extends Controller 
{ 

    function index() 
    { 
    $data['title'] = "My Real Title"; 
    $data['heading'] = "My Real Heading"; 

    $this->load->view('blogview', $data); 
    } 
} 
?> 

Et quelque chose comme ceci pour votre vue:

<html> 
<head> 
<title><?php echo $title;?></title> 
</head> 
<body> 

Ceci est issu du Codeignitor Guide de l'utilisateur here

1

Contrôleur:

function show_something() { 

    $data = array(); 

    if ($this->input->post('some_form_field') { 
     $data['form_value'] = $this->input->post('some_form_field'); 
    } 

    $this->load->view('some_view'); 

} 

En Vue:

<html> 
<head> 
</head> 
<body> 

    <?php if ($form_value): ?> 
     <h1><?= $form_value; ?></h1> 
    <?php endif; ?> 

    <form method="post" action=""> 

     <input type="text" name="some_form_field" /> 
     <input type="submit" value="Show Value on Page" /> 

    </form> 

</body> 
</html> 
1

dans le contrôleur

function show_something() { 

    $data = array(); 

    if ($this->input->post('some_form_field') { 
     $data['form_value'] = $this->input->post('some_form_field'); 
    } 

    $this->load->view('some_view', $data); 

} 

en vue

<html> 
<head> 
</head> 
<body> 

    <?php if ($form_value): ?> 
     <h1><? echo $form_value; ?></h1> 
    <?php endif; ?> 

    <form method="post" action=""> 

     <input type="text" name="some_form_field" /> 
     <input type="submit" value="Show Value on Page" /> 

    </form> 

</body> 
</html> 
Questions connexes