how to better handle links

J

jane doe

I update often, and having to do each page one by one is getting old very
quick. I use css on my website, but I am not real good at it. I need a way
to add or update links to my pages, but only have to edit one file, instead
of 77. Is there a css way of doing this? Or is there another way?

---
 
K

Knut Krueger

jane said:
I update often, and having to do each page one by one is getting old very
quick. I use css on my website, but I am not real good at it. I need a way
to add or update links to my pages, but only have to edit one file, instead
of 77. Is there a css way of doing this? Or is there another way?
I do this with PHP.
I have one config file with the links and I use the variables inside the
pages
<?
$link_1e = substr_replace($link_1,$root_url,0, 0);
echo "<a id=\"institute_link_1\" HREF=$link_1e> $linkname_1 </a>";
?>
the first line is to build the link form he root url and the path in the
config file for my own links. This is only for links in the HP
The second line uses a variable to build the link. f.e any url from the
config file. And I have only one Layout page (if the layout is equal)
and I am changing the content also with PHP include()

but that's the wrong group for that


Knut
 
J

jane doe

--

"Knut Krueger" <knut.krueger> scribbled in message
: jane doe schrieb:
: > I update often, and having to do each page one by one is getting old
very
: > quick. I use css on my website, but I am not real good at it. I need a
way
: > to add or update links to my pages, but only have to edit one file,
instead
: > of 77. Is there a css way of doing this? Or is there another way?
: >
: > ---
: >
: >
: I do this with PHP.
: I have one config file with the links and I use the variables inside the
: pages
: <?
: $link_1e = substr_replace($link_1,$root_url,0, 0);
: echo "<a id=\"institute_link_1\" HREF=$link_1e> $linkname_1 </a>";
: ?>
: the first line is to build the link form he root url and the path in the
: config file for my own links. This is only for links in the HP
: The second line uses a variable to build the link. f.e any url from the
: config file. And I have only one Layout page (if the layout is equal)
: and I am changing the content also with PHP include()
:
: but that's the wrong group for that
:
:
: Knut


Anyway you can break this down more? I am new at this stuff. Sorry but I
have no clue as to what I am looking at.
 
J

J.O. Aho

jane said:
I update often, and having to do each page one by one is getting old very
quick. I use css on my website, but I am not real good at it. I need a way
to add or update links to my pages, but only have to edit one file, instead
of 77. Is there a css way of doing this? Or is there another way?

Using scripting languages ae usually quite good for this, you then can include
the menu/links list to the pages and only have one file to edit.

Those who want to be more complicated can use a xml file as the source for the
links and the script that is included will parse the xml and "draw" the
menu/link list (still one file to modify, the xml).

There are other ways too, but not all of them are worth mentioning.
 
J

J.O. Aho

jane doe wrote:

First, please don't leave a "-- " in the top of your post, as proper news
clients will take everything belowe that as a signature/footer and not include
it in a reply.
Anyway you can break this down more? I am new at this stuff. Sorry but I
have no clue as to what I am looking at.

PHP is a scripting language (the most popular at the moment), to use this you
will need a web host that provides you with PHP.

<?
$link_1e = substr_replace($link_1,$root_url,0, 0);
//this places the value in the variable $root_url in front of
//variable $link_1 and stores it into the variable $link_1e
//it's the same as: $link_1e = $root_url.$link_1;

echo "<a id=\"institute_link_1\" HREF=$link_1e> $linkname_1 </a>";
//here the anchor tag is typed to the resulting HTML that is sent to
//the user browsing the page.
?>

This snippet of PHP code isn't that useful as an example.

<?PHP
$linkarray=("The link name" => "http://example.net",
"Another" => "http://user.example.net",
"CIA" => "http://www.cia.net",
"FBI" => "http://www.fbi.net",
"W3C" => "http://www.w3c.org",
"Linux" => "http://www.linux.org"
);
foreach($linkarray as $name => $url) {
echo "<a href=\"$url\">$name</a><br>\n";
}
?>

This would generate the following

<a href="http://example.net">The link name</a><br>
<a href="http://user.example.net">Another</a><br>
<a href="http://www.cia.net">CIA</a><br>
<a href="http://www.fbi.net">FBI</a><br>
<a href="http://www.w3c.org">W3C</a><br>
<a href="http://www.linux.org">Linux</a><br>


