expressionengine

ExpressionEngine content based on url segment


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?


Solution

  • I believe what you're looking for is searching the channel entries tag by field name.

    Here's an example:

    {exp:channel:entries channel="videos" search:client_name="google"}
        {title}
    {/exp:channel:entries}
    

    Do keep in mind though if you want to use the segment for this you'll likely have to pass the segment through an embed as a variable. You can read about this here.