p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   content management system (http://p2p.wrox.com/showthread.php?t=49704)

Adam H-W November 1st, 2006 06:43 AM

content management system
 
Hi there

I've built this bespoke CMS for a client but want to add a facility whereby if he types a url in his text i.e www.mysite.com, then it will convert to an active link when embedded in the front end web page - i.e

 <a href="http://www.mysite.com" target="_blank">www.mysite.com</a>

Can anyone advise me?

thanks

Adam


woodyz November 1st, 2006 11:51 AM

How is your content stored as far as markup goes? Is your content XML or merely text?
Do you provide an editor to the user so they can indicate metadata about the content - that is, to indicate paragraphs, titles, headers, boldness, colors, etc? Typically, if this is all stored as XML then you could also allow them to indicate links, which your code (hopefully XSLT) will then handle.

Properly done (in my opinion) content should be stored with markup as XML for this very reason. It can then be transformed to whatever output you need - HTML, rtf, etc.

Now... assuming that the content is not stored as xml, you will need to write code that will find the pattern of a link in the content and convert it to an anchor element (the a href=...). Regular expressions are the standard (and in my opinion best) way to do this.

Woody Z http://www.learntoprogramnow.com

dparsons November 1st, 2006 11:58 AM

In either situation you need to write code to look for a pattern; if you go the route of XML then you need to write code to identifiy that a url exists and place it into your XML accordingly. (You also could probably do this in XSLT to look for a url and mark it accordingly)

And, even if you aren't using XML, you are still going to need to match a pattern in your code.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature

woodyz November 1st, 2006 08:15 PM

Quote:

quote:Originally posted by dparsons
 In either situation you need to write code to look for a pattern; if you go the route of XML then you need to write code to identifiy that a url exists and place it into your XML accordingly. (You also could probably do this in XSLT to look for a url and mark it accordingly)

And, even if you aren't using XML, you are still going to need to match a pattern in your code.
If you are using XML there is no need for pattern matching. That is the whole point and purpose of the xml. If you process the XML using code, you will work with the DOM and XPath to navigate to and operatate on the various elements - in the case of URLs you will then have your code wrap the URL in the anchor element (the a href tags). If you are using XSLT, you will simply use a call-template or a match template to process URL elements (that is, items that are marked with an element you use for this purpose).

Again - the reason I like XML for content markup is the same reason that the printing industry has used SGML for decades - formatting is separated from the content - you can format your output easily in any conceivable manner as long as you have a logical system for marking up the content. For example, if your content is stored as xml, you can easily output it as HTML, but you can just as easily output it as instructions to a Braille device, a human voice simulator, a typesetting application, or whatever.

Additionally, you can use XML content to generate menus, a table of contents, synopsis output, outlines, or whatever - all from the same content. As long as you put the content into the XML that you later wish to use, and mark-up the various uses of each discrete item of data - then you are in very good shape to be as creative as you want in devising the output.

Also, it is relatively easy to create XML from content that is stored in database tables and dynamically build XML from those parts of the content that are stored in an "un-marked-up" form.

Woody Z http://www.learntoprogramnow.com

dparsons November 2nd, 2006 08:44 AM

You simply reiterated what I said in more detail.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature

woodyz November 2nd, 2006 02:07 PM

Quote:

quote:Originally posted by dparsons
 You simply reiterated what I said in more detail.
 ? Not at all! This is what you said:
Quote:

quote:Originally posted by dparsons
In either situation you need to write code to look for a pattern
And that is not what needs to be done if using XML. Using the XML DOM or XSLT we are not looking for patterns, we are accessing nodes. These are entirely different mechanisms.

Woody Z http://www.learntoprogramnow.com

Adam H-W November 3rd, 2006 09:25 AM

Well, thanks for that guys - sounds complicated especially as the CMS is built with ASP and not XML or XSLT. At present, it doesn't allow for metadata.


dparsons November 3rd, 2006 09:33 AM

Quote:

quote:Originally posted by Adam H-W
Well, thanks for that guys - sounds complicated especially as the CMS is built with ASP and not XML or XSLT. At present, it doesn't allow for metadata.
When you place the data into your database you can search to see if a valid URL exists somewhere in the string and replace it with an actual A HREF then, when its displayed, it will be an active link.

Of course, depending on your system, you will have to catch http://www.mysite.com, http://mysite.com, www.mysite.com

hth

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature

woodyz November 3rd, 2006 11:31 AM

Quote:

quote:Originally posted by Adam H-W
 Well, thanks for that guys - sounds complicated especially as the CMS is built with ASP and not XML or XSLT. At present, it doesn't allow for metadata.

First of all, you can easily use XML and XSLT in an ASP site. How is it that you can have a CMS without metadata?

Woody Z http://www.learntoprogramnow.com

Adam H-W November 4th, 2006 10:33 AM

In the CMS, it only provides the facility for the user to add/edit/modify text and images without using other functions such as text colour, links, boldness etc. They don't have the ability to 'style' their text.



All times are GMT -4. The time now is 05:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.