Get pages by tag
Hello,
I'm currently migrating a site from 3.2 to 5 and am having to update a few pages/controls where the API has changed. Overall it's going pretty well, but one of the functions on the site is a "tag results page", which is a paged list of all pages containing content which contains the tag the user selected (i.e, if you pick "outdoors" from the tag list you will be taken to a page that is a list of all pages containing content that was tagged "outdoors").
Is there a good way using the SF 5 API to get all pages containing content that has a specific tag? Currently in the 3.2 site, it looks like this:
CmsManager cmsManager = new CmsManager();
List<
string
> controls = new List<
string
>();
foreach (TaggedContent content in tag.TaggedContent)
controls.Add("'" + content.ContentID.ToString() + "'");
SELECT
DISTINCT
sf_CmsCtrlLinks.PageID
FROM
sf_CmsControlProperty
INNER
JOIN
sf_CmsCtrlLinks
ON
sf_CmsControlProperty.ControlID = sf_CmsCtrlLinks.ControlID
WHERE
(sf_CmsControlProperty.
Name
=
'Content'
)
AND
(sf_CmsControlProperty.Value
IN
<LIST_OF_GUIDS_FROM_ABOVE_CODE_BLOCK>)
Unfortunately it seems that in SF 4.x/5.x this kind of thing is no longer possible.