Creating an Extension for ONE particular aspx Page

Sep 11, 2011 at 2:22 PM
Edited Sep 11, 2011 at 2:53 PM

Hi All!

Background: My Blog has a hard-code aspx page to display a list of Sailing Terms with their definitions and illustrations. Thanks to rtur, I have written an Extension for automatically creating a link to these sailing Terms whenever a Sailing Term exists on all the Posts. Perfect!

Now what I'd like to do is to create an extension to automatically add a link to each Sailing Term that has a match to a Tag which comes from the built-in Tag Cloud list.

This hard-coded page is derived from the BlogBasePage class. And each Sailing Term is followed by a colon so I can use the colon for detecting a Sailing Term. And thanks to rtur for showing me how replace the strings with links. So I'm halfway there.

The first problem is to get this hard-coded page to catch the event when this hard-code page is served. Only this hard-coded Post. And the second is to be able to detect the name of the Post so the other extension doesn't act on this page.

Thanks!

Sep 13, 2011 at 12:37 AM

Hi All!

I was able to implement this functionality by creating a Blog Page on which put the Sailing terms.

Then I modified the page.apsx.cs to add this:

        #region gerardo
        if (pg.Id == new Guid("ea3fe48717f64678b899412814e89a77")) //ea3fe48717f64678b899412814e89a77 is the id of the Sailing Terms Page.
        {
            //const string s = "<a href=\"{0}\">{1}</a>";
            const string s = "<a href=\"http://www.sailingcanyonlake.com/?tag=/{0}\">{0}: </a>";
            var tags = new List<JsonTag>();
            foreach (var p in Post.Posts)
            {
                foreach (var t in p.Tags)
                {
                    string replacement = string.Format(s, t);
                    this.divText.InnerHtml = this.divText.InnerHtml.Replace(t + ": ", replacement);

                }
            }
        }
        #endregion

 

Thanks!