[SOLVED] Making independant menu.

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

[SOLVED] Making independant menu.

Post by gemini »

Hi there, new here, so be gentle..  :D

what I'm trying to do is to make 3 menus on my site.
The problem is, that i cant manage to make 1 menu completely independant as this menu should be visible ONLY for registered and logged in users. I tried to make menu system using Menu Manager based on site hierarchy but i failed: when i click link on user-only menu, it's children appear on 2nd level submenu, what i don't want to happen ( I want 2nd level submenu to show parent children all the time).. Any suggestions? This is pretty urgent :)
Last edited by gemini on Sat Nov 22, 2008 1:08 pm, edited 1 time in total.
Pierre M.

Re: Making independant menu.

Post by Pierre M. »

Hello,

it is not easy to be gentle when you don't make us feel you have read the documentation or searched the forum enough.
You don't even speak of FrontEnd Users and Custome Content.
If you are in a hurry you should take some time to build precise questions to get good answers quickly.

Pierre M.
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

I think it is obviuos, that i'm talking about FrontEndUsers and Custom Content, because i was talking about showing independent menu for registered user, unless there is another module, allowing to show custom content for registered user. This part is clear for me. The question was about menu, isnt it?:) I've searched forum, google, and tutorials, but couldnt manage to find what i need.And it seems, that i'm not the one.. Proof here: http://lists.cmsmadesimple.org/pipermail/cmsms-dev/2008-January/000023.html. I've read posting rules as well and i think, that i've formulated my question quite well as there is no use of posting a chunk of code for me, cuz there just has to be some way to get out of this? Pretty clear question and pretty clear answer expected, if there is one.. :)

Regards,
Arturas Bajoriunas
Pierre M.

Re: Making independant menu.

Post by Pierre M. »

OK, I'm moving (again) the thread. To "modules" this time because of Menu Manager, FEU and CC.

If I understand well your first post, you want a menu only appear to registred users. And you know Menu Manager.
If I understand well your second post, you know FEU, CC and searching the forum and the documentation.

So... have you tried to put the special {menu ...} call inside a {if cc loggedin() ...} ? (much seen in the forum and the video tutorial)
The link to the list you give makes me wonder if you are speaking of something else.

Pierre M.
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

I'm using that..

Code: Select all

{ if $ccuser->loggedin() }
 { cms_module module=FrontEndUsers action = "viewuser"}

{menu template='user_menu' start_level="3"} {cms_module module=FrontEndUsers form=logout }
{else}
{ cms_module module=FrontEndUsers form = login}
User menu is almost completely the same as default simple_navigation.tpl

My pages hierarchy is smth like that:

1. My mothers tongue language
  1.1. about us..
    1.1.1  hystory..
    1.1.2  technique..
    ...
  1.2. contact us..
  1.6. User menu (as internal link, but not shown anywhere)
    1.6.1.  Flight order..
    1.6.2.  Club rules..
2. English
{the same in english}

1, 2 used to switch site language, 1.1., 1.2., .. used for main menu, third level for sub menu. The problem is, that User menu is also in third menu. That gives logical issues. If this could be described like that.
Zoorlat

Re: Making independant menu.

Post by Zoorlat »

Sounds like you perhaps want to use the menu parameter start_element or start_page in your loggedin menu. These parameters force the menu to only show a specific part of your page hierarchy. This way you avoid the "logic issues" you mention. Here as described in the menu manager help section:
start_element="1.2" - Starts the menu displaying at the given start_element and showing that element and it's children only. Takes a hierarchy position (e.g. 5.1.2).
So, applied to your example:

Code: Select all

{ if $ccuser->loggedin() }
 { cms_module module=FrontEndUsers action = "viewuser"}

{menu template='user_menu' start_element="1.6"} {cms_module module=FrontEndUsers form=logout }
{else}
{ cms_module module=FrontEndUsers form = login}
You might also want to take a look at the parameters excludeprefix/includeprefix. Both very useful for custom menus.

Hope this helps!
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

