PDA

View Full Version : link html


fridayteam
3rd August 2005, 06:59
I am currently working on link exchanges with my site.

Someone somewhere [and I now can't find it] put a suggested way of offering html code to your link exchanges.

If anyone knows what I am talking about, if you could post the html here that would be fantastic!

Rob Holmes
3rd August 2005, 07:20
Hi,

Maybe somewhere in here?

http://www.ukbusinessforums.co.uk/viewtopic.php?t=3865

Rob

kyber
3rd August 2005, 07:24
Hi,

I am not sure what you are asking.

Is it, "how do I offer the html code that people should use to link to my site?"

You have already done that at the bottom of your post.

Perhaps you mean broader links management?

Personally. I installed a links management php program onto my site (http://www.lamdesign.co.uk/links/) to manage all of this for me. I used wsnlinks (http://www.wsnlinks.com/). This is a licensed product, around $60 for a perpetual license, and requires MYSQL and PHP hosting.

Stuart

fridayteam
3rd August 2005, 10:00
how do I offer the html code that people should use to link to my site?

yes, that is what I am asking..

for example

When someone puts my link on their website, they should use [something like] the following code..

The Friday Team - Local Emagazines (http://www.fridayteam.com)

Is that correct?

MinuWeb
3rd August 2005, 12:33
thats right, that would make a link with the text "The Friday Team - Local Emagazines" that linked to http://www.fridayteam.com

fridayteam
3rd August 2005, 13:26
Thank you for your help, much appreciated!

kyber
4th August 2005, 12:18
Roz,

Also, if you want to link from your logo:


http://www.fridayteam.com/images/FRI001LOG100.jpg (http://www.fridayteam.com/)


Stuart

fridayteam
4th August 2005, 12:23
cool, nice one, thank you!

Ravenfire
4th August 2005, 15:33
Following on from this, hope you dont mind me joining the thread, is there a php or html script that would work to show something like this:-

http://kidrocket.org/link2us.php

kyber
4th August 2005, 15:50
There's is nothing clever about that. If you look at the source code you will be able to see how to reproduce it for your own requirements. The fact that it happens to be a php file (originally - what you see, and what the source shows you, is the resultant html after php processing).

The key bits are:
Select & Copy (javascript:HighlightAll('mylink.set1')) to call the javascript code that does the copy for you

and

<textarea class="no" name="set1" rows="4" cols="65" >http://www.fridayteam.com/images/FRI001LOG100.jpg (http://www.fridayteam.com/)</textarea> for the area you want to copy.

These two blocks need to be inside a form. The form names needs to match that referenced in the call to the javascript code. I used mylink.

You have as many of these pairs of blocks inside the form as you require. You need to match the name of each pair of blocks (i.e. the bit after mylinks in the javascipt call to the name of the text area) - I used set1 for this first pair.

The javascript is pretty standard. Their site uses:
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",1800)
}
}

Stuart

Ravenfire
4th August 2005, 15:59
Oh yikes sorry dont really understand that

kyber
4th August 2005, 16:40
Oh yikes sorry dont really understand that
Which bit? If none of it, then you need someone to do this for you.

Go back to the website in question and select view source on your web browser then save the text file you are looking at. Load it up in a text editor (NOT a word processor) and look at it to find the bits I pointed out.

Do the same thing with one of your own standard web pages and save it as a new page, eg. mylinks.htm.

Now, you just put the bits you need into your page under other content (above the closing </body> code).

You can ignore most of the stuff in "his" page accept the bits I mentioned which I will now explain.

Select &amp; Copy (javascript:HighlightAll('mylink.set1')) Is used to call the javascript code that does the copy for you.

You should recognise the <a bit as what we use to link to somewhere else as described used earlier to address the original reason for this post. Instead of linking to another website/page, this time it is used to call some javascript program code. You do not need to understand the javascript in any detail.

The bit of javascript that is run is called HighlightAll and each time it is asked to run, it is told which bit of text of the page is required to be copied. This is the ('mylink.set1') which ties in with the bit of text in the <textarea. Each text area has a name, e.g. name="set1".

Inside the text area (between <textarea ....> and </textarea>) is the link code like the examples given earlier in this thread.

So, you put the two blocks of code I gave you inside a form block:

<form name="mylin">
the blocks I gave you
repeat the blocks but change set1 to set2, set3, etc for each pair
</form>

That's everything for the body section of your webpage.

The usual place to put the javascript is inside the head section of the document. (between <head> and </head>). Where he has <script type="text/javascript" src="abc.js"></script> you can place the actual script between the <script ...> and </scipt> and lose the src="abc.js" bit - which was the name of the file he has the script in instread of including it in the page itself.

Does that help?

Stuart

Ravenfire
4th August 2005, 16:53
Thats great thank you.

kyber
4th August 2005, 17:38
Here you go (http://www.kyber.co.uk/testing/mylinks.htm), here is a complete and very plain example (including a line I had missed out of the top of the Javascript).

By the way, this uses the javascript execCommand which is only supported in Microsoft Internet Explorer. Off the top of my head I do not know of a standard way of doing this. Perhaps someone else does. Last time I checked copying things to the clipboard was considered an insecure thing for a browser to do and could only be done on Firefox using "signed scripts" which you tend to only see within companies.

Normally I go with standards.... your choice.

Stuart

Webstuff
4th August 2005, 17:59
Firefox;


<script language="Javascript">
function doStuff() {
nLength = document.getElementById("test").value.length;

document.getElementById("test").setSelectionRange(0,nLength);
return;
}
</script>

This is a ... (Javascript:doStuff();)

<textarea id="test">This is a test</textarea>


Can't remember the clipboard code for FF, sorry :?

kyber
4th August 2005, 18:02
You need to explain the code. Ravenfire is new to this.

Webstuff
4th August 2005, 18:02
I think most browsers disable clipboard actions (the security issue).

Webstuff
4th August 2005, 18:12
My bad :P (my bad again for sounding so american)

kyber's already introduced you to <script> tags, so I'll explain as best I can;

the textarea is a simple text input, which I'm sure you are familiar with. I've put some text in it for the example. The content is highlighted when the link is clicked on;


This is a ... (Javascript:doStuff();)


using the href="Javascript:..." for an anchor (link) tag executes that Javascript instead of changing the page. as you can see, my function "doStuff" gets the length of the textareas content with this code;


nLength = document.getElementById("test").value.length;


'nLength' is set to a number, which is calculated by the contents of "test" being fetched and counted. We then simply tell FF to highlight (setSelectionRange) the textareas content with this code;


document.getElementById("test").setSelectionRange(0,nLength);


the '0' is the offset; how many characters from the start we want to begin. The second value, 'nLength' is, as we already know, the total length of the contents of the textarea.

If you weren't confused before, I'm sure you will be now ;)