How to integrate KCFinder inside zend application as standalone - php

I want to integrate KCFinder inside Zend framework, i want this
http://kcfinder.sunhater.com/demo/kcfinder/browse.php?type=files&dir=files/public
page to be included inside my template without using any iframe, i had tried many things by calling browser.php file inside my view but i am facing issues with file loading and their dependencies, even resolving php file dependency by using autoloader js files are not loading properly
Please help me out on this

I had collaborated with project like CKfinder called Elrte.org
and i did make a custom ZF form element for it
a sample example on my github account :
https://github.com/tawfekov/Elrte-Element-for-Zend-Framework
the demo has ability to show the rich text editor + file manager
feel free to extend it or to get an example of it

Related

How to organize desktop and mobile views separately (Zend Framework)

I'm already running a desktop website with views and template files. Now I would like to develop a mobile version of my website.
I've already detect smart devices by using WURFL library within my own Plugin and I inject that plugin during application initialization.
I'm using Zend ContextSwitch Helper to change the context of current view file with suffix 'mobile' like: index.mobile.phtml.
What I need to organize my existing views under separate folder for mobile like: /views/mobile/index.phtml not as /views/index.mobile.phtml (same folder).
//Add Context
$this->addContext('html', array('suffix' => 'mobile'));
Please advise me how can I tell application to search mobile views under mobile for every views.
I'm using Zend Framework 1.12 version
Your desired approach may be confusing because /views/mobile/index.phtml will refer to "mobile" controller
You may override this by simply changing the template path destination for mobile templates. $view->setScriptPath('mobile')
Another way is to store them in the same folder but with different suffix /views/controller-name/action-name.mobile.phtml
You can achieve this just by changing the view extension using view renderer. $viewRenderer->setViewSuffix('mobile.phtml');
Or you may rewrite your templates using responsive webdesign :-)

Load Vendor javascript files CakePHP 2

does everybody know how to load javascript files (as opposed to php classes) from a third party library (placed in app/Vendor/LibraryName). I tried to look into App::import(), but apparently it's only to import classes. I'm trying to use Jssor slider library in a CakePHP 2.5.5 application.
Thanks in advance for any help
if it's a .js file is best to put the files on /app/webroot/js/jssor_library.js this route. then you can use the library on the controller or the view by loading so:
echo $this->html->script('jssor_library');
once loaded, the code is the same as when you use it regularly.
good if an entire folder, then copy the folder path and calls the library you're using, including the name./app/webroot/js/folder_jssor/jssor_library.js
echo $this->html->script('folder_jssor/jssor_library');

Execute a single non-Zend php file in Zend Framework

I have a website running on Zend and I have a single file that is written from somewhere else and does not follow the Zend framework.
The file merely imports content from another site so it is ok that it has no user interface and only needs to be run. Ideally I want to run it from the website front end (a single button click). I don't want to go through and re-write the code to load as a native Zend file.
How can I achieve this? Where should I place the file? The project is in /var/www/projects/myproject, inside myproject there is the usual application, cache, data, extra, htdocs, log, nbproject folders. Under the application folder, as standard Zend, there are models, modules, config, data folders.
Please let me know
Thanks for your help in advance

Doesn't Codeigniter have folders like assets and layout

I am new to CI. I am using version 2. I noticed like other frameworks CI didn't have folders like assets and layout. Where do i place files like css and js and images. Also where is the layout folder.
You can place your assets directory wherever you desire, putting it under the root CodeIgniter directory is usually the norm.
CodeIgniter has no reason to include an assets directory as that's usually a front-end requirement, of which CI isn't made for (it's a back end MVC framework).
a simple answer is no. CI don't have that. You need to manually create.
And if you are coming from Yii, Ci doesn't implement that feature of Layout.
EDIT
by default, CI doesn't have. You can tweak it but easier implementation is
$this->load->view('header', $param1);
$this->load->view('content', $param2);
$this->load->view('footer', $param3);
where param1, param2, .... are variables you want to pass it to view.
CI will add the views in that order.
and remember, don't put .php while at the end of the filename in view().
No
Is the simple answer, you have to extend CIs functionality and use a library from a third party to provide these features for you. CI doesn't focus on the aesthetics of the "front-end". Its primary focus was "back-end".
Your Options:
look into Phil Sturgeons template library, and CI Sprinkles library first is for layout/theme/partials management, second is for asset management js/css minification and caching.
Phil's Template Library: http://philsturgeon.co.uk/demos/codeigniter-template/user_guide/
Sprinkles Library: https://github.com/edmundask/Sprinkle
Or build your own basic template library
This is a great intro video how to do such. I have used this in the past, before i got into using Sparks.
http://www.youtube.com/watch?v=gvGymDhY49E
you can use Sparks to make lib management a bit easier
In 2.1 sparks aren't included however it is in the dev builds of CI so im sure at a later date it will be merged in with the base code. FOr now you can use this site to install Sparks to help you manage third party libraries.
http://getsparks.org
You don't have to use a template library.
You don't have to programmatically serve the CSS and JS it can just be part of a view file.
But, you can if you want to! CI is incredibly flexible. We've written our own template library that works great for us (we'll release it soon, just checking that it works how we want it to...) but it might not suit the way you work.
Try using this PHP layout manager library, can be integrated with codeigniter easily:
https://github.com/mahadazad/php-layout-manager
its easy to setup and use.
look for assets helper to load css and js file anywhere..
Simple assets helper for codeigniter

Symfony + HTML5Boilerplate integration?

Are there any examples out there on how to integrate HTML5Boilerplate into Symfony? The problem that I'm running into is the way Symfony handles stylesheet and javascript loading.
Symfony likes you to add your stylesheets and javascript to a special object in the controller (or define them in the view.yml) and then your template/view just call <?php include_stylesheets() ?> and <?php include_javascripts() ?>.
The problem is that the HTML5Boilderplate template wants you to load the Modernizr.min.js in the <head> and all the rest of the javascript files at the end of the </body>. Symfony's magic function wants to just load them all at once though. And I can't seem to figure out a way to selectively load them one at a time in the template.
Also, HTML5Boilerplate has CDN jQuery loading with a dynamic local backup load like this:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jqduery.js"></script>
<script>window.jQuery || document.write("<script src='js/backend/libs/jquery-1.5.1.min.js'>\x3C/script>")</script>
Is there anyway to accomplish this in Symfony templates without having to inject the PHP $_SERVER[whatever] into the code?
I feel like I can probably make it all work together but I'm trying to avoid making it too hacky because Symfony uses so many magic methods and voodoo...
Symfony Version
I'm using Symfony 1.4 for this project. The available web host isn't running PHP 5.3.x yet, which is a requirement of Symfony 2.0
If you want to selectively load assets in different locations in the HTML that Symfony 'prefers', you won't be able to use load_javascripts() and load_stylesheets(). I'm not familiar with HTML5Boilerplate, but if you're still using a layout file, why not just manually put the asset includes where you need them to go? This goes against Symfony's way of using view.yml to queue up assets, but sooner or later with any framework you're going to run into cases where you need to do someting your way.
Again, I'm not familiar with HTML5Boilerplate, so if I'm not seeing something, let me know in the comments.
If you are using Symfony 2.0 you should use OryzoneBoilerplateBundle
What version of symfony are you using?
I use html5boilerplate with symfony (2.0) no problem, simply calling the css and javascript straight from a twig template in my resources folder.

Categories