Is there any way to do this in ExpressionEngine (3.5.10)....
I have a channel of services offered by a company. The channel name is called services
. I then have a list of news articles in a channel called news
.
There will be around 50 services
and hundreds (or potentially thousands) of news
articles.
What I want to do is when a user is looking at a particular service, I want to show news articles that are relevant.
However, any workflow for the publisher (the person using the EE Admin panel) is tedious, or it seems impossible to write a query in the template to do the job.
For example, it could technically be done like this:
Set up a Relationship on
news
such that I can say whichservices
it applies to. I don't understand how I could then query this to get the actual news content when viewing a service on the front-end because the relationship exists on thenews
channel entry, not theservices
channel entry. ** see notes below for what the intended outcome is here and you'll understand what the issue with this is.Set up a Relationship on
services
and select the appropriatenews
. This is impractical because of the amount of work it would involve to maintain. For example every single time anews
entry is published the publisher would have to go into potentially 50services
rather than being able to do it from 1 place.Use categories... not really sure where to begin with that as I could set up categories on my
news
articles (where the categories are the names of the services) but then unsure how to query this in the template. For example, I don't understand in terms of writing a query, how you could correlate a category name (or category slug) to specific channel entries.
** The relevant template is the one which shows details of an individual service. These are set up with a URL structure like so:
/services/service-one
/services/service-two
/services/another-service
- ...
So when the user goes to /services/service-two
it should list any news
entries that are relevant to service-two
.
What is the most efficient way of doing this in terms of:
- Workflow for the publisher, i.e. the least number of clicks and data entry.
- Something that scales well given there may be 50 services and >1000 news articles, with further news articles being added daily.
- How does the proposed solution work in the template - i.e. when I'm looking at
services/service-two
what code do I need to bring out the list ofnews
entries such that I can read at least their title and URL?
My apologies if the answer to this is obvious but I've thought about it so long now I'm asking for help as I can't see a way around it.