Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Permanently Highlighting Active Links
Old 11-02-2005, 10:32 AM Permanently Highlighting Active Links
Skilled Talker

Posts: 65
Trades: 0
Hi there,

With the expertise of member Funkdaddu , I have managed to display different content on my index.php page depending on the links clicked using query strings in the urls e.g http://www.mysite.com/index.php?Section=News...

Now tho I would like to be able to change the colour of the link that is active (permanently active) so that its colour changes until another link is clicked in which that link should change colour and the previous link go back to the default link colour.

I would be very grateful if anyone has any ideas on how to go about this.

Many Thanks

Hick
The Hick Man is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-02-2005, 10:58 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You will have to do this in server side code by changing the css class for the link depending on the value of the querystring.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-02-2005, 11:01 AM
sdcdesign.co.uk's Avatar
Extreme Talker

Posts: 198
Location: High Wycombe, Buckinghamshire, London
Trades: 0
Quote:
Originally Posted by The Hick Man
Hi there,

With the expertise of member Funkdaddu , I have managed to display different content on my index.php page depending on the links clicked using query strings in the urls e.g http://www.mysite.com/index.php?Section=News...

Now tho I would like to be able to change the colour of the link that is active (permanently active) so that its colour changes until another link is clicked in which that link should change colour and the previous link go back to the default link colour.

I would be very grateful if anyone has any ideas on how to go about this.

Many Thanks

Hick
I swear i helped you.... http://www.webmaster-talk.com/showthread.php?t=38421 hehe

joking
__________________
[ Insert witty, yet highly intelligent signature here ]
sdcdesign.co.uk is offline
Reply With Quote
View Public Profile Visit sdcdesign.co.uk's homepage!
 
Old 11-02-2005, 11:10 AM
Skilled Talker

Posts: 65
Trades: 0
Apologies... I got answers from 2 members one was Funkdaddu but the other was the brilliant sdcdesign.co.uk

Thanks again... any clue on this one???
The Hick Man is offline
Reply With Quote
View Public Profile
 
Old 11-02-2005, 11:24 AM
sdcdesign.co.uk's Avatar
Extreme Talker

Posts: 198
Location: High Wycombe, Buckinghamshire, London
Trades: 0
Its cool man


So, what your saying is, say the 'home' link was clicked and the homepage was displayed, you want home to be blue, and the resy of the links red?

Then if contact was clicked, you want contact to be blue and the rest of the links to be red?


I know these aren't the exact colours but i just want to make sure i've got the aim right...
__________________
[ Insert witty, yet highly intelligent signature here ]
sdcdesign.co.uk is offline
Reply With Quote
View Public Profile Visit sdcdesign.co.uk's homepage!
 
Old 11-02-2005, 11:38 AM
Skilled Talker

Posts: 65
Trades: 0
Yeh u've got it mate...

I think it is more tricky because when the links are clicked a page isn't displayed as such but just the content within a certain area changes (to simulate different pages) via php code...

I realise the links class has to be modified for the url with the particular query string that is clicked on e.g. when www.mysite.php/index.php?Section=Home displays the home page content and that link needs to be blue like you said but only that link untl another one is clicked...

I found this site does exactly what I am trying to do <a href='http://www.5minuteflirts.co.uk'</a>

Sorry for my lack of clarity... Thx for prompt reply and hope u can help!

Cheers
The Hick Man is offline
Reply With Quote
View Public Profile
 
Old 11-02-2005, 11:48 AM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
I guess my answer was better

j/k

So Hick, I'm not following you 100% on the link color thing. So are you saying you've go a menu that has News, Products, Whatever and when you click on the news section, the news button is highlighted in the menu and when you click to the Products section, the news button returns to the default color and then Products is highlit? Like this:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php

function getCSS($x) {
	if ($x == $_GET["Section"]) {
		echo "activeButton";
	} else {
		echo "button";
	}
}

?>
<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Untitled Page</title>
		<style type="text/css" media="screen"><!--
.button  {
	color: #983333;
	font-weight: bold;
	text-decoration: none;
	background-color: #c0c0c0;
	margin: 4px;
	padding: 4px;
	border: inset 1px
	}


.activeButton  {
	color: #fff;
	font-weight: bold;
	text-decoration: none;
	background-color: #983333;
	margin: 4px;
	padding: 4px;
	border: inset 1px #c0c0c0
	}


--></style>
	</head>

	<body bgcolor="#ffffff">
		<a class="<?php getCSS("")?>" href="index.php">Home</a> <a class="<?php getCSS("News")?>" href="index.php?Section=News">News</a> <a class="<?php getCSS("Products")?>" href="index.php?Section=Products">Products</a>
<?php

switch ($_GET["Section"]) {
	case "News":
		echo "<h2>News</h2>
		<p><a href='index.php'>Article 1</a></p>
		<p><a href='index.php?Section=News'>Article 2</a></p>
		<p>Article 3</p>
		<p>Article 4</p>";
		break;
	case "Products":
		echo "<h2>Products</h2>
		<p>Here are our products</p>
		<p>Article 1</p>
		<p>Article 2</p>
		<p>Article 3</p>
		<p>Article 4</p>";
		break;
	default:
		echo "<h2>Welcome!</h2>
		<p>Welcome to my webpage! Click here for the <a href='?Section=News'>news.</a></p>
		<p>Click here for the <a href='?Section=Products'>products.</a></p>";
		break;
}
?>	</body>

</html>
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 11-02-2005, 12:40 PM Awesome!
Skilled Talker

Posts: 65
Trades: 0
That is truly brilliant - very clever piece of code...

I have a lot to learn... sorry for delayed response was trying to understand the code rather than just modify it to suit my site.

So it seems like the function getCSS gets the parameter Section and if it returns something the activeButton style sheet is put into the a class before the url where Section=the query string?

I think I get it but I really appreciate you posting that because I am trying to teach myself web development and if you can't find answers on Google, I find myself stuck for days!!!

Thanks again mate

Hick
The Hick Man is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Permanently Highlighting Active Links
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46926 seconds with 12 queries