Thats' ALMOST the same, what i did with start_level. But i think you just don't understand me, guys, Sorry if I'm not that good describing my problem. I'll try again. First level menu (language switching) works fine. Second level menu (horizontal main menu) works fine as well. I excluded (vertical  User menu) branch from it and it's cristal. The problem is between user menu, and third level menu (horizontal Sub menu). Eg. I come to site. I see horizontal menu About us, gallery, contacts, etc, and horizontal menu (which is childrens of About us atm.) Hystory, Members, etc.. I log in, and i see User menu as well. All menus are fine, untill i click one of the User menu items. Then what happens is that Sub menu  is completely replaced with User menu. I want Sub menu to stay being childrens of Main menu all the time. Thats, what I mean telling, that i want INDEPENDANT user menu.  Hope I explained well and expecting an answer.

Regards,
Arturas Bajoriunas.
Zoorlat

Re: Making independant menu.

Post by Zoorlat »

Thats' ALMOST the same, what i did with start_level.
The difference is that it will make the user menu independent from which page the visitor happens to be on. Otherwise the user menu will change if you go to a different third level page.
I want Sub menu to stay being childrens of Main menu all the time.
Add start_level=2 and number_of_levels=1 to your sub menu.

However, if I understand you correctly, you want the menu to function in a way that if a user is on eg "1.1.1  hystory" and clicks on a page in the user menu (say she clicks on "1.6.2.  Club rules"), then the sub menu should remain that for 1.1.
Is this what you want?

I believe this would be a bit tricky. The menu won't know from where in the hierarchy (eg 1.1.1) you left when moving to the new place in the hierarchy (1.6.x). Actually, if this is what you want, you don't really want the user pages to be part of the page hierarchy, but rather be some sort of extra content block/global content that doesn't interfere with the hierarchy of other pages. Perhaps you want to rethink the way you implement your user-only-pages. Perhaps the content dump plugin (http://dev.cmsmadesimple.org/projects/contentdump) could be helpful for you.

Otherwise, a simple solution would be to just hide the sub menu when on a user only page.
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

Zoorlat wrote: However, if I understand you correctly, you want the menu to function in a way that if a user is on eg "1.1.1  hystory" and clicks on a page in the user menu (say she clicks on "1.6.2.  Club rules"), then the sub menu should remain that for 1.1.
Is this what you want?

I believe this would be a bit tricky. The menu won't know from where in the hierarchy (eg 1.1.1) you left when moving to the new place in the hierarchy (1.6.x). Actually, if this is what you want, you don't really want the user pages to be part of the page hierarchy, but rather be some sort of extra content block/global content that doesn't interfere with the hierarchy of other pages. Perhaps you want to rethink the way you implement your user-only-pages. Perhaps the content dump plugin (http://dev.cmsmadesimple.org/projects/contentdump) could be helpful for you.

Otherwise, a simple solution would be to just hide the sub menu when on a user only page.
Atlast somebody understood me. I realy dont want user pages to be part of the page hierarchy, but i just can't think of any way implementing those pages the way i want.. Thats exactly, what i want. Going to see, what content dump can offer to me..
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

Content dump not the stuff i need.. Any thoughts still expected.
Zoorlat

Re: Making independant menu.

Post by Zoorlat »

Are you sure? I believe you should be able to do what you want with content_dump. Only need some work and thinking.

For starter, you would need to change the menu template used in your user menu. You would need to tweak it so that the links in that menu send a smart-variable with the page-id to the current page, instead of linking to a new page. You also need to add some smarty to your template(s) that replaces the normal content block with the content_dump specified by the user menu, if this variable is sent.

Logic in this way (not proper syntax):

Code: Select all

if not user-menu-variable
   {content}

if user-menu-variable
   {foreach from=$dump item=dump}
      {if $dump->content->id == $user-menu-variable}
      {$dump->content->data}
   {/foreach}
 
All this might sound a bit complicated, but it should work. Alternatively you need to create the user-only content in a different way than as pages in the hierarchy. News with a specific category would work. Or a tweaked company directory. Etc.
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

Ok, I could try, but how to use that module? its plain php file, how to install that stuff?
nhaack

