Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > how to make website wide changes, later

Reply
Thread Tools

how to make website wide changes, later

 
 
Blinky the Shark
Guest
Posts: n/a
 
      11-01-2008
someone_else wrote:

>
> "Chris F.A. Johnson" <(E-Mail Removed)> wrote in message
> news:9e509$490c93c9$cef88ba3$(E-Mail Removed)...
>> On 2008-11-01, someone_else wrote:
>>> hi all,
>>> I want to build a website where each page contains a common set of links
>>> to
>>> other pages in the site. However, when I add a link, at a later date, I
>>> don't want to have to add it manually to each page.
>>>
>>> I have a rudimentary understanding of CSS, but I can't figure out how to
>>> use
>>> it to create my basic page template, which contains the common links.

>>
>> You don't use CSS; that is for presentation, not content.
>>
>>> I'm sure I must be missing something very obvious.
>>> Any simple examples out there?

>>
>> Use server-side includes (SSI):
>>
>> <!--#include file="links.html" -->
>>
>> You may have to name the enclosing file with a .shtml suffix or set
>> the execute bit on it, depending on how your web server is set up.
>>
>> --
>> Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com>
>> ================================================== =================
>> Author:
>> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

>
>
> Thanks for the quick replies guys.
> Since my host does not provide SSI it looks like I will just have to
> manually change each page. I can probably create a script in C or perl to


Free hosting?


--
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project: http://improve-usenet.org
Need a new news feed? http://blinkynet.net/comp/newfeed.html

 
Reply With Quote
 
 
 
 
David Segall
Guest
Posts: n/a
 
      11-02-2008
"Chris F.A. Johnson" <(E-Mail Removed)> wrote:

>On 2008-11-01, someone_else wrote:
>> hi all,
>> I want to build a website where each page contains a common set of links to
>> other pages in the site. However, when I add a link, at a later date, I
>> don't want to have to add it manually to each page.
>>
>> I have a rudimentary understanding of CSS, but I can't figure out how to use
>> it to create my basic page template, which contains the common links.

>
> You don't use CSS; that is for presentation, not content.
>
>> I'm sure I must be missing something very obvious.
>> Any simple examples out there?

>
> Use server-side includes (SSI):
>
> <!--#include file="links.html" -->

How do you make the required changes to distinguish the active menu
item from the remainder? For example, on my site, the menu items have
a class of menuItem but the current page has a class of menuItemActive
in its link. I use CSS to reference the class and highlight the
current item.
 
Reply With Quote
 
 
 
 
Sitedude
Guest
Posts: n/a
 
      11-02-2008
On Nov 1, 12:27*pm, "someone_else"
<(E-Mail Removed)> wrote:
> hi all,
> I want to build a website where each page contains a common set of links to
> other pages in the site. However, when I add a link, at a later date, I
> don't want to have to add it manually to each page.
>
> I have a rudimentary understanding of CSS, but I can't figure out how to use
> it to create my basic page template, which contains the common links.
>
> I'm sure I must *be missing something very obvious.
> Any simple examples out there?
> cheers


