Need to use datagroup in content of site

Hi ,

I am using below Irule to check URI and display content. Now i want to use Datagroup for that as there are many URLs. I have below sample code.

if { [HTTP::uri] starts_with "/mypage-abcd.htm" } {
    HTTP::respond 200 content {abcd}
    return 0
}

Now i want to display the content from datagroup to {abcd}.

Datagroup My_Content

abcd bcde cdef

Now It should display all content respectively. Like if page is mypage-bcde.htm then content should be {bcde}

Can somebody help me to write the code. I am very new to this.

You can certainly do it with data groups, but it starts to get hairy when you have a lot of HTML content to display. The better option is probably to use iFiles. Please see the following for some really good examples:

Just one more question. Can i use datagroup in URI in IF condition?

Datagroups are accessed with class commands, so is this what you’re looking for?

when HTTP_REQUEST {
    if { [class match [string tolower [HTTP::uri]] equals uri_dg] } {
         do something
    }
}