Forum Moderators: not2easy

Message Too Old, No Replies

CSS and PHP

         

Julidivi

7:42 am on Oct 25, 2007 (gmt 0)

10+ Year Member



I have set a set of template files such as the footer and side navigation, to be called using the php function require()

I had set all my css styles for my links in Link,Visited, Hover and Active. Then I was manually applying a style to the link of the current page to improve user location.

Now that I have the menu as a template, I can't highlight the current link anymore.

does anyone know a way around it?

Thanks

Marshall

8:07 am on Oct 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey Julidivi, welcome to WebmasterWorld.

This is going to be only of partial help. There is a way through scripting to highlight the current page link, and I am sorry to say, I am not sure if it is a javascript or something you can do through php. However, in you CSS, you would need to create a class, let's say "current" to write to the link.

a.current {
parameters
}

Now either through javascript or php, you would need a way to detect the current page and apply the class to the proper link. Make sense?

Again, sorry if this was only partial help.

Marshall

Habtom

8:17 am on Oct 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have only slightly understood what you want to do.

Instead of the require try using file_get_contents, and if that doesn't work, please explain it a bit more. Post the relevant code if necessary.

Habtom

londrum

8:52 am on Oct 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you could do something like this in your php template

if(($_SERVER['SCRIPT_NAME'])!='/example/index.html')
{
echo'<a href="/example/">Index</a>';
}
else
{
echo'<strong>Index</strong>';
}

coopster

2:16 pm on Oct 26, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can use PHP's output buffering to accomplish this task. Some basic concepts are shown in this relative thread titled Hiding hyperlinks for page displayed [webmasterworld.com].