Multiple files upload using CakePHP Uploader - cakephp

Is it possible to upload multiple files (images in particular) using CakePHP Uploader and HTML5 multiple attribute? And of course save those images with hasMany relation, eg Project hasMany Image.
EDIT:
I am using CakePHP 2.x, this is the Uploader. I have tried adding multiple attribute to input, but seems that is not working, only saves 1 image. Miles is suggesting multiple inputs, I wanted to use only one input field for this matter. So the question above stands.

The simple answer is: Not out of the box. Multiupload widgets are actually kind of tricky (as you need to change the behavior of the upload panel. My weapon of choice for this is: http://blueimp.github.io/jQuery-File-Upload/
A very simple javascript example is provided here: http://kajda.com/scripts/multiupload/js/multiupload.js
Alternatively, you could have a field that takes multiple drag and drops (using HTML5) instead of the upload panel. Check this one out:
http://www.9lessons.info/2012/09/multiple-file-drag-and-drop-upload.html

Related

Where to create common functionalities with view in cakephp?

I am new in cakephp. I have a module with name contact us in 1 of my project. This module need to show on almost all pages of the website. So my question is, for this common module can we create component or there is some other way to complete it? I read about the components for the site and found that components does not have own views. Please suggest me how can we do this?
Thank you
Cakephp Elements
Many applications have small blocks of presentation code that need to be repeated from page to page, sometimes in different places in the layout. CakePHP can help you repeat parts of your website that need to be reused. These reusable parts are called Elements. Ads, help boxes, navigational controls, extra menus, login forms, and callouts are often implemented in CakePHP as elements. An element is basically a mini-view that can be included in other views, in layouts, and even within other elements. Elements can be used to make a view more readable, placing the rendering of repeating elements in its own file. They can also help you re-use content fragments in your application.
Elements live in the /app/View/Elements/ folder, and have the .ctp filename extension. They are output using the element method of the view:
echo $this->element('helpbox');
For more details check out Views — CakePHP Cookbook 2.x documentation

How to annotate a PDF document in WPF

First I need to show a PDF File in an WPF application . It appears the only two ways are using a web control or some sort of WinForms/Com based solution using the Acrobat reader component.
Assuming I get it to show up in a UI my problem is I want to add annotations to the PDF itself. Is this even possible.

How to setup Cakephp with Twitter Bootstrap

I have found some issues working with Twitter Bootstrap in Cakephp and having set cake.generic.css
Most tutorials are telling to use both, cake.generic.css and bootstrap.css in the same time, although there are some conflicts between styles.
On the other hand, I have found some comments on the net saying it is not needed, after setting bootstrap, to use cake.generic.css. (http://cakephp.1045679.n5.nabble.com/What-s-the-best-way-to-get-Twitter-Bootstrap-into-Cake-td5712643.html, http://thehappydeveloper.wordpress.com/2012/02/24/setting-up-twitter-bootstrap-with-cakephp/)
What is the best practice to setup Twitter Bootstrap with Cakephp?
Working with Twitter Bootstrap is not any different than working with any other frontend framework. That being said, you don't need to keep default css if you are not going to use it. Just modify your layout to include the css/js files as usual and style your elements in the way Bootstrap is expecting you to do it.
However, since nobody likes to reinvent the wheel I would suggest to use a CakePHP plugin that handles all that for you, here is one
When dealing with forms, you can make use of the Bootstrap 3 FormHelper we created, that pretends to be highly configurable and let us do none or minimal additional coding. You are able to create inline or horizontal forms easily, or even create new form styles and apply them globally in your app. You can download it and see instructions/examples at http://bs3form.qtsdev.com.
Bs3Form tries to be a better alternative to the the BoostCakeForm (it's just a helper, not an entire plugin). Some of the main features are: Creation of default / horizontal / inline forms with almost no additional configuration, creation of static controls, adding feedback or input groups easily, global options and styles definitions that remove the need to define inputDefaults in every form, external wrapping for smaller input in horizontal forms that prevent help/error messages unnecesarily breaking, etc.

Custom Content Regions for a Drupal 7 Home Page

I am developing a Drupal 7 site with a home page that consists of 5 regions. Each region will need to be editable within the Drupal admin system. Each region at a minimum will need to have an image upload and a text/body field. There may be other additional fields for certain regions. In other words not all of these regions will need the exact same fields.
I am not sure what the best way to set this up in Drupal is. I looked at Blocks but they don't have the ability to customize the fields. And I need my image field to be separate because it will be used as a background image for the region, not displayed inline.
I considered creating a custom content type but I wouldn't want the content editors to be able to create multiple nodes for a given region which would likely cause confusion.
I did see a module Node Limit that seems to limit the number of nodes that can exist for a user or content type but it is still listed as an alpha module.
What have you done to deal with a similar situation?
It sounds like creating a custom block would serve you well. It's very easy to do, you can add your own form/fields with hook_block_configure() and hook_block_save(). Here's one of my module files that includes custom block with a config form.
You could also possible use the Display Suite module to add fields into a region, as explained here.
Display Suite is good for configuring a node's fields in a presentation layer.
But your problem could be on the top of that... Maybe your problem is content building, and one of your most powerfull & flexible options is the paragraphs module.
With paragraphs you must create a content type, with the paragraphs bundles inside of it as a field, then create a page and set it to be your front page. Then customize these node types presentation with Display Suite as you need.
I know a content type for a page sounds too much, but depending on your situation this could be your best choice.
Paragraphs module and the Display Suite Module are very powerful together when you need powerful content creation and advanced theming.
If you have any doubt just ask.
Hope that helps.

Multiple instances of Silverlight gallery

I wanted to try was to make an asp website which would include pictures in multiple Silverlight galleries. The reason why I want to do this is that I want something in this fashion:
Text describing some places.
Gallery with several pictures that are relevant for the text.
Text describing some other places.
Gallery with several pictures that are relevant for the other places.
etc.
I managed to use the popular SlideShow2 (http://slideshow2.codeplex.com/) but I ran into problems with multiple instances of the Silverlight object. If I put two galleries on the page they work correctly, if I put more of them then two of them work (oddly for example first and third out of nine). Is there some Silverlight restriction for a size of objects you can load? Also - is it a reasonable approach to place the object there more times? I wonder if it is a big slowdown.
Anyway, what would you suggest to use for the described scheme? I don't necessarily require a slideshow of the pictures (though it would be nicer) but I would like the galleries to be in Silverlight.
EDIT - Slideshow2 link corrected
First off, make sure you're using the updated SlideShow2 (http://slideshow2.codeplex.com/). Your post mentioned the older SlideShow1.
This issue might be related to the order in which the browser is rendering the Silverlight object. Try instantiating the Silverlight object using the Javascript CreateObject function in Silverlight.js.
Remove all of the declarative objects as mentioned in Step 1 of the Quick Start Guide
Add the following script for each of your galleries:
.
document.write("<div id=\"silverlightControlHost\">");
Silverlight.createObject("http://PathToMyXAP/MyXap.xap", document.getElementById('silverlightControlHost'),"slPlugin",
{
//Enter XAP params here
},
{ onError: onSilverlightError }
);
If you find a Gallery using a later version of Silverlight, the performance might be greatly improved.

Resources