Cachephp 3, options list from table in each page - cakephp

I'm using Cakephp 3.0. I want to show a checkboxes filter for categories in a menu present in each page with an icon as label.
I have a table (model) "category" with id, name, icon, etc. I want to take these fields in a form in the menu, but I do not want to repeat the query in each method of each controller to pass the variable.
I thought to make the query in the view or in a helper, but I did not find the way.
How would you proceed?
Thank you

Related

Is this good URL design practice in React?

I start out in a listview where each item in the listview is an item each with a unique _id displaying only partial information, clicking on them will route to another page and display all the info. Now, I click on an item, route to the unique id and a brand new component, then, in the new component, I take that unique ID, search up that unique ID in my MongoDB database, then display the item that was found.
If not, what is a better way? I was trying to model youtube's URL design (at least what it appears to me), in the home page, they display many videos, and then on click, they route to /watch + specific id, and then display the video.

Same View, different displays, One page, same exposed filters. Possible?

I want to list my content categorically within view. The problem is that I want all of it to be filtered through exposed filters.
Here is what Content Type looks like:-
Content Type (MyContent)
Title
Body
Category (it has three categories in it "Category1, Category2 and Category 3". User has to selects one when entering the content)
Now I created a view which lists all of the content linearly (like a normal list) and I have exposed filters on top, which filter the content, but now I am not sure how to proceed when I have to show the content as:-
Any Idea what I should do to achieve this? What should I do in this scenario?
I'll be grateful to you valuable assistance.
Best.
You can group your results together. Under the Format option in views next to your format type (unformatted list, etc...) click on Settings.
In this menu you'll see "Grouping field" this will allow you to specify on which fields your results should be grouped. The field needs to already be included in your display.
Once you enable this you'll probably notice that that field is now displayed twice. You can just go into that field and check "Exclude from Display"

Drupal 7 - Entity Reference - Display only items related to node that is related to another node

I have 3 Content Types: Restaurant, Menu, and Menu Item.
I've set up my Restaurant content type so that when a 'Restaurant' is created I have the ability to create a Menu with Menu Items, using the Entity Reference and Inline Entity Form modules. This is all working well.
The part I can't get to work is to display the Menu items correctly in the 'Restaurant' page.
I created a Menu View block, where I added Menu Item fields, and filter it by Content Type 'Menu Items'.
When I place this block in my restaurant page, I see all menu items being displayed...
How can I display only the Menu Items that are related to the Menu content type that related to the Restaurant being viewed?
Edit:
In my 'Restaurant' content type I created a field_menu which is an Entity Reference to the Menu content type, and I use the Inline Entity Form module to allow the creation of 'Menu' entities within the 'Restaurant' creation page.
Similarly, in my 'Menu' content type I have a field_menu_item which is and Entity Reference to the Menu Item content type.
In that case you should add the relationship between menu items and restaurants in order to access the field menu in the menu items view. You can do this in the Advanced area relationships and add the entity references that you need. In your case you should add the menu referencing field and the restaurant referencing field. They should appear similar to
Entity Reference: Referencing entity
A bridge to the Content entity that is referencing Content via menu_item_field
All the above should result in the appearance of the menu field in the filters of the view. When the menu field will be accessible in the filter of the block view you should add a contextual filter for that field.
Then in your contextual filter in the "When the filter value is NOT in the URL" area select "Provide default value" and Type "PHP code" (You should have enable php filter for this). In your php code area you should have the following code
$node=menu_get_object();
return $node->field_your_machine_field_name['und'][0]['target_id']; // this is the field you will use for filttering.It should be the menu field in the restaurant content type
Hope i didn't confuse you. It's not a simple task though.

JDeveloper and ADF view criteria

I am new to ADF and JDeveloper. I am trying to create a view criteria and query panel with table using JDEveloper 11g. Right now I am able to create the view criteria, but all my search fields are showing as plain text input boxes. I actually want one of them to be shown as drop down list and one to be shown as the "select many shuttle" component.
Can anyone tell me how it can be done using JDeveloper/ADF.
Did you define an LOV for the fields in the VO?
See if this video helps: Dependent LOVs in an af:query component
1)Create a LOV for that attribute
2)Ensure that in the control hints of the attribute , the control type is "choice list".
if you want a component as LOV then you have to create LOV on that attribute on ViewObject.
but you can not show shuttle in af:query component.
http://www.javadrive.co.in/shuttle_component_in_ADF.html
http://oracleadf-java.blogspot.in/2012/11/shuttle-component-in-oracle-adf-allow.html

Styling views in Drupal 7

I developed a content type of "sale car". Now I'm developing its view to display a brief list of Car Ads with some basic fields (car, model, color, price, link to full ad) inline of each other like this:
BMW, 120 d $X,xxx,xxx.xx
Royal Blue, Automatic, View Ad
I'm wondering how can I achieve this style? What style format I should use: Table, Grid or something else? Or do I need to get it done through coding?
You want to create a view that is a list of fields.
Once you've got this, add the relevant fields into the view and you should be done.
Choose the relevant format from the format link, check the preview and you should have your view.
To create the view structure:
Node 1 Node 2
Field 1 Field 2 Field 1 Field 2
Field 3 Field 4 Field 3 Field 4
Add all four fields to the view. On each one select "exclude from view". At the bottom of the field list, add a new "custom text" field.
Do exclude this one from the view though, that's important.
Go into the custom field and in the textarea you can enter HTML code and use the replacement patterns to output the field.
For example:
<h2>[title]</h2>
<ul>
<li>[field_one_name]</li>
<li>[field_two_name]</li>
</ul>
<ul>
<li>[field_three_name]</li>
<li>[field_four_name]</li>
</ul>
Get the name's from the Replacement Patterns box under the textarea.
Then select whatever format you think is right. I think you're after a grid.
Drupal provides a way to style the view.
Go to your view.
Click on 'Advanced' link at right side.
Click on link after the label 'Theme'.
You will get the list of templates used to style the view.
Create your own template with one of the given name in the list for
specific fields. e.g. views-view--VIEWNAME.tpl.php
You will get the view of your own style.
This is how the Drupal views styling works. :)
Styling views in Drupal 7:
Add field(which to display) and check the option "Exclude from display".
Now go to "Rewrite Results" and check the option "Rewrite the output of this field"
and below there is a section called "Replacement patterns" where all the added
fields appear as a variable(saying variable just for easy understanding)
Like :
[title] == Content:
Title[field_event_date] == Content:
Event Date[body] == Content:
Body[body-value] == Raw value
Above there is a text ares called "Text" where you can customise your style
for this field(Not good practice follow step 4 for better)and clicl "Apply All".
Now add one more field(this is an extra field) called "Global: Custom text"
DO NOT check "Exclude from display" and below text area called "TEXT"is
the area where we will be writing our HTML codes for styling the views
using all the fields which are avalable as token here under the option
"Replacement patterns".
Click on the "Apply All", And YES its done.So simple and cool na??

Resources