I created a tema.php page. It has header and footer in itself.
It is getting others page by it -> <?php $this->load->view($tema);?>in tema.php.
Now I create blog post detail page. It's name is yazi1.php. It's working right. Header and footer has come to page. And I get datas from database. But now it's give me 5 error. I write errors under it.
Here is my codes ->
Dersler.php (Controller)
public function yazi1($slug = NULL){
$veri['ders'] = $this->Ders_model->getir_dersS($slug);
if(empty($veri['ders'])){
show_404();
}
$veri['baslik'] = $veri['ders']['baslik'];
$beta_veri['tema'] = $this->load->view('yazi1',$veri);
$this->load->view('tema',$beta_veri);
}
Ders_model.php (Model)
public function getir_dersS($slug = FALSE){
if($slug === FALSE){
$query = $this->db->get('ders');
return $query->result_array();
}
$query = $this->db->get_where('ders',array('slug' => $slug));
return $query->row_array();
}
yazi1.php (view)
<?php echo $ders['baslik'];?>
<?php echo $ders['icerik'];?>
Routes.php ->
$route['ders/(:any)'] = 'dersler/yazi1/$1';
Errors... ->
1-
Severity: Warning
Message: pathinfo() expects parameter 1 to be string, object given
Filename: core/Loader.php
Line Number: 900
Backtrace:
File: C:\xampp\htdocs\1koddenizi\application\views\tema.php
Line: 63
Function: view
File: C:\xampp\htdocs\1koddenizi\application\controllers\Dersler.php
Line: 19
Function: view
File: C:\xampp\htdocs\1koddenizi\index.php
Line: 315
Function: require_once
2-
Severity: 4096
Message: Object of class CI_Loader could not be converted to string
Filename: core/Loader.php
Line Number: 905
Backtrace:
File: C:\xampp\htdocs\1koddenizi\application\views\tema.php
Line: 63
Function: view
File: C:\xampp\htdocs\1koddenizi\application\controllers\Dersler.php
Line: 19
Function: view
File: C:\xampp\htdocs\1koddenizi\index.php
Line: 315
Function: require_once
3-
Severity: 4096
Message: Object of class CI_Loader could not be converted to string
Filename: core/Loader.php
Line Number: 907
Backtrace:
File: C:\xampp\htdocs\1koddenizi\application\views\tema.php
Line: 63
Function: view
File: C:\xampp\htdocs\1koddenizi\application\controllers\Dersler.php
Line: 19
Function: view
File: C:\xampp\htdocs\1koddenizi\index.php
Line: 315
Function: require_once
4-
Severity: Warning
Message: include(C:\xampp\htdocs\1koddenizi\application\views): failed to open stream: Permission denied
Filename: core/Loader.php
Line Number: 968
Backtrace:
File: C:\xampp\htdocs\1koddenizi\application\views\tema.php
Line: 63
Function: view
File: C:\xampp\htdocs\1koddenizi\application\controllers\Dersler.php
Line: 19
Function: view
File: C:\xampp\htdocs\1koddenizi\index.php
Line: 315
Function: require_once
5-
Severity: Warning
Message: include(): Failed opening 'C:\xampp\htdocs\1koddenizi\application\views\' for inclusion (include_path='C:\xampp\php\PEAR')
Filename: core/Loader.php
Line Number: 968
Backtrace:
File: C:\xampp\htdocs\1koddenizi\application\views\tema.php
Line: 63
Function: view
File: C:\xampp\htdocs\1koddenizi\application\controllers\Dersler.php
Line: 19
Function: view
File: C:\xampp\htdocs\1koddenizi\index.php
Line: 315
Function: require_once
You could set a TRUE flag when nesting a view to another view, so it will return the content rather than display it :
$beta_veri['tema'] = $this->load->view('yazi1', $veri, TRUE);
$this->load->view('tema', $beta_veri);
Related
I have got the following error:
enter image description here
The block of code which raises the error is :
CopiedLogfileToFtpServer::dispatch($file,$userID,$filename)->onQueue('Copy-Logfile_to_FTP-server')->delay(now()->addMinute(2));
and job class is:
public function handle()
{
$file=$this->file;
$filename=$this->filename;
$userID=$this->userID;
$ftp_host = "172.26.10.197"; /* host */
$ftp_user_name ='username'; /* username */
$ftp_user_pass = '123456789'; /* password */
$remote_file = $filename;
$connect_it = ftp_ssl_connect($ftp_host);
ftp_pasv($connect_it,true);
/* Login to FTP */
$login_result = ftp_login($connect_it, $ftp_user_name, $ftp_user_pass);
$fileList=ftp_nlist($connect_it, '.');
\Log::info($fileList);
if (in_array("./" . $userID, ftp_nlist($connect_it, '.'))) {
\Log::info('True');
$d = ftp_put($connect_it, "./" . $userID . '/' . $remote_file, $file, FTP_BINARY);
} else {
\Log::info('false');
ftp_mkdir($connect_it, $userID);
$d = ftp_put($connect_it, "./" . $userID . '/' . $remote_file, $file, FTP_BINARY);
}
Error log :
D:\SepandProject\laravel>php artisan queue:work --queue=Copy-Logfile_to_FTP-server
[2020-07-28 18:55:59][61] Processing: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:02][61] Processed: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:02][62] Processing: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:03][62] Failed: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:03][63] Processing: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:05][63] Failed: App\Jobs\CopiedLogfileToFtpServer
ErrorException
Illuminate\Queue\Worker::daemon(): SSL_read on shutdown: No such file or directory (2)
[2020-07-28 18:56:03][62] Failed: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:03][63] Processing: App\Jobs\CopiedLogfileToFtpServer
[2020-07-28 18:56:05][63] Failed: App\Jobs\CopiedLogfileToFtpServer
ErrorException
Illuminate\Queue\Worker::daemon(): SSL_read on shutdown: No such file or directory (2)
at D:\SepandProject\laravel\vendor\laravel\framework\src\Illuminate\Queue\Worker.php:132
128| // If the daemon should run (not in maintenance mode, etc.), then we can run
129| // fire off this job for processing. Otherwise, we will need to sleep the
130| // worker so no more jobs are processed until they should be processed.
131| if ($job) {
> 132| $this->runJob($job, $connectionName, $options);
133| } else {
134| $this->sleep($options->sleep);
135| }
136|
1 D:\SepandProject\laravel\vendor\laravel\framework\src\Illuminate\Queue\Worker.php:132
Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Illuminate\Queue\Worker::daemon(): SSL_read on shutdown: No such file or directory (2)", "D:\S
epandProject\laravel\vendor\laravel\framework\src\Illuminate\Queue\Worker.php", ["database", "Copy-Logfile_to_FTP-server", Object(Illuminate\Queue\WorkerOptions),
Object(Illuminate\Queue\Jobs\DatabaseJob)])
2 D:\SepandProject\laravel\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php:112
Illuminate\Queue\Worker::daemon("database", "Copy-Logfile_to_FTP-server", Object(Illuminate\Queue\WorkerOptions))
this code without Queue well working
After installation wizard is finished I get this error.
Slim Application Error
The application could not run because of the following error:
Details
Type: RuntimeException
Message: Identifier DB not initialized yet
File: /.../recovery/install/src/ContainerProvider.php
Line: 162
Is there is some configuration file where I can set DB params? I had insert all params via installation wizard.
In file recovery/install/src/ContainerProvider.php
Add 2 strings:
In use-section
use Shopware\Recovery\Update\Utils;
2.Inside the register-function:
$container['db'] = function ($c) {
$conn = Utils::getConnection(SW_PATH);
return $conn;
};
Here is my config/upload.php code:
if($this->uri->segment(2)=='addPlace'){
$config[upload_path] = './uploads/place_pic/';
$config[allowed_types] = 'gif|jpeg|jpg|png';
}
elseif($this->uri->segment(2)=='addPack'){
$config[upload_path] = './uploads/package_pic/';
$config[allowed_types] = 'gif|jpeg|jpg|png';
}
after run my project it shows:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$uri
Filename: config/upload.php
Line Number: 2
Backtrace:
File: D:\xampp\htdocs\project_tour_city\application\config\upload.php
Line: 2
Function: _error_handler
Use as its not getting instance of class
$this->CI->uri->segment('2')
I would sugest you autoload the URI resource
You can Change Like This
You have to get ci master class
$ci =& get_instance();
// after you use $ci instead of $this
if($ci->uri->segment(2)=='addPlace'){
$config[upload_path] = './uploads/place_pic/';
$config[allowed_types] = 'gif|jpeg|jpg|png';
}
else if($ci->uri->segment(2)=='addPack'){
$config[upload_path] = './uploads/package_pic/';
$config[allowed_types] = 'gif|jpeg|jpg|png';
}
How to use vendor folder as common for my multiple set of projects.
I have added the following lines in composer.json files,
"config": {
"preferred-install": "dist",
"vendor-dir":"/../vendor"
}
"psr-4": {
"ProjectRoot\\" : "",
"NamspaceInSourceDir\\" : "myApp/"
}
and change the vendor folder path in autoload.php.
but still fatal errors and warning messages are displaying,
Warning:
include(D:\workspace\sss\laravel\vendor\composer/../../app/Http/Kernel.php):
failed to open stream: No such file or directory in
D:\workspace\sss\laravel\vendor\composer\ClassLoader.php on line 440
Fatal error: Uncaught exception 'ReflectionException' with message
'Class App\Http\Kernel does not exist' in
D:\workspace\sss\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php
on line 749
ReflectionException: Class App\Http\Kernel does not exist in
D:\workspace\sss\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php
on line 749
I would like to create a directory but I got this error :
ErrorException in Filesystem.php line 390: mkdir(): No such file or directoryErrorException in Filesystem.php line 390: mkdir(): No such file or directory
in Filesystem.php line 390
at HandleExceptions->handleError('2', 'mkdir(): No such file or directory', 'C:\xampp\htdocs\yatan\yatan\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php', '390', array('path' => 'C:\xampp\htdocs\yatan\yatan\public/assets/images/projects/1/1476592434/', 'mode' => '511', 'recursive' => false, 'force' => false))
my code :
$to_main_image = time();
$path = 'assets/images/projects/'.$user_id.'/'.$to_main_image.'/';
File::makeDirectory(public_path().'/'.$path,0777);
Change the line
File::makeDirectory(public_path().'/'.$path,0777);
to
File::makeDirectory(public_path().'/'.$path,0777,true);
So that the sub-directories are also created.
if using laravel 5.8 then try this out
go to vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php and find prepareCache function and edit line no 247 -
if (!mkdir($cacheDir))
to
if (!mkdir($cacheDir,0777,true))
Adding the code snippet as well.
private function prepareCache($nsKey)
{
$cacheDir = $this->path.'/'.$nsKey;
if (!is_dir($cacheDir)) {
if (!mkdir($cacheDir,0777,true)) {
throw new Swift_IoException('Failed to create cache directory '.$cacheDir);
}
$this->keys[$nsKey] = [];
}
}