wash a string like in a url

Author Message

Carlos Campderrós

Monday 07 August 2006 10:27:02 am

Hello,

I have an array of arrays for the purpose of generating the menu of my site. I'd like to add 'class="current" to all <li> that are in the path of the current page. For example, if the actual path is: http://mysite/company/about_us/carlos the menu should look like this:

<ul>
  <li><a href="foo">foo</a></li>
  <li class="current"><a href="/company">company</a>
    <ul>
      <li class="current"><a href="/company/about_us">about us</a>
         <ul>
            <li><a href="/company/about_us/someone">someone</a></li>
            <li class="current"><a href="/company/about_us/carlos">carlos/</a></li>
         </ul>
      </li>
    </ul>
    </li>
    <li><a href="/company/bar">bar</a></li>
</ul>

In the array of the menu, every item looks like this:

{def $item = hash(
   "text_to_show", "foo bar",
   "nodeID", 666
)
}

I'd like to process the menu item like this:

{if $node.url_alias|contains($item.text_to_show|SOME_OPERATOR_HERE)}
  <li class="current"><a href={fetch('content','node',hash('node_id',$item.nodeID)).url_alias|ezurl}>{$item.text_to_show</a></li>
{else}
  <li><a href={fetch('content','node',hash('node_id',$item.nodeID)).url_alias|ezurl}>{$item.text_to_show</a></li>
{/if}

Any idea about the SOME_OPERATOR_HERE?

thanks

Carlos Campderrós

Monday 07 August 2006 1:17:53 pm

Hi, regarding this topic, I just discovered the possibility of writing my own template operators (site_admin/setup/templateoperators) via another post in the forum. Now the next question is: which characters are allowed in eZpublish generated URLs? only [a-z0-9_]? I've performed a little test with "weird" characters:
áàä is translated into "aaa"
â is translated into "ea"
èéë is translated into "eee"
ê is translated into "e" (look difference between â and ê)

letter i behaves the same as 'e', while 'o' and 'u' do it like 'a'.

ñ and ç are translated into 'n' and 'c', respectively.

Any other characters in a Spanish keyboard seem to be discarded. Can someone please confirm this?

Marcin Drozd

Monday 07 August 2006 2:29:15 pm

Hi
recur to previous post.
U can use treemenu function with is_selected_method parameter ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/miscellaneous/treemenu )

http://ez-publish.pl

Carlos Campderrós

Tuesday 08 August 2006 10:25:50 am

I saw treemenu first, but it didn't accomplish the requirements, as, for example, I have some nodes of class "Article" that should be shown, and some that shouldn't be shown. Unfortunately I think this can't be done with treemenu, nor can be done a treemenu of only some nodes ID (not classes ID).

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.