How to pass friendsofcake/search results onto different view in CakePHP 3.x? - cakephp-3.x

I've successfully implemented friendsofcake/search plugin into my app but I'm having a hard time passing the results of my search onto another page. Is this possible? If so, where would I configure it on my app?
Say, on my index.ctp where my search form is, I want the output to be on search.ctp.
Thanks!

Related

How to add search to my static laravel site?

I'm building my first ever website using laravel 5.2. Right now, I'm only serving static content with a few API requests for things like the current weather. I've never built a website before, but I'm running my own droplet at DO, so there's no shared hosting limitations.
How would I implement a search that allows users to search my site's content from the main screen? Currently there's no interaction on a DB, it's all just Blade/HTML. I want to avoid using Google Custom Search as there should be no ads, and I want to learn along the way.
Please advise.
It depend on the amount of static contents you have in your site. Maybe you could try implementing it the following way.
Create lookup of the views pages with the most relevant keywords
When user search for keyword which match to any of my relevant keywords, I would load the respective view page.
I would store the the lookup in json format. It would be similar to contents with multiple tags on them.
Here, creating json file is going to be tedious and needs to be done manually.

How to build a simple form in CQ5

I have started a new AEM project in eclipse that has
core
launcher
tests
ui.apps
ui.content
I have a local instance of 5.6.1 running and I would like to create a very simple form (firstname, lastname) and have it persist data such that I can view data for all forms submitted. Also, I would like for the form to be approve/rejected (e.g. user1 submits the form, user2 accepts/rejects it).
I'm new to AEM and have been looking at docs and trying to find a tutorial for it for a while now but haven't been successful.
Question
Can someone please walk me through how to accomplish this simple form? Once I can do this I can build-up more functionality on my own.
What I've tried
I tried to create a form in the Geometrixx Media site but I don't see form template there.
I also tried following this tutorial but it didn't help since its for 6.0 and is confusing to the point that I don't follow it at all.
You need some basic understanding of how cq/aem works in order to accomplish the task you started. But in the simplest use case, you need the following things:
You can create new cq page component and define in the jsp the html markup of the form you need
Or you can build a page/component using the /libs/foundation/components/form components. Start reading the best from the page developing forms.
The form action can point to the component itself where you can store the data (if you create a page with a component who is responsible for rendering the form) and in this case you can let sling post processor to handle the data storage or you can define your own action with a servlet where you can create a node on your desired location.
The second part of you question is about approving/rejecting submitted data. I guess, that you are talking about workflows. Every time the form is submitted you have to create a new node (or let sling to create it) and than start a workflow for moderating the content. You use here as example the implementation of the social comments and the moderation workflow.

Dynamically update the UI when selecting a date

I'm trying to learn some basic knowledge of jsp, suppose that I have a project, in this project, after signing in, I have a Main.jsp with a calendar or a dropdown list in it, when selecting a date, I'll change the UI based on the data from database.
I can put all relevant data into request after signing in, and use JSTL in Main.jsp, but if the data is huge, this doesn't sound like a good idea, right?
Back to the old age when there's no JSTL or AJAX, how does jsp developer deal with this? And what is the best practice nowadays?
Thanks.
If you are talking to render about without JSTL or AJAX, the only option i see is to submit/send the form to server and get it back with updated view, but yes it will cost a lot in terms of performance.
I think for your use case:
1) you can get the data from server via AJAX on every update,
2) or, if the data is not customer dependent and is fixed in terms of UI, you can load it lazily in background, and change the view immediately on the user action.

Spring web mvc 3.0 Form data and image upload issue

I am new to spring and JSP. My web application is spring powered, which I run locally in apache tomcat.
In my JSP page I have multiple file-upload inputs and many text input fields.
Every time, when I press any of the upload buttons, a HTTP POST request goes to my controller from where on I may save the image to the database.
But, what I want is:
I will upload the images one by one ( preferably by staying in the page) but won't save them in database and then when I press submit to get the rest of the input text fields data, I commit all the data, including image, texts to the database in one try.
I have heard of scope="session" for my controller(bean) in the dispatcher-servlet.xml ... but I am unsure as to if I upload image to my controller and get back to my JSP form, will the bean keep my already uploaded images?
I think it is hard for me to explain, so please let me know if my question is not clear.
It would be nice if anybody can come up with a suggestion that may help to obtain my goal.
Are you uploading a varying number of images, as in if someone wants to upload only 2 they'll have 2 file fields on the form, or does everyone get 5 fields for example?
To be honest, the whole scheme of incremental upload sounds a bit overcomplicated at this stage. (Unless you have an explicit need to show progress bars on each upload, etc.) What if the user abandons the form after uploading the first image? You'd need a pretty solid mechanism to keep track of the entire visit, keeping it in the session wouldn't help here. Can a user pick up where they left off? If you make the whole thing work with single form submit click first, you can break it out and fine tune the process later. I mention that since you stated you're new to jsp and Spring (what's your experience with web dev otherwise?)
I think the best way is to upload file using ajax control rather than submitting form for each upload and store the file references in session scope variable(attribute). there are lot of libraries have ajax based file uploading like extJS, JQuery, GWT, DWR , whatever ajax library you are using in your web application.

How to achieve clickstream or click tracker function in Django?

I have a question that i want to add the function to track the click stream of user in my website, How can I achieve this, using ajax tracker or Django-tracker modules?
I have actually wrote a django-clickstream application, I just haven't open sourced it yet, I want to test it out to make sure it works well before releasing it.
Here are the steps you need to do to reproduce what I did, it isn't too hard.
First off you would need to keep track of each visitor for the life of their session or cookie. You can do this using django-visitor or roll your own.
Once you have a visitor you can create a custom middleware that will look at each request and then log what url each visitor visits to a database table. Then all you need to do is create a simple web page where you can view the different click streams by visitor.
One important thing to note is that you will need to setup an exclude filter so that the middleware doesn't pick up any urls that you don't want to track (static, etc), I did this with a simple list of regular expressions that I stored in the settings file. If the url doesn't match one of the regular expressions then log it.
The table will get pretty big real fast if you have a popular website so you will need to create a management command to clean out the old records from your tables.
Django-visitor: https://bitbucket.org/kencochrane/django-visitor
Edit:
Check out Django-clickstream: https://bitbucket.org/kencochrane/django-clickstream

Resources