LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 01-31-2018, 12:37 AM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,498

Rep: Reputation: 259Reputation: 259Reputation: 259
Lightbulb Basic web geek question


Hello guys, how to design a web page if you have a selection of menu either at the top, left or right side.
When the user click something on the menu, the page will be displayed right on the same page.
What I mean is like here in LQ, I click on "Linux General" then the Linux General discussion will get loaded. If I click on "Linux NewBie" then the Linux Newbie discussion will get loaded but it gets loaded without opening a new page but on the same page only.

Just need some ideas, or example if possible.

Thanks in advance for any help.
 
Old 01-31-2018, 12:39 AM   #2
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,498

Original Poster
Rep: Reputation: 259Reputation: 259Reputation: 259
I just realize it after posting, will it be something like this: <a href="https://www.w3schools.com" target="_blank">Visit W3Schools</a>

Are there any other methods? simple one but works fine.
 
Old 01-31-2018, 01:51 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,682
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
^ that would open it on a new page.
simply leaving the target=... out should be enough.
but maybe there's a setting to explicitly keep it on the same page.
i recommend searching w3schools.com for this.
 
Old 01-31-2018, 02:25 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,498

Original Poster
Rep: Reputation: 259Reputation: 259Reputation: 259
Hi Ondoho, true it will open a new page. I think it should be _self.

Thanks for the heads up, but I don't know whether there are other ways to do this.
 
Old 01-31-2018, 08:37 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 14,047
Blog Entries: 24

Rep: Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794Reputation: 3794
In the old days, you would use frames to accomplish this.
 
Old 01-31-2018, 09:07 PM   #6
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,717

Rep: Reputation: 1118Reputation: 1118Reputation: 1118Reputation: 1118Reputation: 1118Reputation: 1118Reputation: 1118Reputation: 1118Reputation: 1118
Quote:
Originally Posted by frankbell View Post
In the old days, you would use frames to accomplish this.
Today I would use CSS to do this. Frames are awkward, and the usage is being depreciated in most tools. When things go wrong a frame degrade is VERY ugly.

CSS is faster, more general, degrades (when properly designed) with functional elegance, and is fun.
 
Old 01-31-2018, 11:03 PM   #7
Trihexagonal
Member
 
Registered: Jul 2017
Location: Land of 1000 Nights
Distribution: FreeBSD, OpenBSD and Solaris
Posts: 165

Rep: Reputation: 113Reputation: 113
I second the motion on W3Schools.com. I taught myself to write valid XHTML and CSS there almost 20 years ago and it has served me well.

I am a master of XHTML 1.0 Frameset and can arrange frames in any configuration from top, bottom and sides, or make them going round and round in a spiral to a 1 inch square in the middle of the page. Which serves no purpose other than an exercise.

In fact, I've been working on my site and played with Frameset a couple days ago. This has a head, content and a foot frame with a head.html, foot.html. content.html and index.html page. Only the index page is Frameset, the rest are XHTML Transitional. CSS 3 no longer recognizes the code for the white frame borders.

I did say playing...
Attached Thumbnails
Click image for larger version

Name:	frameset.png
Views:	17
Size:	72.4 KB
ID:	26876  

Last edited by Trihexagonal; 02-01-2018 at 02:47 AM.
 
Old 02-01-2018, 01:32 AM   #8
Michael Uplawski
Member
 
Registered: Dec 2015
Location: Normandy, France
Distribution: Debian buster/sid
Posts: 696
Blog Entries: 23

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Erm. I am sorry.

But would not omitting the target-attribute quite simply have the desired effect? If the user has configured the browser in a way that imposes a behavior, do rather not try to overrule that. But that is just Html2 to xhtml knowledge. I use to ignore anything which is not a “standard” in the old sense of the word.
 
Old 02-01-2018, 02:31 AM   #9
Trihexagonal
Member
 
Registered: Jul 2017
Location: Land of 1000 Nights
Distribution: FreeBSD, OpenBSD and Solaris
Posts: 165

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by Michael Uplawski View Post
Erm. I am sorry.

But would not omitting the target-attribute quite simply have the desired effect?
Of course, but I was promoting W3Schools.

If your files are all in the same directory on the same server all you need is a basic hyperlink:

Code:
<a href="tutorial.html">FreeBSD Desktop Tutorial</a>
None of those frameset pages uses the target attribute, yet all 4 come together for 1 page by simple links from the index page.

Code:
<frameset rows="60,*,60">
<frame src="head1.html" name="head" scrolling="no" noresize="noresize" frameborder="0" />
<frame src="content.html" name="content" scrolling="yes" noresize="noresize" frameborder="0" />
<frame src="foot1.html" name="foot" scrolling="no" noresize="noresize" frameborder="0" />
If I wanted side frames I would use the "cols" attribute, for columns, instead of "rows" for bars, or both.

The CSS for the frame borders is no longer officially supported but here is the code, which was valid at the time I wrote it:

Code:
body {
scrollbar-arrow-color: #ffffff;
scrollbar-base-color: #000000;
scrollbar-dark-shadow-color: #ffffff;
scrollbar-face-color: #000000;
scrollbar-highlight-color: #ffffff;
scrollbar-shadow-color: #000000;
scrollbar-track-color: #000000;
background-color: #000000;
}
Now if someone were to click on a link to an outside site, normally that site would appear in my middle content frame. To prevent them from being trapped in my frame, I would use:

