3

I'm just learning EE and I have the following example url, http://mydomain.com/work/preview/clientname

where I want clientname to match a channel field I have setup ("client_name") and to pull in channel content only if it matches that channel field.

For example, http://mydomain.com/work/preview/google, would display channel content if the specified channel field "client_name" for a particular entry is "google".

I know how to use the following to pull in content from the channel "videos":

{exp:channel:entries channel="videos"}
    {title}
{/exp:channel:entries}

...but how do I accomplish this for different url segments?

3

This code will do the trick:

{exp:channel:entries channel="videos" search:client_name="{segment_3}" limit="1" require_entry="yes"}
    {if no_results} {redirect="404"} {/if}
{/exp:channel:entries}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.