Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] link one view to another

[SOLVED] link one view to another 11 Oct 2011 19:05 #197

hi, in my component i have created a categories table. In this table i have several category.
in another table events i have some events linked to single category.


in the front end i have a events list and a categories list.
is possible to make a link on the category title to the events list view?

english is not my language, I hope that I explained
Last Edit: 14 Oct 2011 18:15 by admin.
The administrator has disabled public write access.

Re: link one view to another 12 Oct 2011 04:25 #203

  • griiettner
  • griiettner's Avatar
  • Offline
  • Senior Member
  • Posts: 73
  • Thank you received: 12
  • Karma: 8
Hello,

If I understood right... you are looking for to connect your item to a category...

If this is the question.. it is pretty simple...

1 - On your 'Item' table, you have to create a foreign key field, than drag the 'Category' table inside to the foreign key element you created, by this way, you connected both tables

2 - Once the tables are connected, you have to go to 'Table' section of cook, select the Item table and than go to 'Pages' section and create a front end 'Item'.

3 - After you create your Item page, you will have to drag all the fields to Form Brick.. by this way you are actually creating the fields to be filed on the frontend

- 4 You will notice that the foreign key element you created before, has a plus (+) sign... click on the sign, and the options will open as a tree menu. Just grab the option you want and drag it to the form brick...

Let's say you got the 'Category Title' field from the option available... what this will do... this will create a select box with all categories, but on the frontend you will see the Category Title, but what will actually be saved on the database is the ID of the category.

Follow all this steps and you will be fine...
Paulo Griiettner
Last Edit: 12 Oct 2011 04:27 by griiettner.
The administrator has disabled public write access.

Re: link one view to another 12 Oct 2011 06:53 #210

everything you've described I did and it works
But my problem is this:

When I view the categories, I should do so by clicking on the category name that makes me see the list of items associated with that particular category, but are located in items table.

when I try to put a link to the category name the only option I'm given is the link to edit the category.
The administrator has disabled public write access.

Re: link one view to another 12 Oct 2011 06:56 #211

table structure are

events
-- FK catid (category ID on the categories table)
...

categories
--id
...


category view

ID | category name |....

where category name will be linked to a 'category' view that contains all events from table events with catid equal to category id in categories.
The administrator has disabled public write access.

Re: link one view to another 12 Oct 2011 06:58 #212

  • griiettner
  • griiettner's Avatar
  • Offline
  • Senior Member
  • Posts: 73
  • Thank you received: 12
  • Karma: 8
Ok...

In order to do what you want now, you have to create a filter... So... On the Pages section you have to add a filter brick, than add a filter field...

Once the filter field is added, you go to the fields slide menu and click on plus sign to open the tree, grab the 'Category Title' field and drop inside the filter field you created previously.. that's it.. now you have the Filter by category
Paulo Griiettner
The administrator has disabled public write access.

Re: link one view to another 12 Oct 2011 07:17 #213

ok this help me for filtering
but missed a little brick

see the screenshot

backend: when i want to create a link on category name to category view (list of all events) i see only the option 'Add category' (i need something like 'events' view that exist but from here is not reachable)



frontend:
Categories view (list of all categories) each category should be linked to its list of events (next image)




from categories view when i click on category name, i want to go to this page
The administrator has disabled public write access.

Re: link one view to another 14 Oct 2011 16:31 #240

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
griiettner is right, you have to use the filters.

for now, this automatic functionality is not available. Lots of users are asking for this, but it is not possible.


How to do :

Once you created a 'category' filter on your 'events' table, you can filter directly in the url :
for exemple :
...view=events&layout=default&filter_category=32


So, in your categories list, just create a link on the item to a filtered url of the events table.

That's all. (Maximum 2 lines in your component)
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: twev

Re: link one view to another 15 Oct 2011 09:46 #251

ok tnx
i try your solution.
The administrator has disabled public write access.

Re: link one view to another 04 Jan 2012 21:26 #819

Is there any news about this feature?
The administrator has disabled public write access.

Re: link one view to another 16 Aug 2012 02:32 #3172

  • wildfire
  • wildfire's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 1
We are also looking for the ability to create a category pages on our site.

Basically we want to make a blog type component that lets us create menu items that link to a category page where the only items shown on the page are items assigned to a given category.

Is this something that can be done now without creating filters and manipulating our urls manually to add the filter in the url?
If it can't be done now with cook, will this feature be in the upcoming release?

It would be nice if there was some way cook to create a page layout that lets us put a Menu parameter that shows a drop down list from a combo box filter we created in cook with a foreign key like a "Categories" table.

When we create a new Menu Item in Joomla, then we would be able to select the category we want for the page and only items from that category would show on that page.
The administrator has disabled public write access.

Re: link one view to another 16 Sep 2012 16:30 #3686

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
+1 for that feature... would be very useful
The administrator has disabled public write access.

Re: link one view to another 09 Nov 2012 13:54 #5163

I have a list of rental properties with 3 main categories. The categories are in a table with a FK link to listings table.

I need to be able to have four pages. One for each category and a "All listings" page. Fine with the all listings page. It's how do i display only Cat1, Cat2, Cat3 items on separate pages? I don't want the user to have to select the category from the filter drop down. The user will have the ability to click a link for Cat1 and they should see all of Cat1 listings.

It sounds like creating a custom URL is the way to go. I was trying to play with the URL that Admin was speaking of, but no luck.

../my-component-name/layout-alias-name/default&layout=default&rental=CynthiaPlace

What am I missing.
The administrator has disabled public write access.
Time to create page: 0.144 seconds

Get Started