Active state in category listing possible?
Posted: 11 July 2008 12:57 AM   [ Ignore ]  
Summer Student
Total Posts:  18
Joined  04-19-2008

HI,

I have a dynamic rendered submenu in which a list of categories from a specific weblog.
Now I want to highlight the category link on the page I have navigated to. I mean; on the page itself I do not want to have the caregory link which belongs to this page to have the same markup. Is this possible?

thanks, Steven.

Profile
 
 
Posted: 11 July 2008 01:18 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15379
Joined  05-15-2004

You’ll probably want to use a conditional together with URL segments.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 11 July 2008 01:27 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  18
Joined  04-19-2008

Hi,

I have tried that but then all of my categories links are affected.
See the code:

{exp:weblog:categories weblog="portfolio" style="linear" show_empty="no"}
{if
"{category_name}" == "{segment_4}"}
<h2>{category_name}</h2>
{if:else}
<p><a href="{path=portfolio/photos}">{category_name}</a></p>
{/if}
{
/exp:weblog:categories}

Profile
 
 
Posted: 11 July 2008 06:06 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2411
Joined  12-06-2002

Try

{if category_name == segment_4}

instead.

 Signature 

Sign up for Southern Fried ExpressionEngine - a 4-day EE class in San Antonio, TX starting on January 20th.

Profile
 
 
Posted: 11 July 2008 07:44 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  18
Joined  04-19-2008

Hi Michael,

that does’nt work either. Whe I use {category_name} nothing changes at all. When I hardcode the category name, that is:

{if "archive" == segment_4}

for example the whole list is affected with the style (ofcourse),

Steven

Profile
 
 
Posted: 11 July 2008 07:49 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2411
Joined  12-06-2002

Oh - sorry.  You should be looking at {category_url_title} instead as that’s what will appear in the URL.

{if segment_4==category_url_title}

I should have caught that the first time around, sorry…;)

And not sure if it’ll make a difference but try flipping your conditional around to the order I’ve shown.

 Signature 

Sign up for Southern Fried ExpressionEngine - a 4-day EE class in San Antonio, TX starting on January 20th.

Profile
 
 
Posted: 11 July 2008 07:53 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  18
Joined  04-19-2008

Michael,

excellent!! that works!
thanks a lot,

Steven.

Profile
 
 
Posted: 11 July 2008 11:16 AM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2411
Joined  12-06-2002

Cool - glad to hear it.

 Signature 

Sign up for Southern Fried ExpressionEngine - a 4-day EE class in San Antonio, TX starting on January 20th.

Profile
 
 
Posted: 23 July 2008 01:43 PM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  18
Joined  04-19-2008

Hi Michael,

another related question:
the highlighting works well if I can tell in what segement I am in. But:... If I am on a detail (or comments) page I can’t use this segment statement. How can achieve the same here? You must know the answer…(??)
(i have asked similar to Ingmar on another of my posts, sorry..)

Steven.

Profile
 
 
Posted: 25 July 2008 02:51 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  18
Joined  04-19-2008

Michael,

I read about the related_categories_mode for showing -well- related category items on a single entry page. But how about when you want to show images from the gallery using the related entries tag?

<div class="overview">
<
ul class="normal">
<
li class="colspan">Random entries</li>
{exp:weblog:entries related_categories_mode="on" limit="4"}
<li>
<
a href="{url_title_path=portfolio/detail}">
{related_entries id="image1_portfolio"}
<img src="{thumb_url}" width="{thumb_width}" height="{thumb_height}" border="0" alt="{title}" title="{title}">
{/related_entries}
</a>
</
li>
{/exp:weblog:entries}
</ul>
</
div>

That does not work. Is there a way to do this? THANKS!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64933 Total Logged-in Users: 52
Total Topics: 81900 Total Anonymous Users: 30
Total Replies: 440260 Total Guests: 265
Total Posts: 522160    
Members ( View Memberlist )
Newest Members:  Kathryn DaviesPetrovichusharurblaisdellLevagstudioigotthelemonmileswkakiharaAurels