Code:
<a href="http://linuxquestions.org" target="_top">Linux Questions</a>
Then the page opens in a new window.

Otherwise target isn't needed for content to appear in that frame, either to do what you asked. Have a page open in the same window.

Last edited by Trihexagonal; 02-01-2018 at 06:41 AM. Reason: God is in the detail
 
Old 02-01-2018, 01:59 PM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,682
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
i'm beginning to understand op's requirement, i think.
it is the same thing i stumbled over when i tried to build a web page for the very first time:
the menu, top- and sidebar are always the same, only the content changes.
you don't want to have the exact same code on every page.
yes, it can be done with frames, but for me the ultimate answer was server side scripting, i.e. PHP.
build each page whenever it is requested.
CSS cannot achieve this.
 
Old 02-01-2018, 02:32 PM   #11
Trihexagonal
Member
 
Registered: Jul 2017
Location: Land of 1000 Nights
Distribution: FreeBSD, OpenBSD and Solaris
Posts: 165

Rep: Reputation: 113Reputation: 113
ondoho, I am not recommending OP use frames. I don't even use them, and although my example scales down proportionally with the screen size I have no idea how it would render in a smartphone.

And you are correct, CSS cannot do the job. That's the work of XHTML.

Trust me. If OP follows my examples he can achieve the desired results. I have websites links to the Wayback Machine going back to 2004 I provide in the FreeBSD forums in the same thread where my work in XHTML and CSS is also displayed as a fix for 2 freebsd.org website Bugzilla bugs.
 
Old 02-01-2018, 02:53 PM   #12
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,758

Rep: Reputation: 554Reputation: 554Reputation: 554Reputation: 554Reputation: 554Reputation: 554
I usually accomplish management of menus by simply repeating the menu code on each page of the site. That can be onerous if there are many pages, of course.

I've also used CSS to create drop-down menus, but the code, or at least the link to the code, still has to be repeated on each page.

Using PHP or (as I do) perl to create dynamic content works, as ondoho pointed out, but the end result is a rendered page with the menu code repeated, right?

Frames have their uses: One of my favorite uses is to hide the URL of a dynamic page ( somedomain.com/somescript.pl ) so that the visitor doesn't see the actual script name. This is useful when they are completing a survey and we don't want them to bookmark the script itself, but I wouldn't recommend frames normally, for reasons that have already been expressed here.

In the past, I've used tables to control page layout, sometimes with only two columns: The menu column on the left, and the main content column on the right. Today a newbie should learn to do things like that with CSS to be current.

To address the OP's original question: Not specifying a target will cause the new content to be loaded into, and replace, the page being viewed.
A snippet from w3schools:
Code:
HTML Links - The target Attribute

The target attribute specifies where to open the linked document.

The target attribute can have one of the following values:

    _blank - Opens the linked document in a new window or tab
    _self - Opens the linked document in the same window/tab as it was clicked (this is default)
    _parent - Opens the linked document in the parent frame
    _top - Opens the linked document in the full body of the window
    framename - Opens the linked document in a named frame
I've used the named frame to change what goes into a pop-up window. The first use of a framename will work like _blank

Last edited by scasey; 02-01-2018 at 02:58 PM.
 
Old 02-01-2018, 03:25 PM   #13
Trihexagonal
Member
 
Registered: Jul 2017
Location: Land of 1000 Nights
Distribution: FreeBSD, OpenBSD and Solaris
Posts: 165

Rep: Reputation: 113Reputation: 113
I learned back in the day, and old habits die hard, so I still use tables. But tables are what I use to get my site to scale down in proportion as the screen size shrinks, as do the CSS buttons. That also shows how to get your images to do the same with percentage.
Attached Thumbnails
Click image for larger version

Name:	scaling.jpg
Views:	14
Size:	237.1 KB
ID:	26879  

Last edited by Trihexagonal; 02-01-2018 at 03:36 PM.
 
Old 02-01-2018, 07:39 PM   #14
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,498

Original Poster
Rep: Reputation: 259Reputation: 259Reputation: 259
Wow, thank you so much guys. That's a lot of things to digest.
 
Old 02-01-2018, 07:48 PM   #15
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,498

Original Poster
Rep: Reputation: 259Reputation: 259Reputation: 259
W3schools is really awesome, i never knew about top before.

https://www.w3schools.com/tags/tryit...html_link_test

I think this is what I need.


Quote:
<!DOCTYPE html>
<html>
<body>

<a href="https://www.w3schools.com" target="_top">Visit W3Schools.com!</a>

</body>
</html>
I'll be using PHP, an HTML template with bootstrap. Which I just found on the web.

Last edited by JJJCR; 02-01-2018 at 07:48 PM. Reason: edit
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Basic web scraping question(mechanize+BeautifulSoup) methodtwo Programming 1 03-31-2014 04:27 PM
basic html question - download link to files on my webpage question Davno Linux - Server 5 12-25-2009 07:24 AM
LXer: Ideas for a Geek Ranch Web Site LXer Syndicated Linux News 0 12-09-2007 11:40 AM
Basic web-server set-up oldwordsmith Linux - Newbie 4 05-26-2006 09:09 AM
Looking for a very basic HOWTO on setting up a web server CatchFlipsidE Linux - Newbie 5 08-25-2004 01:02 PM

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

All times are GMT -5. The time now is 01:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration