- Posts: 38
COMMUNITY FORUM
Philosophical question - item retrieval/display?
- Brian
-
Topic Author
- Offline
- Junior Member
Less
More
10 years 5 months ago #134890
by Brian
Philosophical question - item retrieval/display? was created by Brian
I am well underway with my site's design, but I am starting to wonder if I am going about things ideally. My site is generally centered on working groups within an int'l organization, and the groups have various content. Papers, books. And there is also news associated with the groups. When someone clicks on a working group subcat, I want the page to be dynamically loaded. So functionally, you would have this
[retrieve papers that are associated with current working group]
[display items in a tab]
[retrieve news associated with current working group]
[display news in tab]
etc
Using modules is proving to be unmanageable, because there are 9 groups and I can't create 20 plus modules and worry about editing each one when I want to make a change to the display.
So what would you do if you were me? Do I need to be manually making calls to the Joomla API?
One idea I had today was to create a module for a particular type of item, papers, for instance. Then in categories.php maybe I could alter that module's params on the fly so that it gets papers for the current working group. But that will not be so straightforward because I am not sure about all the system calls I would have to make. Stepping through the module rendering process in a debugger today made my head spin with the complexity. Really, I am just trying to fetch items and display them with the same styling as the module... There has to be a simple elegant way to do this.
Thanks!
Brian
[retrieve papers that are associated with current working group]
[display items in a tab]
[retrieve news associated with current working group]
[display news in tab]
etc
Using modules is proving to be unmanageable, because there are 9 groups and I can't create 20 plus modules and worry about editing each one when I want to make a change to the display.
So what would you do if you were me? Do I need to be manually making calls to the Joomla API?
One idea I had today was to create a module for a particular type of item, papers, for instance. Then in categories.php maybe I could alter that module's params on the fly so that it gets papers for the current working group. But that will not be so straightforward because I am not sure about all the system calls I would have to make. Stepping through the module rendering process in a debugger today made my head spin with the complexity. Really, I am just trying to fetch items and display them with the same styling as the module... There has to be a simple elegant way to do this.
Thanks!
Brian
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 5 months ago #134892
by Krikor Boghossian
Replied by Krikor Boghossian on topic Philosophical question - item retrieval/display?
This is a tricky question Brian indeed.
You can do the following but it requires some work.
Map working group subcats to menu items. All of them.
If you want it to load dynamically you can get the results of the menu item (only the main content, an html element with an id preferably) and load it via AJAX in your container.
It is the same concept as infinite scrolling. You get the link's content and you render it in a predefined area in your template. This way you won't have to publish any modules at all.
Users with no js (if there are any) and bots see the regular menu.
PS. I would like to see the finished site.
You can do the following but it requires some work.
Map working group subcats to menu items. All of them.
If you want it to load dynamically you can get the results of the menu item (only the main content, an html element with an id preferably) and load it via AJAX in your container.
It is the same concept as infinite scrolling. You get the link's content and you render it in a predefined area in your template. This way you won't have to publish any modules at all.
Users with no js (if there are any) and bots see the regular menu.
PS. I would like to see the finished site.
Please Log in or Create an account to join the conversation.
- Brian
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
10 years 5 months ago #134900
by Brian
Replied by Brian on topic Philosophical question - item retrieval/display?
Hi,
I don't think I am familiar yet with joomla, Ajax, K2 to do what you suggested. The menus and cats/subcats are already mapped. Each subcat is a menu item of type K2 Content. So when you click a subcat you come to a regular K2 categories page, and it is there where I am trying to add the tabs for the different types of items associated with the subcats.
What I was thinking was that I could just use the xperttabs module display code in categories.php and just use queries to get the items based on the current subcat. But I am sure that is harder than I think!
Given the above description, do you think your approach would still work? If so, could you show me an example?
Thanks!!
I don't think I am familiar yet with joomla, Ajax, K2 to do what you suggested. The menus and cats/subcats are already mapped. Each subcat is a menu item of type K2 Content. So when you click a subcat you come to a regular K2 categories page, and it is there where I am trying to add the tabs for the different types of items associated with the subcats.
What I was thinking was that I could just use the xperttabs module display code in categories.php and just use queries to get the items based on the current subcat. But I am sure that is harder than I think!
Given the above description, do you think your approach would still work? If so, could you show me an example?
Thanks!!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 5 months ago - 10 years 5 months ago #134920
by Krikor Boghossian
Replied by Krikor Boghossian on topic Philosophical question - item retrieval/display?
This is more a JavaScript solution. It is plarform independant.
Both these implementations work.
On the first you have to load the modules while on the other one there is nothing there, you load your content via AJAX.
You simply read the content of the link (menu item) and retrieve the content with a JS script.
A vaguely similar concept is Paul Irish's Infinite Scrolling.
PS. Since I do not know the project the same as you do I think you should try both implementation to see which fits you and your project's needs.
Both these implementations work.
On the first you have to load the modules while on the other one there is nothing there, you load your content via AJAX.
You simply read the content of the link (menu item) and retrieve the content with a JS script.
A vaguely similar concept is Paul Irish's Infinite Scrolling.
PS. Since I do not know the project the same as you do I think you should try both implementation to see which fits you and your project's needs.
Last edit: 10 years 5 months ago by Krikor Boghossian.
Please Log in or Create an account to join the conversation.
- Brian
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
10 years 5 months ago #134946
by Brian
Replied by Brian on topic Philosophical question - item retrieval/display?
Hi, I saw your reply about Ajax in my other post. Interesting. I have no java experience, but I have a lot of PHP experience and it would be interesting to try this approach, see some examples. Once I saw examples, it would click. But since that will take some time, for now I will stick with the modules. Thanks!
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
Less
More
- Posts: 6227
10 years 5 months ago #134963
by JoomlaWorks
Replied by JoomlaWorks on topic Philosophical question - item retrieval/display?
I believe there are modules that can retrieve same category items in the K2 Extensions Directory or in the Joomla Extensions Directory, under K2's Extensions Category. Have you checked?
Please Log in or Create an account to join the conversation.
- Brian
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
10 years 5 months ago #134965
by Brian
Replied by Brian on topic Philosophical question - item retrieval/display?
Hi,
Yeah, but the thing is I am trying to control the display of the items, using tabs and I can't find an extension that would work the way I envision.
Thanks,
Brian
Yeah, but the thing is I am trying to control the display of the items, using tabs and I can't find an extension that would work the way I envision.
Thanks,
Brian
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 5 months ago #134992
by Krikor Boghossian
Replied by Krikor Boghossian on topic Philosophical question - item retrieval/display?
You can manually use tabs in your template overrides.
If your template is Bootstrapped you can use Bootstrap's tabs.
If your template is Bootstrapped you can use Bootstrap's tabs.
Please Log in or Create an account to join the conversation.
- Brian
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
10 years 5 months ago #135051
by Brian
Replied by Brian on topic Philosophical question - item retrieval/display?
Interesting. yes, the template is bootstrapped. Is there a tutorial somewhere that explains how to use the bootstrap functionality? I would be interested to try what you suggest, just need some more info to understand the functionality. Thanks!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 5 months ago #135070
by Krikor Boghossian
Replied by Krikor Boghossian on topic Philosophical question - item retrieval/display?
The template dev can provide some insights in the template's overrides and functionality.
As for Bootstrap you can find more info here: getbootstrap.com/
As for Bootstrap you can find more info here: getbootstrap.com/
Please Log in or Create an account to join the conversation.
- Brian
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
10 years 5 months ago #135183
by Brian
Replied by Brian on topic Philosophical question - item retrieval/display?
I have been reading about bootstrap. Seems very promising. So now the question is, how to retrieve K2 items and render in the tabs? I am trying to avoid adding menus. I am hoping to just do function calls. But I don't understand the K2 API well enough to visualize how to do that. For instance, here is what I am trying to do:
1. Loop through categories
2. Loop through item types, loading params for the item type. I was thinking I could create a module for each item type just for the purposes of setting params and then read params from module.
3. If items are retrieved, create a tab, render items based on settings in the item type module (again, I don't want to actually create modules for all the item types across all the group categories (though that is what I did to get things working for now), just plan to have item type module templates so to speak)
It is the particulars that are confusing me. I just don't know what sort of function calls 3 above would entail...
Thanks!
1. Loop through categories
2. Loop through item types, loading params for the item type. I was thinking I could create a module for each item type just for the purposes of setting params and then read params from module.
3. If items are retrieved, create a tab, render items based on settings in the item type module (again, I don't want to actually create modules for all the item types across all the group categories (though that is what I did to get things working for now), just plan to have item type module templates so to speak)
It is the particulars that are confusing me. I just don't know what sort of function calls 3 above would entail...
Thanks!
Please Log in or Create an account to join the conversation.