You just add links to the $linkarray in the same manner as those I made.
Inside the for each loop you design the look of how the links should be drawn
in the HTML data sent. The $name is the name of the link an the $url where the
link will point. If you would save the code to it's own file, say menu.php,
then you need to rename all the files that will use the php-code to
<old name - .html>.php (if the old file was index.html, then it should be
named index.php) and at the location where the links will be listed you add

<?PHP include 'menu.php'; ?>

every time you want to change the links, you edit the menu.php file.

This is just a crude example, if you need php help, then visit alt.php.
 
J

jane doe

: jane doe wrote:
:
: First, please don't leave a "-- " in the top of your post, as proper news
: clients will take everything belowe that as a signature/footer and not
include
: it in a reply.
:
: > Anyway you can break this down more? I am new at this stuff. Sorry
but I
: > have no clue as to what I am looking at.
:
: PHP is a scripting language (the most popular at the moment), to use this
you
: will need a web host that provides you with PHP.
:
: <?
: $link_1e = substr_replace($link_1,$root_url,0, 0);
: //this places the value in the variable $root_url in front of
: //variable $link_1 and stores it into the variable $link_1e
: //it's the same as: $link_1e = $root_url.$link_1;
:
: echo "<a id=\"institute_link_1\" HREF=$link_1e> $linkname_1 </a>";
: //here the anchor tag is typed to the resulting HTML that is sent to
: //the user browsing the page.
: ?>
:
: This snippet of PHP code isn't that useful as an example.
:
: <?PHP
: $linkarray=("The link name" => "http://example.net",
: "Another" => "http://user.example.net",
: "CIA" => "http://www.cia.net",
: "FBI" => "http://www.fbi.net",
: "W3C" => "http://www.w3c.org",
: "Linux" => "http://www.linux.org"
: );
: foreach($linkarray as $name => $url) {
: echo "<a href=\"$url\">$name</a><br>\n";
: }
: ?>
:
: This would generate the following
:
: <a href="http://example.net">The link name</a><br>
: <a href="http://user.example.net">Another</a><br>
: <a href="http://www.cia.net">CIA</a><br>
: <a href="http://www.fbi.net">FBI</a><br>
: <a href="http://www.w3c.org">W3C</a><br>
: <a href="http://www.linux.org">Linux</a><br>
:
:
: You just add links to the $linkarray in the same manner as those I made.
: Inside the for each loop you design the look of how the links should be
drawn
: in the HTML data sent. The $name is the name of the link an the $url where
the
: link will point. If you would save the code to it's own file, say
menu.php,
: then you need to rename all the files that will use the php-code to
: <old name - .html>.php (if the old file was index.html, then it should be
: named index.php) and at the location where the links will be listed you
add
:
: <?PHP include 'menu.php'; ?>
:
: every time you want to change the links, you edit the menu.php file.
:
: This is just a crude example, if you need php help, then visit alt.php.
:
:
: --
:
: //Aho

Thank you. Sorry bout the --- I didn't even notice it there.
 
D

dorayme

"jane doe said:
I update often, and having to do each page one by one is getting old very
quick. I use css on my website, but I am not real good at it. I need a way
to add or update links to my pages, but only have to edit one file, instead
of 77. Is there a css way of doing this? Or is there another way?

Last things first. Go to

http://en.wikipedia.org/wiki/Signature_block#E-mail_and_Usenet

and read under the heading "E-mail and Usenet".

About updating. I notice you are getting replies that are surely
blinding you with science at the moment. But it can be a
complicated business. Let me suggest something simpler for a
start.

Get a good text editor that has a Search & Replace function that
is sophisticated enough to at least change all occurences of a
set of words in any number of files (not just one file). Once you
have your hands on this facility (many are good and free), you
will find life suddenly very much easier. If, for example, your
links arte all in some menu block on 77 different pages and you
want to change several of them, all you need do is copy and paste
the existing block of text into both the "Search" text field of
the editor and the replace one too and go on to make the changes
you want in the latter field. You then must instruct the function
to search a whole folder or directory (eg the whole website
folder on your local machine) and to replace all occurences. This
is often accomplished by help of ticking various boxes in the
editor function that comes up.

Naturally, you can adapt the above advice depending on your
situation. It is a huge time saver.

As for uploading the now successfully changed files, you still
have to do that. But that is easy and quick, 77 is not that many
and you can select the lot and ftp them all up in one go.

