Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Join Date
    Feb 2006
    Posts
    3
    Member #
    12628
    Hi,

    This is my first post here so apologies if I break any protocols. I'm a thick skinned chap so throw as much criticism as you want at me.

    I am currently working on a website for someone which includes a lengthy biography. I want to be able to do a couple of things with the text in the biography:

    (1) Use some sort of scripting language to link certain words to Wikipedia articles. E.g., the link around the word "London" would say <a href="wikipedia.php?London"> where wikipedia.php is a script that opens the wikipedia article, in this case "London". I don't even know where to start writing such a script. Anyone got any pointers? I realise I could just put the links in in HTML, but this would be pretty time consuming.

    (2) Other links in the biography would link internally to other pages on the website I am working on. I want to be able to have two link styles so one can tell easily which links are internal and which aren't. Wikipedia does this by putting a little box with an arrow coming off it to external links; I would be happy with this sort of setup but would be equally happy if I could have all internal links in blue, say, and all external Wikipedia links in green or something. Is there a way to do anything like this in CSS?

    Thanks very much in advance for any help you are able to offer - and apologies in advance if I have posted in the wrong thread, etc.

    Jim

  2.  

  3. #2
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    1) I'm not sure I understand why you say "I realise I could just put the links in in HTML, but this would be pretty time consuming." How else will you put the links?!

    2) Your answer to #2 you is found in the Tutorial section of the site - http://www.webdesignforums.net/showthread.php?t=10291
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  4. #3
    Junior Member
    Join Date
    Feb 2006
    Posts
    3
    Member #
    12628
    1) I'm not sure I understand why you say "I realise I could just put the links in in HTML, but this would be pretty time consuming." How else will you put the links?!
    You are quite right, I didn't make myself massively clear.

    As I said, I am working with a long biography. I would like certain words in the biography to link to Wikipedia articles. I realise that I could just add links "by hand", i.e. typing in the entire URL for the Wikipedia article I wanted to link to.

    What I would prefer, however, is some sort of script that linked to a specified Wikipedia article when it was run. For example, a script called wp.php; when I put in a link around the text "London" I could just type wp.php?London; when someone clicked on this link it would run wp.php with parameter "London" it would open up a new window with the Wikipedia article "London" in it.

    I hope that is a bit clearer: thank you for your help with answering the other question.

  5. #4
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    It is clear, I just don't see the point!? If you're already going in the document and adding a link, why not add the real thing?
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  6. #5
    Junior Member
    Join Date
    Feb 2006
    Location
    San Francisco, California
    Posts
    8
    Member #
    12551
    Quote Originally Posted by jim0203
    You are quite right, I didn't make myself massively clear.

    As I said, I am working with a long biography. I would like certain words in the biography to link to Wikipedia articles. I realise that I could just add links "by hand", i.e. typing in the entire URL for the Wikipedia article I wanted to link to.

    What I would prefer, however, is some sort of script that linked to a specified Wikipedia article when it was run. For example, a script called wp.php; when I put in a link around the text "London" I could just type wp.php?London; when someone clicked on this link it would run wp.php with parameter "London" it would open up a new window with the Wikipedia article "London" in it.

    I hope that is a bit clearer: thank you for your help with answering the other question.
    It seems like a good "find&replace" function would be infinitely easier.

    In other words, for each link, put something like: href="wikipedia/London" (or whatever that link is about). Then, with an editor that has a find&replace function, search for "wikipedia/" and replace it with "http://en.wikipedia.org/wiki/" (which is the URL constant for the English edition of Wikipedia).

    The result will be: href="http://en.wikipedia.org/wiki/London"

    Which is the correct link. It's only slightly more work than you're already doing by putting in "wp.php?London" (that slightly more work being using the find&replace) and it doesn't involve the time of writing a script, which seems to be nothing more than reproducing this functionality.

  7. #6
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    Hi Jim, it sounds like you want to make something a lot more complicated than it is. Minstrel has a good suggestion, or you can copy the first part of the url. As you code every time you need to reference it, paste, then complete the specifics.
    Shani

    I have an eye for detail like you'd never believe.

  8. #7
    Junior Member
    Join Date
    Feb 2006
    Location
    michigan
    Posts
    11
    Member #
    12675
    I would be happy with this sort of setup but would be equally happy if I could have all internal links in blue, say, and all external Wikipedia links in green or something. Is there a way to do anything like this in CSS?
    Here, i'll code it for you right now.

    CSS:
    Code:
    .external a {
    color: #0f0;
    }
    .internal a {
    color: #00b;
    }
    HTML:
    Code:
    <div class="external"><a href="http://external.html">external</a>
    <div class="internal"><a href="http://internal.html">internal</a>
    Sometimes i get my "class" and "id" definition thingies mixed up. But this should work. Aside from rollovers and visited links.0

  9. #8
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    Quote Originally Posted by joshklinger
    Here, i'll code it for you right now.

    CSS:
    Code:
    .external a {
    color: #0f0;
    }
    .internal a {
    color: #00b;
    }
    There is a slight error in the code. The class should be attached to the <a> tag as follows:

    HTML:
    Code:
    <a class="external" href="http://external.html">external</a>
    <a class="internal" href="http://internal.html">internal</a>
    There are two ways, as far as I know, to define the links with different hovers, visited, etc. One is described in the tutorial karinne mentioned earlier. Another is to use identifiers (but that doesn't work in IE). In either way you have to define the each mode that should be unique: link, hover, active, visited.
    Shani

    I have an eye for detail like you'd never believe.

  10. #9
    Junior Member
    Join Date
    Feb 2006
    Location
    michigan
    Posts
    11
    Member #
    12675
    My code also does work. Using your code i believe you would have to reformat it like so:

    Code:
    a .internal {
    But it's possible that i may have gotten it wrong. I mean, i use CSS all the time so i doubt it, but i winged that one, so i'll leave it open for error.

  11. #10
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    Josh was right on this one but why create an unecessary div when you can simply apply the class to the link itself?


    Quote Originally Posted by joshklinger
    My code also does work. Using your code i believe you would have to reformat it like so:

    Code:
    a .internal {
    But it's possible that i may have gotten it wrong. I mean, i use CSS all the time so i doubt it, but i winged that one, so i'll leave it open for error.
    That code is wrong actually. It's more like

    Code:
    a.internal { ... }
    hth
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:05 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com