Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Getting current Page Name View modes: 
User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 5/31/2011 10:35:10 PM
   
Getting current Page Name
Hi there,

This is a bit tricky..
I created a navigation using repeater (because i wanted the navigation icons to pass custom information through the address bar -Please let me know if there's a better way to achieve it. )

Anyway, so here's how my repeater shows links,

<td class="TabControl">
<a id="NavIcon_<%# Eval("MenuItemID") %>" class="MainNavLink" href="../LeftMenu/<%# Eval("URLName") %>.aspx?<%# Eval("URLName") %>=Yes"><%# Eval("MenuItemName") %></a>
</td>


Now i wanted to add a feature of highlighting the menuItem when its clicked.
So i added some pseudo elements (a:active or a:focus etc) but it doesnt seem to work because the page gets refreshed as soon as its clicked.

So now i was trying to implement javascript which could add a classname depending on what page im on.

Any thoughts or suggestions about how can i achieve it please..
cheers
Varinder

User avatar
Certified Developer 9
Certified Developer 9
charbf - 6/1/2011 7:24:38 AM
   
RE:Getting current Page Name
Hi Varinder,

I had to do some thing similar with a Menu

I used a Repeater webpart to create a custom menu

In the webpart definition I have set the following properties

Collumns = *, case when '{%currentdocument.nodealiaspath%}' like NodeAliasPath + '%' then 1 else 0 end isHighlighted

This one gives me a collumn that tell me if the current menu item should be hilighted.

in the where condition = DocumentMenuItemHideInNavigation = 0

This filter out any menu items that should not be presented in navigation


<li class="<%# ((int)Eval("isHighlighted") == 1?"CMSListMenuHighlightedLI":"") %>"><a href="<%# GetDocumentUrl() %>"><%# Eval("DocumentName") %></a>
</li>



CMSListMenuHighlightedLI can be replaced by your css class for highlighting

for the caption name I use the generic name <%# Eval("DocumentName") %> because I have multiple document types in my menu



User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/1/2011 5:25:03 PM
   
RE:Getting current Page Name
Wow it works, thanks alot mate! :)

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 6/1/2011 8:40:04 AM
   
RE:Getting current Page Name
Hello,

It depends of the nature of the information which needs to be passed through the URL but I would still recommend you to use the CSS List Menu since you don't need to manage all the "navigation stuff" like highlighting and preserving the 'Show in navigation' option. You could consider using the Menu redirection option to append the query string to a redirection URL (CMS Desk -> Content -> document Properties -> Menu). You can also parse the final HTML layout as discussed here: CSS List Menu parsing.

On the other hand you can use the Repeater web part and define transformation with the ifcompare function to determine the current item. In addition you would add the Where condition to check if the document should be displayed according to that 'Show in navigation' option.

In conclusion, it's up to you to decide which way to go.

Best regards
Ondrej Vasil