LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-07-2005, 09:39 AM   #16
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30

First, I have not tried to build your page locally due to time constraints, but it's something I'll probably do when I get the time.

Second, what is an xml file? Is there a tutorial for that on the w3schools website?

Thanks again!
 
Old 06-07-2005, 10:44 AM   #17
towlie
Member
 
Registered: Apr 2004
Location: U.S.
Distribution: slackware 10.0
Posts: 110

Rep: Reputation: 15
Yes, w3schools has tutorials on all things xml.

And btw, if you want to just include the same menu on
a bunch of pages you could just save the code in a
javascript file:
Code:
// this is the file myScript.js
document.write('<ul> .... this is my menu code in html .... </ul>');
And then include it in your html files like so:
Code:
<script type="text/javascript" src="myScript.js"></srcript>

See this page:
http://www.w3schools.com/js/js_whereto.asp


EDIT: fixed script tag

Last edited by towlie; 06-07-2005 at 10:46 AM.
 
Old 06-07-2005, 11:48 AM   #18
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30
That's a great idea. I tried it, but I'm not sure how to get the javascript to write to a certain section of the page.

I have a table with a cell on the left side that will contain the menu. How can I get it to write within the <td> tags?

I tried to change the td tag to:
Code:
<td name="menu">
then in the javascript, put:
Code:
document.menu.write("...")
but it put it added it at the end of the page.

Thanks for all your help.
 
Old 06-07-2005, 12:59 PM   #19
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
Acceptable solution (provided that users without Javascript can still navigate) but bad implementation, because the write() function is deprecated in XHTML, because DOM manipulation has now to be done via the DOM functions.

Yves.
 
Old 06-07-2005, 01:29 PM   #20
towlie
Member
 
Registered: Apr 2004
Location: U.S.
Distribution: slackware 10.0
Posts: 110

Rep: Reputation: 15
Quote:
Acceptable solution (provided that users without Javascript can still navigate) but bad implementation, because the write() function is deprecated in XHTML, because DOM manipulation has now to be done via the DOM functions.
Didn't know that. Is there a new standard way of doing it
from javascript? Do u have a link?


dubya, wish u could use php and this would be cake.
 
