Related to hyperlink

S

Su Man

I have a hyperlink say 'Click here to open'

The href of this should be conditional.

This means I need to look for availability of a folder(say
C:\MySite\MyPage). If the folder is present I need to give a file in that
folder as reference(say C:\MySite\MyPage\Mine.htm).

Other wise I want to give the reference of another file (say
C:\MySite\Others.htm).

Please let me know how this can be achieved.


Thanks in advance,
Su Man
 
R

rf

Su said:
I have a hyperlink say 'Click here to open'

Bad choice. The link should say something like "Open Me".
The href of this should be conditional.

What? Links are not conditional. They juat are.
This means I need to look for availability of a folder(say
C:\MySite\MyPage). If the folder is present I need to give a file in that
folder as reference(say C:\MySite\MyPage\Mine.htm).

All of this references the local file system. Nothing on a web page may
access the local file system.
Other wise I want to give the reference of another file (say
C:\MySite\Others.htm).
Ditto.

Please let me know how this can be achieved.

Please let me know what you are actually trying to achieve. It is usually
better to address the problem you have than to try to correct the solution
you have decided upon.
 
J

Jukka K. Korpela

Su Man said:
I have a hyperlink say 'Click here to open'

Then change it. "Click here" is uninformative and looks really foolish
when someone prints your page.
See http://www.cs.tut.fi/~jkorpela/www/click.html
The href of this should be conditional.

There is no conditionaly in HTML.
This means I need to look for availability of a folder(say
C:\MySite\MyPage). If the folder is present I need to give a file in
that folder as reference(say C:\MySite\MyPage\Mine.htm).

Other wise I want to give the reference of another file (say
C:\MySite\Others.htm).

Why would you play with names of files on your own disk, and with full
paths at that?

Anyway, you can't do any such things in HTML. Try explaining what you
really wish to achieve, and maybe someone can help.
 
J

Jan Clemens Faerber

Su said:
This means I need to look for availability of a folder(say
C:\MySite\MyPage). If the folder is present I need to give a file in that
folder as reference(say C:\MySite\MyPage\Mine.htm).
Other wise I want to give the reference of another file (say
C:\MySite\Others.htm).

I don´t know but
if you can support apache this might help:

1) http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html

2) http://httpd.apache.org/docs-2.0/misc/rewriteguide.html
<quot>
Search pages in more than one directory

Description:

Sometimes it is necessary to let the webserver search for pages in more
than one directory. Here MultiViews or other techniques cannot help.
Solution:

We program a explicit ruleset which searches for the files in the
directories.

RewriteEngine on

# first try to find it in custom/...
# ...and if found stop and be happy:
RewriteCond /your/docroot/dir1/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /your/docroot/dir1/$1 [L]

# second try to find it in pub/...
# ...and if found stop and be happy:
RewriteCond /your/docroot/dir2/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /your/docroot/dir2/$1 [L]

# else go on for other Alias or ScriptAlias directives,
# etc.
RewriteRule ^(.+) - [PT]
</quot>
 
J

Jukka K. Korpela

Toby Inkster said:
<noframes>? <noscript>? @alt?

If we go into finer points, and take some liberties in wording, those
might be called conditionality of a kind. And <object> would even allow
conditionality (in that sense) in a manner that corresponds to an
unlimited if ... then ... else if ... chain.

But it really means taking too many liberties. After all, what is the
_condition_ in each of those cases? Conditionality without well-defined
conditions isn't really much of a conditionality. Although the HTML
specifications try to be relatively clear in the relevant formulations,
they are still a) informal prose, b) not really normative in style,
and c) generally implemented wrongly (think about <noframes> inside
<body> in a non-frameset document).

Moreover, even if these were fixed, it would not result in the kind of
conditionality that we find in programmin languages. Think about the alt
attribute. The specifications say: "For user agents that cannot display
images, forms, or applets, this attribute specifies alternate text."
This is a _poor_ formulation, since surely the alt attribute was meant to
be used, and is used, also by browsers that _can_ display images etc.
Moreover, this does not really specify conditionality; the decision on
whether the image is shown or the alt text is presented is left to the
browser (which might be controlled by user actions). This is quite
different from, say, if(a < b) foo(); else bar(); in the C language,
which specifies an exact condition to be computed and to be strictly used
to determine which action will be taken.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top