Re: Making independant menu.

Post by nhaack »

Hi Gemini,

just copy the php file into your plug-ins folder... no installation procedure required. Afterwards you can place the tag into your template. make sure to check the help page or the wiki page as they list all parameters and output options as well as some helpfull smarty snippets.

But as Zoorlat said already, you need to think properly on how to use the logic. Content-Dump allows you to get mostly anything from one or more pages to any other place in the CMS. When I am home tonight I'll try to post something more specific.

You bascially have to encapsule the smarty logic and the page content in the custom content logic so it won't show to unregistered users. With content Dump you then drag that content right into the place where you want to have it...

Best
Nils
User avatar
gemini
Forum Members
Forum Members
Posts: 19
Joined: Mon Nov 17, 2008 4:17 pm

Re: Making independant menu.

Post by gemini »

nhaak: still waiting for replay :) promise is promise. trying to understand content dump here, cuz i feel, that it's powerful tool.
nhaack

Re: Making independant menu.

Post by nhaack »

true... let me quickly recap what you wanted:

First level navigation is language selection,

Second and Third Level is regular content except for last second level navigation which is completely for logged in users (1.6 and below). In the following I refer those pages that are meant to be accessible by logged in users as "the pages".

Now we need to think about what we want and what possibilities we have. You will most likely have wrapped up your pages content in "custom content", so even when you page is called by a visitor (not authenticated) or bot directly, it will not show the real deal.

To solve this issue with content_dump I would do the following:

#0 - Create the pages somewhere. They are set to do not show in menu, content is protected with "custom content". Having them set to "show in menu = false" allows us to not hassle about thw pages appearing in the regular menu,

#1 - Let's assume "1.6. User menu" has the content_id "45".

#2 - Create such a call somewhere in the beginning of your template.

Code: Select all


{content_dump start_id=45 exclude=45 parents=true first_sort="hierarchy" show_in_meu="force"}

#3 - Place User menu somewhere

Code: Select all


  <ul id="menu">

    <li class="menu_title">
          {$dump[0]->parents->title}
    </li>

  {foreach from=$dump item=dump}

     <li class="menu_entry">
       <a href="index.php?page={$dump->content->alias}" title="{$dump->content->title}" rel="nofollow">
          {$dump->content->title}
       </a>
     </li>

  {/foreach}

  </ul>

This will generate an unordered list with the first item being the name of your section header (just text) and as many list items as you have pages in this content branch with a link to them. If you use URL rewriting, change page target accordingly to avoid duplicated content in search engines. You can style the design with CSS accordingly. For your other language branch, you need to change the start_id. 

Nest this code into a "custom content" element and this navigation will only be shown to logged in users. However, I do not see why it shouldn't be possible to do with menu manager and some smarty. But anyway... this way it doesn't matter where you store your special pages, just set the start_id to the content branch you want to get. In your case, exclude this id since it doesn't return content (less stuff to handle for content dump).

This should allow you to create an independent small user menu.

But afterall, I would build it with the menu manager I think as Zoorlat suggested at the beginning... for the regular menu exclude the user menu branch and in a custom content tag create a menu for the user-menu only. With smarty you can control which version to show for which country and such - the combination is very powerfull but it takes some time to understand. However, I would have to look deeper into menu manager for that... but I am currently busy with some other plug-in and want to have that done.

And no offence...  but in your first post you mentioned urgency... and, that was my impression from the following posts as well, that you haven't made yourself really familiar with the system. In such cases, it is always bad to conduct urgent projects if you haven't already, get your self a second installation as a playground and play play play... ;)

it may be just because english not the native language of me as well, so again, no offence ;D

It also helps when you post your relevant template snippets (please clean them first), exact module and core versions and things you have already tried. The later is not to prove that you have spent enough hours to earn help but to help us to see what works and what doesn't as well as what solutions fit your environment.

Be precise and do not expect people to guess even though it may be obvious. But anyway. If you keep this in mind you will get great help rather quick from this forum.

Welcome to CMS Made Simple

Best
Nils
Post Reply

Return to “Modules/Add-Ons”