Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Please help for building my site with menus and external css

Reply
Thread Tools

Please help for building my site with menus and external css

 
 
coolunmesh@gmail.com
Guest
Posts: n/a
 
      04-26-2006
I've designed my site long ago. but the problem is that i've a few
menus in every page. so i need to add the same code for the same menu
in every page except its own link( like no "about me' link in "about me
"page). at the same time i need to put the same css code in evey page.
and the menu is not located at the same place in every page. The menus
in every page is different compared to other websites.

Please help to fix the problem.

 
Reply With Quote
 
 
 
 
Roy Schestowitz
Guest
Posts: n/a
 
      04-26-2006
__/ [ http://www.velocityreviews.com/forums/(E-Mail Removed) ] on Wednesday 26 April 2006 17:42 \__

> I've designed my site long ago. but the problem is that i've a few
> menus in every page. so i need to add the same code for the same menu
> in every page except its own link( like no "about me' link in "about me
> "page). at the same time i need to put the same css code in evey page.
> and the menu is not located at the same place in every page. The menus
> in every page is different compared to other websites.
>
> Please help to fix the problem.


Hi,

CSS should be peripheral. Several pages can share the same stylesheet and
should do so if they bear a commonality (duplication is always a bad idea),
e.g. include <link rel="stylesheet" href="/styles/yourstyle.css"
type="text/css" /> between <head> and </head>. If you want to add this line
of code to many files in one fell swoop, you could use GNU/Linux tools, e.g.

find . -maxdepth 1 -type f -name '*.html' -print |
while read filename
do # print all filenames
(
sed 's/<head>/<head><link rel="stylesheet"
href="/styles/yourstyle.css" type="text/css" />/i;'
$filename >$filename.xxxxx
mv $filename.xxxxx $filename
# replace output files with original
)
done

The same strategy goes for menus. Menus are better written in a single place,
which makes them easier to change without pattern recognition and mass-file
replacement. If you don't use a CMS, you may wish to add a menu with a
complete set of links and disable individual to-self links manually, page by
page.

Hope it helps,

Roy

--
Roy S. Schestowitz | "Black holes are where God is divided by zero"
http://Schestowitz.com | SuSE Linux PGP-Key: 0x74572E8E
6:05pm up 4 days 3:16, 9 users, load average: 0.42, 0.44, 0.54
http://iuron.com - Open Source knowledge engine project
 
Reply With Quote
 
 
 
 
coolunmesh@gmail.com
Guest
Posts: n/a
 
      04-26-2006
Please tell me how a single menu can be shared in all pages ?

 
Reply With Quote
 
Paul Watt
Guest
Posts: n/a
 
      04-26-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Please tell me how a single menu can be shared in all pages ?
>


php includes or ssi


 
Reply With Quote
 
Jim Moe
Guest
Posts: n/a
 
      04-26-2006
(E-Mail Removed) wrote:
> I've designed my site long ago. but the problem is that i've a few
> menus in every page. so i need to add the same code for the same menu
> in every page except its own link( like no "about me' link in "about me
> "page). at the same time i need to put the same css code in evey page.
> and the menu is not located at the same place in every page. The menus
> in every page is different compared to other websites.
>

Put the CSS into a separate file. Add one of these to the <head>:
<link rel="stylesheet" href="/styles/common.css" type="text/css">
or
<style type="text/css">
@import url("/styles/common.css");
</style>

See <http://allmyfaqs.net/faq.pl?Include_one_file_in_another>.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      04-26-2006
To further the education of mankind, (E-Mail Removed) vouchsafed:

> I've designed my site long ago. but the problem is that i've a few
> menus in every page. so i need to add the same code for the same menu
> in every page except its own link( like no "about me' link in "about me
> "page). at the same time i need to put the same css code in evey page.
> and the menu is not located at the same place in every page. The menus
> in every page is different compared to other websites.


PHP is made for your situation. The menu(s) template can be made and
adjusted to render each virtual page uniquely based on a variable in the
search string. Google for info about php and includes.

--
Neredbojias
Infinity has its limits.
 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      04-29-2006
Roy Schestowitz wrote:

> sed 's/<head>/<head><link rel="stylesheet"
> href="/styles/yourstyle.css" type="text/css" />/i;'


This will work?! Shoudn't you be escaping some of those slashes?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./shawn_mullins/souls_core/06_and_on_a_rainy_night.ogg

 
Reply With Quote
 
Roy Schestowitz
Guest
Posts: n/a
 
      04-30-2006
__/ [ Toby Inkster ] on Saturday 29 April 2006 17:22 \__

> Roy Schestowitz wrote:
>
>> sed 's/<head>/<head><link rel="stylesheet"
>> href="/styles/yourstyle.css" type="text/css" />/i;'

>
> This will work?! Shoudn't you be escaping some of those slashes?


Oops. You're right. I added some slashes without testing, let alone thinking.
That 'script', by the way, is a derivative of something that /you/ once
wrote in an answer to my question. I have used this for the processing of
thousands of pages over the past year or so, mainly after LaTeX->HTML
conversions. Thanks for that.

Best wishes,

Roy

--
Roy S. Schestowitz | Useless fact: There are five regular polyhedra
http://Schestowitz.com | SuSE Linux PGP-Key: 0x74572E8E
7:35am up 2 days 14:40, 12 users, load average: 0.70, 1.04, 0.82
http://iuron.com - Open Source knowledge engine project
 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      04-30-2006
Roy Schestowitz wrote:

> That 'script', by the way, is a derivative of something that /you/ once
> wrote in an answer to my question.


Really? I can't imagine I would have written something as fancy as that as
a shell script. For anything that involves loops and logic, I tend to
immediately switch to Perl.

You might want to look at replacing this:

sed 'script' file >file.xxxxx
mv file.xxxxx file

with this:

sed -i 'script' file

From "man sed":


-i[SUFFIX], --in-place[=SUFFIX]

edit files in place (makes backup if extension supplied)


--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Roy Schestowitz
Guest
Posts: n/a
 
      04-30-2006
__/ [ Toby Inkster ] on Sunday 30 April 2006 12:14 \__

> Roy Schestowitz wrote:
>
>> That 'script', by the way, is a derivative of something that /you/ once
>> wrote in an answer to my question.

>
> Really? I can't imagine I would have written something as fancy as that as
> a shell script. For anything that involves loops and logic, I tend to
> immediately switch to Perl.



With respect, there was nothing overly sophisticated in your previous
suggestion. I just never knew anything about sed. Then you provided me with
a useful, extensible template/example. I needed such a tool for editing
files /en masse/.

http://schestowitz.com/Software/Search_and_Replace/ (it's not "software", but
it didn't fit anywhere else)


> You might want to look at replacing this:
>
> sed 'script' file >file.xxxxx
> mv file.xxxxx file
>
> with this:
>
> sed -i 'script' file
>
> From "man sed":
>
>
> -i[SUFFIX], --in-place[=SUFFIX]
>
> edit files in place (makes backup if extension supplied)



Thanks. To be honest, my filthy beast *grin* is doing its work reliably
enough and completes the task within a few seconds. I fear change that
involves subsequent testing, but will keep your kind advice close to hand.

Best wishes,

Roy

--
Roy S. Schestowitz | "Have you compiled your kernel today?"
http://Schestowitz.com | SuSE Linux PGP-Key: 0x74572E8E
7:00pm up 3 days 1:57, 13 users, load average: 0.49, 0.58, 0.44
http://iuron.com - help build a non-profit search engine
 
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
please please your help, VPN site to site between ASA and Netscreen ozoubi Cisco 0 09-23-2010 08:11 AM
Firefighters at the site of WTC7 "Move away the building is going to blow up, get back the building is going to blow up." Midex Python 24 05-07-2007 04:23 AM
Help needed regarding css and menus MagicFreebiesUK.co.uk HTML 7 04-12-2005 03:01 AM
Select menus above flyout menus? help? news.west.cox.net HTML 8 12-09-2004 12:54 PM
hierarchial menus using CSS and display attributes ? Mel HTML 2 06-22-2004 07:33 AM



Advertisments