Welcome Guest, Not a member yet? Register   Sign In
Integrating CKFinder / Load .html with view()
#1
Question 
(This post was last modified: 05-05-2020, 11:36 AM by jreklund.)

Hi everybody,

I am trying ot integrate CKFInder in my app. Some questions will be directly CKFinder related, other will be broader, like the first one.

I stored the php connector in my server (as in the docs), but under \App\ThirdParty\ckfinder. Now I want to access teh sample sites, i.e. \App\ThirdParty\ckfinder\samples\ckeditor.html.

How do I do that? How do I route to a direct html file? I tried via closures, but it does not even parse:

PHP Code:
$routes->group('ckfinder', ['namespace' => 'App\ThirdParty\ckfinder\samples'], function($routes){
    $routes->get('full-page-open.html', function (){
        view('full-page-open.html');
    }); 
Reply
#2

Hi there,

I am trying to show a .html File located under ThirdParty. I am also not able to show the file if it is under View using the view method.

I tried this:

PHP Code:
$routes->get('/ckfinder',function (){
            view(ROOTPATH'app/ThirdParty/ckfinder/samples/full-page-open.html');
        }); 
and I get the exception: Invalid file: /var/www/html/blog/app/ThirdParty/ckfinder/samples/full-page-open.html 

If I store it under Views and call:
PHP Code:
$routes->get('/ckfinder',function (){
            view('full-page-open.html');
        }); 
I get a blank page with the Toolbar
Reply
#3

Please keep it to the same thread, it's the same issue. I have now merged your thread a second time.
Reply
#4

(05-05-2020, 11:19 AM)jreklund Wrote: Please keep it to the same thread, it's the same issue. I have now merged your thread a second time.
Aaah, ok. I thought I posted it to myself as an answer, that's why... My bad.
Reply
#5

(This post was last modified: 05-06-2020, 12:33 PM by elserra.)

For anyone wondering, I made some progress:

new route in Config/Routes.php:
PHP Code:
$routes->group('ckfinder',function($routes) {
    $routes->get('''CKFinderController::index');
    $routes->get('/samples/(:any)''CKFinderController::index/$1');    
    $routes
->get('(:any)''CKFinderController::index/$1');    
}); 

New Controller in Config/Controllers:
PHP Code:
class CKFinderController extends BaseController{
    public function index($folder 'samples'$page 'full-page-open.html')
    {
        $view = \Config\Services::renderer();
        $namespace APPPATH.'ThirdParty/ckfinder/';
        return file_get_contents($namespace.$folder."/".$page);
    }

I am wondering if there is a better way than file_get_contents for returning a .html, .css, .js & co. files as is...

I also seem to have some trouble running JS. An intended messagebox appears, but no content...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB