|
Posted by J.O. Aho on 05/26/07 20:39
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
Navigation:
[Reply to this message]
|