Get pages by tag

Posted by Community Admin on 03-Aug-2018 01:19

Get pages by tag

All Replies

Posted by Community Admin on 10-May-2012 00:00

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() + "'");

Then, the list of guids is fed into the following stored procedure:

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>)

I've looked through the Taxonomy API and have searched the forums extensively, but haven't found anything yet. Any help would be awesome!

Thanks,

matt

Posted by Community Admin on 15-May-2012 00:00

Unfortunately it seems that in SF 4.x/5.x this kind of thing is no longer possible.

This thread is closed