Old 06-07-2005, 02:22 PM   #21
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Quote:
And btw, if you want to just include the same menu on
a bunch of pages you could just save the code in a
javascript file
I would recommend against this--simply because *I* normally disable javascript (but I guess I'm not the only one).

The point is: never, ever, *rely* on javascript. Use it for `extra' services, like displaying whether or not a form field is valid (but validate it on the server side too), or, say, sorting some data.

Another option is to use xml and xslt and rely on the client to translate it--but since that's a pretty new technology, it's gonna break in a *lot* of browsers.

Best wishes --Jonas
 
Old 06-07-2005, 05:48 PM   #22
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
For your pleasure
http://www.onlinetools.org/articles/...ivejavascript/

Yves.
 
Old 06-07-2005, 07:55 PM   #23
towlie
Member
 
Registered: Apr 2004
Location: U.S.
Distribution: slackware 10.0
Posts: 110

Rep: Reputation: 15
yes, i forgot about people who turn off js (even though
document.write() isn't really that malignant).

dubya, in the abscence of php, u may want to use perl.

If you have an html file 'foo.html' and you want to have
your side menu taken out of that file so you can use it in
others, make a cgi script foo.cgi something like this:
Code:
#!/usr/bin/perl
# this is the file foo.cgi, inserting menu from menu.html
# into the middle of the old file foo.html
use strict;

my $menu= `sideMenu.html`;  #file with side menu code

my $foo_part_a= <<<END
blah ...
(put first part of foo.html until the menu here)
END;

my $foo_part_b= <<<END
blah ...
(remainder of file foo.html goes here)
END;

print "$foo_part_a $menu $foo_part_b";
and ask your isp to provide php
 
Old 06-08-2005, 10:29 AM   #24
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30
So, do I run that script on my own to udate the files, or is that something I store on the server that is invoked everytime someone visits my page?

Thanks for the help.
 
Old 06-08-2005, 10:39 AM   #25
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30
Another thing, is there a way I can define classes of links within my style sheet that go to a certain page?

For example, if I reference Linux a lot and want to link on the word Linux to www.linux.org, can I define a class called a.linux that will open that website in a popup window? I've tried the following, but it doesn't work for me:
Code:
a.linux
{
     href:"http://www.linux.org/";
     target:"_blank"
}
Thanks in advance.
 
Old 06-08-2005, 11:24 AM   #26
towlie
Member
 
Registered: Apr 2004
Location: U.S.
Distribution: slackware 10.0
Posts: 110

Rep: Reputation: 15
You store that cgi script on the server, and the web server invokes
it automatically when the page is visited.


You can define classes for style purposes, but not to actually change
the link hyperref.

Try putting something like this in your cgi:
Code:
my $linuxLink= '<a href="http://www.linux.org">linux.org</a>';

print "<p>This is a sample, click the following link to visit $linuxLink </p>";

Or to make a function (so you'll have variable text):
Code:
sub linuxLink {
  $text= shift;
  return '<a href="http://www.linux.org">'. $text .'</a>';
}

print "<p>Link to linux page, click ". linuxLink('here') ."</p>";
 
Old 06-08-2005, 11:32 AM   #27
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30
How can I set this script to be automatically invoked? Do I just name it index.cgi?

Thanks again.
 
Old 06-08-2005, 11:41 AM   #28
PerfectReign
Member
 
Registered: Apr 2005
Location: Los Angeles
Distribution: openSUSE / Ubuntu
Posts: 294

Rep: Reputation: 33
Mr D -

You might want to look into a host that supports PHP. Getting your own domain plus a hosting account can be very cheap these days. Before I switched to being my own reseller (for a mere US$20/month) I had a few lower volume hosts which only charged US$2.50 or so per month when I purchased annual contracts.

In that sense you can then run a CMS (content mangagement system) on your site. I do this on almost all my sites. You spend a little time setting it up then just go. Updating content is easy and you just need to make sure you back up your database once in a while.

Some good CMS systems are Drupal , TikiWiki , PHP Nuke , and my personal favorite, Xoops . (I use Xoops on my personal site.)

You can use all of the CMS systems listed for free, and I'm sure there are many others I haven't included. The nice thing is, once they're up, you pretty much don't have to maintain much - unless you want to.

Google for cheap web hosts php, and you'll find a bazillion of them. Many will also throw in one of the above CMS systems along with your hosting.
 
Old 06-09-2005, 02:45 AM   #29
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
Quote:
Originally posted by jonaskoelker Another option is to use xml and xslt and rely on the client to translate it--but since that's a pretty new technology, it's gonna break in a *lot* of browsers.
It isn't that new, and it does actually work well with IE6 and Firefox (it is said to work with slightly older versions of IE too); I don't know for Opera/Konqueror.

I have used this technique on my web site for the Atom and RSS1 feeds, and according to my server stats, it will be usable by almost all my visitors (IE + Firefox + robots : 90% or so).

This technique would allow you to do whatever you want, based on any attribute. Your thing about the "linux" class for example.

Yves.
 
Old 06-09-2005, 08:57 AM   #30
towlie
Member
 
Registered: Apr 2004
Location: U.S.
Distribution: slackware 10.0
Posts: 110

Rep: Reputation: 15
dubya, yes, you name the file whatever you want (just treat it
like you would an html file, the web server will handle it properly),
then the url to it for your visitors would be just like html:
Code:
http://www.myhost.com/myWebDir/index.cgi
Also take a look at PerfectReign's suggestion, do that google
that was mentioned.


theYinYeti, about using xslt, if you use this you can only send the
client an xml file right? So how would you embed this in (x)html?
If you have a link I'd appreciate it.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
language for linux development jkmartha Linux - Newbie 1 08-02-2005 02:06 AM
Any tool is there for speedy Web Page development? anindyanuri Fedora 5 03-07-2005 06:51 AM
Application development in C++ what to use? name_in_use450 Programming 1 08-02-2004 05:44 PM
Easy 2 use web page application? Braveheart1980 Linux - Software 4 03-01-2004 10:35 PM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 10:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration