$this->view_data = array (
'page_title' => 'Some title', // текст, идущий в <h1>
'page_content' => 'view_dir/view_name', // путь к нужной вьюхе относительно каталога views
// куча других переменных, идущих во вьюху
);
$this->load->view ('page', $this->view_data);
<?php
$page = array (
'layout/header', // путь к общему хэдеру
$page_content, // контент
'layout/footer' // путь к общему футеру
);
foreach ($page as $item) {
$this->load->view ($item);
}
/* End of file page.php */
/* Location: ./application/views/page.php */
#!/usr/bin/perl
use strict;
use warnings;
use threads;
use Thread::Queue;
use Data::Dumper;
my @myarray = (1 .. 1000);
#print Dumper (\@myarray);die;
my $count = shift || 10;
print "Number of threads: $count\n";
my $q = Thread::Queue->new;
my @threads;
for (0 .. $count - 1)
{
push @threads, async {
while (defined (my $f = $q->dequeue))
{
some_process ($f);
}
};
}
for (@myarray)
{
$q->enqueue ($_);
}
# Tell workers they are no longer needed.
$q->enqueue (undef) for @threads;
# Wait for workers to end
$_->join for @threads;
print "Complete\n";
1;
sub some_process
{
my $element = shift;
my $tid = threads->self->tid;
#my $count = threads->list (threads::running);
#print "Running threads: $count\n";
print "Thread $tid started\n";
open my $F, '>>', $tid . '.txt';
print $F 'TID: ', $tid, ', element: ', $element, "\n";
close $F;
print "Thread $tid stopped\n";
}
$route['ex'] = "ex/index";
$route['ex/(:num)'] = "ex/index/$1";