All times are UTC + 5:30 hours




Post new topic Reply to topic  [ 5 posts ] 
  Print view

trouble with css style
Author Message
PostPosted: Sun Apr 08, 2012 11:13 pm 
Registered User
Offline

Joined: Fri Feb 24, 2012 1:20 pm
Posts: 57
Hello, hello!

I want to do something very simple, same as it is done in the documentation example, and have no idea why it is not working..

It is about simple menu (list and css), which I saved as a snippet, and all works well except that I cannot get the the CSS style for the active link/page to work. And class="active" style is supposed only to change background color, nothing else….

I started with using exactly the same code from Aurelius page, which goes like this:

<li >
<a href="<cms:link 'index.php' />">
<cms:if k_page_name=='index.php'>class="active"</cms:if>
<span class="bold">Home</span></a>
</li>



Would appreciate a lot an explanation, what do I do wrong....

thanks in advance

Tanja


Last edited by tanja on Mon Apr 09, 2012 4:24 am, edited 2 times in total.

Top
 Profile  
 

Re: trouble with css style
PostPosted: Mon Apr 09, 2012 12:41 am 
Moderator
Offline

Joined: Wed Dec 01, 2010 5:35 pm
Posts: 1395
Hi Tanja,

Following is the code used in the tutorial (snippets/header.html):
Code:
<li>
   <a href="<cms:link 'contact.php' />" <cms:if k_template_name=='contact.php'>class="current"</cms:if> >
      <span class="meta">Get in touch</span><br />Contact Us
   </a>
</li>

I think you should test against 'k_template_name' (as in the snippet above) instead of 'k_page_name'.

Please use the code above and let me know if you still run into the same problem.

Thanks


Top
 Profile  
 

Re: trouble with css style
PostPosted: Mon Apr 09, 2012 3:52 am 
Registered User
Offline

Joined: Fri Feb 24, 2012 1:20 pm
Posts: 57
Hello KK!

thanks for your great support!

for some to me unknown reason, it won´t work with this original code, that also you have quoted above, even when I choose k_template_name...

BUT, it is working with k_template_name for producing a css class name that i need

<li >
<a href="<cms:link 'index.php' />" class="<cms:if k_template_name=='index.php'>aktiv</cms:if>">
Home
</a>
</li>

thanks again!

tanja


Top
 Profile  
 

Re: trouble with css style
PostPosted: Mon Apr 09, 2012 4:20 am 
Registered User
Offline

Joined: Fri Feb 24, 2012 1:20 pm
Posts: 57
I just wanted to add, that also first code you have posted works ....

I have just realized that I have messed up the code quiet a lot initially, and started to believe that this part
<cms:if k_template_name=='contact.php'>class="current"</cms:if>
comes outside of <A> tag :oops:


Top
 Profile  
 

Re: trouble with css style
PostPosted: Mon Apr 09, 2012 2:47 pm 
Moderator
Offline

Joined: Wed Dec 01, 2010 5:35 pm
Posts: 1395
I am glad you managed to get it working :)
All those nested tags do make it a little confusing to look at.
I personally find that editors like Notepad++ that highlight the tag pairs when you click on any are very handy in navigating through unfamiliar code.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 5:30 hours


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© 2001-2010 SYS-Solutions All Rights Reserved