Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Article Poll

Poll I found this article to be
Very Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:0

Creating Links in Submissions w/o Using HTML

posted by Cliff on 06:34 PM June 26th, 2000   Printer-friendly   Email story
Christina asks: "I am helping an Internet law center create their website and we are looking at your code to use. My question relates to the story submission area of your program. We would be looking for submissions from lawyers, etc, who wouldn't necessarily be completely internet/compuoter literate. How can we explain to them how to insert links (urls) into their submissions the right way so that the name of the title comes up as the link as opposed to just link? How can we make that clear to them in the section?"

This occurs when you use naked URLs in your submission, like "". Slash will then translate it to <a href="http//>li nk</a> when the submission is saved (you can preview it to your hearts content and it won't change then). So what's a good way to specify URLs and titles in an easy to remember form so people aren't forced to know the HTML? I was thinking of something like:

  • |<Sitename>|<SiteURL>|
Which, if seen by Slash in the submissions editor will replace that instance with the proper HTML to form the link. The separator char is the good ole unix 'pipe' symbol for those of you who might have problems seeing that. It was chosen because it would be easily parsable and not conflict with any chars that might pop up in SiteURL. Thoughts?
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login
Loading... please wait.
    • Hell no will we have LWP go to user-submitted, arbitrary links. That just isn't going to happen. If an author wants to go to that link, he can feel free. But we won't have the server opening up arbitrary socket connections. That could be Bad.
    • I'd thought of putting putting the URL in between the open and close A tags, and it is probably a good thing to do.
    • I think a lawyer could learn how to make a proper A tag with HREF attribute just as easily as he could learn how to deal with piped text.

  • Bless it. Bless it. Bless it. My tag didn't come out right. <nolink> was my suggestion for a tag.
  • Maybe you could try making your own script/form that accepts all the info. Asking for a specific url, title, story then have the script create a link around the title with the url submited. Then put it into the database.
  • Heh, no. I just wanted to be emphatic about not having our servers detect URLs and then actually go hit those URLs. :)
  • That's all well and good when you want to link on keywords, but the submittor specifically asked for -titles-. My guess is that one thing they may use this for is to cite articles on the web in which certain legal issues have been raised or decided. Regardless, unless the link is going to be used over and over again (which isn't implied by the question) something like this doesn't solve the actual problem.
  • I would go the other route. Having Slash automgaically convert links to HREFs is a good idea when it's necessary (saves alot of time copying Anchors), but just stick a tag in when you don't need them. Define a tag like in to tell slash not to convert the following address into a link.e
  • In, there is a sub called getRelated that matches submission text and creates links in the 'Related Links' slashbox that sits right to the story when reading it. You can add to it.

    In 1.0.5, there is the nice feature of defining in slashdotrc new URL redirections used by fixHref (not everyone has a /malda/ at home, I guess...)

    IMHO, the same thing would be nice for getRelated. Or, better, some sort of admin page related to sections that would allow to add words (and patterns ?) that would get automagically URLifed.
    Of course, in case you can make regexp, like translate every: www.blah.blah into <A HREF="www.blah.blah">www.blah.blah website</A>, then it is important to have the <nolink> tag, or whatever will be its name. I propose: ¿malda?

  • Jon Udell [] had a suggestion about this type of problem in Practical Internet Groupware []. It is probably in chapter seven, which is not one of the chapters O'Reilly has online []. If no one finds it, I will look it up when I get home on Wednesday.

    Instead of turning "" into <A HREF="http//">l ink</A>, why not at least do <A HREF="http//">h ttp// ge/here.shtml</A>? That would be much more informative than plain old "link".

    You might even use LWP to check the validity of the link. If the link is good, add the <TITLE></TITLE> or <H1></H> as the value for TITLE. If it isn't, make "Broken Link!" the value of TITLE.

    For example:

    <A HREF="..." TITLE="Broken Link">...</A>
    <A HREF="..." TITLE="Slashcode | Creating Links in Submissions w/o Using HTML">...</A&gt

    As far as creating a meta-language for people to create HTML links, I am not sure how well that will work. If they can't learn simple HTML, are they really going to master "|<Sitename>|<SiteURL>|"? Also, don't be surprised if some bonehead screws it all up by typing this:

    |<Slashcode | Creating Links in Submissions w/o Using HTML>|< 6/2351258>|
    While a pipe is unlikely in a URL, it is likely in a SiteName.