If you want to avoid this last step and generally are determined
not to actually change all your 77 html files then you need to do
a fair bit of work to set things up. This involves learning about
either server side includes or php includes. These techniques
involve putting a simple line of code in place of the block of
link text you normally have, a line of code which effectively
says: "Server, go fetch the following text file from such and
such a directory and stick it in here". You then make that text
file and put it on the server in that directory. When you want to
change that one text file, you can and it will then appear in all
77 files. But to do this, you need to look up server-side and php
includes and study it. It is not dead simple (like the S & R that
I recommended you at least try first) but not that hard either.
 
J

jane doe

: In article <w606i.1726$dy1.301@bigfe9>,
:
: > I update often, and having to do each page one by one is getting old
very
: > quick. I use css on my website, but I am not real good at it. I need a
way
: > to add or update links to my pages, but only have to edit one file,
instead
: > of 77. Is there a css way of doing this? Or is there another way?
: >
:
: Last things first. Go to
:
: http://en.wikipedia.org/wiki/Signature_block#E-mail_and_Usenet
:
: and read under the heading "E-mail and Usenet".
:
: About updating. I notice you are getting replies that are surely
: blinding you with science at the moment. But it can be a
: complicated business. Let me suggest something simpler for a
: start.
:
: Get a good text editor that has a Search & Replace function that
: is sophisticated enough to at least change all occurences of a
: set of words in any number of files (not just one file). Once you
: have your hands on this facility (many are good and free), you
: will find life suddenly very much easier. If, for example, your
: links arte all in some menu block on 77 different pages and you
: want to change several of them, all you need do is copy and paste
: the existing block of text into both the "Search" text field of
: the editor and the replace one too and go on to make the changes
: you want in the latter field. You then must instruct the function
: to search a whole folder or directory (eg the whole website
: folder on your local machine) and to replace all occurences. This
: is often accomplished by help of ticking various boxes in the
: editor function that comes up.
:
: Naturally, you can adapt the above advice depending on your
: situation. It is a huge time saver.
:
: As for uploading the now successfully changed files, you still
: have to do that. But that is easy and quick, 77 is not that many
: and you can select the lot and ftp them all up in one go.
:
: If you want to avoid this last step and generally are determined
: not to actually change all your 77 html files then you need to do
: a fair bit of work to set things up. This involves learning about
: either server side includes or php includes. These techniques
: involve putting a simple line of code in place of the block of
: link text you normally have, a line of code which effectively
: says: "Server, go fetch the following text file from such and
: such a directory and stick it in here". You then make that text
: file and put it on the server in that directory. When you want to
: change that one text file, you can and it will then appear in all
: 77 files. But to do this, you need to look up server-side and php
: includes and study it. It is not dead simple (like the S & R that
: I recommended you at least try first) but not that hard either.
:
: --
: dorayme


Thank you so much. I am well on my way setting up a template. The total
pages I have to change is 258. I was going to do just my best hits pages,
then I decided, why do that When I can do them all this summer, and be done
with it. So I am going to fix up the template, with everything in its
place, and then use html-kit. I do not know if html-kit has the replace
feature. But because I am making so many changes, I wasn't even sure if it
would be feasible to use the replace feature. Conisidering all the changes.
 
D

dorayme

"jane doe said:
this, you need to look up server-side and php
: includes and study it. It is not dead simple (like the S & R that
: I recommended you at least try first) but not that hard either.
:
: --
: dorayme


Thank you so much. I am well on my way setting up a template. The total
pages I have to change is 258. I was going to do just my best hits pages,
then I decided, why do that When I can do them all this summer, and be done
with it. So I am going to fix up the template, with everything in its
place, and then use html-kit. I do not know if html-kit has the replace
feature. But because I am making so many changes, I wasn't even sure if it
would be feasible to use the replace feature. Conisidering all the changes.

The point about the simplest "S & R over multiple docs" facility
that I described is that if there is any block of text that is
repeated over virtually any number of pages, they can be changed
at a stroke, even 1000 pages takes no time to speak of, (you
cannot go and make a cup of tea) on any modern computer.

But it gets better with more sophisticated S & R which can
replace selected bits of blocks of text and other things using
linked software engines such as GREP patterning. On the
Macintosh, one can use a free and very powerful editor called
TextWrangler to get these facilities. Doubtless there are the
equivalents on other platforms.
 

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
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top