I see some good input here. Personally I use <!--#include virtual="/
myfolder/myfile.inc"--> however since your host will not allow you to
use the SSI and you would have to change the files to .shtml or .shtm
for that to work. You could get a javascript menu and use that or you
could use a little trick script like this
//trick jscript
<!--hide from old browsers
document.write ("<a href='http://drcwebs.net/index.html'>Index Page</
a>");
-->
//end trick
In a text editor create a file with your links using the
document.write and save it as something like mylinks.js then place
this code in your html file where you want the links to be <script
language="JavaScript" SRC="http://mysite.com/myjsfolder/mylinks.js"
type="text/javascript"></script>
It's a little down and dirty but I got it to work on my local server
good luck with it hope it helps
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      11-02-2008
In article <(E-Mail Removed)>,
David Segall <(E-Mail Removed)> wrote:

> How do you make the required changes to distinguish the active menu
> item from the remainder? For example, on my site, the menu items have
> a class of menuItem but the current page has a class of menuItemActive
> in its link. I use CSS to reference the class and highlight the
> current item.


You can do like this in the include:

<li<?php if ($thisPage=="index") echo " id=\"currentpage\""; ?>
class="name"><a href="index.html">Home</a></li>

And have the pages marked at the top of the doc type with such as:

<?php $thisPage="index"; ?>

and, of course, styles for "name"

There is likely more elegant, but this works to do distinguishing things
with the current navigational item.

--
dorayme
 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      11-02-2008

"Sitedude" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Nov 1, 12:27 pm, "someone_else"
<(E-Mail Removed)> wrote:

> //trick jscript
> <!--hide from old browsers


This idea of HTML comments inside script elements is to correct a bug in
IIRC Netscape version 2 which is now totally obsolete, and that was only for
script elements in the document, not for script residing in an external
file.

Please don't suggest that anybody use this cargo cult stuff in this century.

> document.write ("<a href='http://drcwebs.net/index.html'>Index Page</


Which will not work for somewhere between 10 and 15 percent of visitors.
Even if we are lenient and say only 8% of visitors don't have javascript
available or enabled then this is the equivalent of turning your server off
for about one month during the year. And for something as mission critical
as a menu to access other pages on the site is unforgivable.

In addition your most important visitor, googlebot, will be totally unable
to index the site.

The correct way to do this is server side, using SSI or some scripting
language such as PHP, the latter giving the added benefit of having the
"link" to the current page "disabled". If the current host does not support
PHP then there is another one just up the road that does.



 
Reply With Quote
 
Sitedude
Guest
Posts: n/a
 
      11-02-2008
On Nov 1, 11:57*pm, "rf" <(E-Mail Removed)> wrote:
> "Sitedude" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Nov 1, 12:27 pm, "someone_else"
>
> <(E-Mail Removed)> wrote:
> > //trick jscript
> > <!--hide from old browsers

>
> This idea of HTML comments inside script elements is to correct a bug in
> IIRC Netscape version 2 which is now totally obsolete, and that was only for
> script elements in the document, not for script residing in an external
> file.
>
> Please don't suggest that anybody use this cargo cult stuff in this century.
>
> > document.write ("<a href='http://drcwebs.net/index.html'>Index Page</

>
> Which will not work for somewhere between 10 and 15 percent of visitors.
> Even if we are lenient and say only 8% of visitors don't have javascript
> available or enabled then this is the equivalent of turning your server off
> for about one month during the year. And for something as mission critical
> as a menu to access other pages on the site is unforgivable.
>
> In addition your most important visitor, googlebot, will be totally unable
> to index the site.
>
> The correct way to do this is server side, using SSI or some scripting
> language such as PHP, the latter giving the added benefit of having the
> "link" to the current page "disabled". If the current host does not support
> PHP then there is another one just up the road that does.


I suppose you are correct about the html comment. Old habits are hard
to break sometimes and I forgot to mention the <no script> tag should
be used or the W3C validator will complain. If the host will not
enable SSI then they are probably too cheap to support php. The best
advice is to find another host and do this task properly .
 
Reply With Quote
 
richard
Guest
Posts: n/a
 
      11-02-2008
On Sat, 1 Nov 2008 21:30:33 -0700 (PDT), Sitedude
<(E-Mail Removed)> wrote:

>On Nov 1, 12:27*pm, "someone_else"
><(E-Mail Removed)> wrote:
>> hi all,
>> I want to build a website where each page contains a common set of links to
>> other pages in the site. However, when I add a link, at a later date, I
>> don't want to have to add it manually to each page.
>>
>> I have a rudimentary understanding of CSS, but I can't figure out how to use
>> it to create my basic page template, which contains the common links.
>>
>> I'm sure I must *be missing something very obvious.
>> Any simple examples out there?
>> cheers

>
>I see some good input here. Personally I use <!--#include virtual="/
>myfolder/myfile.inc"--> however since your host will not allow you to
>use the SSI and you would have to change the files to .shtml or .shtm
>for that to work. You could get a javascript menu and use that or you
>could use a little trick script like this
>//trick jscript
><!--hide from old browsers
>document.write ("<a href='http://drcwebs.net/index.html'>Index Page</
>a>");
>-->
>//end trick
>In a text editor create a file with your links using the
>document.write and save it as something like mylinks.js then place
>this code in your html file where you want the links to be <script
>language="JavaScript" SRC="http://mysite.com/myjsfolder/mylinks.js"
>type="text/javascript"></script>
>It's a little down and dirty but I got it to work on my local server
>good luck with it hope it helps



And just how will javascript make the changes across the entire site?
Your code would have to be placed on every page.
Then what if I have JS turned off?

Your idea would be much better served in PHP.

 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      11-02-2008

"Sitedude" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Nov 1, 11:57 pm, "rf" <(E-Mail Removed)> wrote:

> I suppose you are correct about the html comment. Old habits are hard
> to break sometimes


Even after more than a decade?

> and I forgot to mention the <no script> tag should


<noscript> (no space) *element*.

> be used or the W3C validator will complain.


No it won't.

And, sadly, the most common use of the noscript element is to proclaim
something like:
<noscript>Javascript is required for you to navigate this site</noscript>

> If the host will not
> enable SSI then they are probably too cheap to support php. The best
> advice is to find another host and do this task properly .


Indeed.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: DSLR lenses not good wide open at wide angle? Dauphin de Viennois Digital Photography 2 07-16-2008 12:29 PM
Wide Screen not wide enough? michelebargeman@yahoo.com DVD Video 31 04-27-2006 08:50 PM
Not many "wide-angle" compacts but, heck, many are wide-angle anyway! JeffOYB@hotmail.com Digital Photography 10 01-09-2006 08:30 AM
char 8bit wide or 7bit wide in c++? Web Developer C++ 2 07-31-2003 08:09 AM



Advertisments