WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: Boudi on April 03, 2008, 02:08:58 PM

Title: Multilanguage site: submenu dissapears after search #SOLVED#
Post by: Boudi on April 03, 2008, 02:08:58 PM
Hi,

At this moment I'm working on the allcss2 template with multilanguage. All things are fine.

But when I do a search the whole menu dissapears.

I checked the forum and discovered that this is a known issue. On this page there seems to be a solution: http://projects.WebsiteBaker.org/websitebaker2/ticket/327 (http://projects.WebsiteBaker.org/websitebaker2/ticket/327)

After reading this ticket I do not know what to do. I see 2 files, but do I have to replace them??

Besides that the same thing happens when using a multiple menu and after login via the front-end.

Any help would be appriciated. ThnQ.

Knert
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: kweitzel on April 04, 2008, 12:59:07 AM
A DIFF File is a file containing ONLY the changes, so replacing will not help. Use a Tool like WinDiff (http://www.grigsoft.com/download-windiff.htm) to merge the diff file into the original files.

cheers

Klaus
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: Boudi on April 04, 2008, 01:49:13 PM
Thank you Klaus. I did not know that.

Unfortunately the solution does not work for me.

I have WB 2.6.7
Template: ALLCSS2
mod: Multilanguage

The menu still disapears when doing a search on a multilanguage template with show_menu2.

Any help would be highly appreciated. This is a huge project with a deadline.
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: kweitzel on April 04, 2008, 04:46:34 PM
Then please test WB 2.7 (RC2) if it works fine, as far as I know, this is included.

cheers

Klaus
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: Boudi on April 06, 2008, 06:11:35 PM
Thank you Klaus,

Unfortenately the upgrade does not solve the problem either.

The only thing left I can do now is a fresh install but that means LOTS of extra work. And even then I still don't know if it will work well :(
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: Boudi on April 07, 2008, 02:06:04 PM
Unfortenately WB 2.7 does the same thing...the menu dissapears.

What I did:

- downloaded WB 2.7
- a clean install
- installed ALLCSS2 template
- installed show_menu2
- made it multilanguage by following the steps as mentioned in the link below.
http://help.WebsiteBaker.org/pages/en/advanced-docu/designer-guide/multilingual-websites.php (http://help.WebsiteBaker.org/pages/en/advanced-docu/designer-guide/multilingual-websites.php)

What happens:

After a search the menu dissapears.

After some testing It seems like it's the known root problem again. Because of the multilanguage there must be some editing in the show_menu2 parameters to hide the root. Because of the root hiding the menu dissapears after doing a search. I recently checked a website http://www.trekwerk.com (http://www.trekwerk.com) that does handle this issue.

So I think I do something wrong in the paramaters of the show_menu2

flags:
Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_STARTtrue" [a]<img src=" .WB_URL .  "/media/flags/[menu_title].gif border=0 />[/a] ", &#39;&#39;, &#39;&#39;, &#39;&#39;, false, &#39;&#39;, 0); ?>
menu:
Code: [Select]
<?php show_menu2(0SM2_ROOT+1SM2_ALLSM2_ALL|SM2_CURRTREEfalse"\n</li>"falsefalsefalse, &#39;<ul id="header_menu" class="menu">&#39;); ?>
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: ruebenwurzel on April 07, 2008, 02:11:19 PM
Hello,

Have you tried the latest version of show_menu2? On Addons page there is version 4.41 available.

Matthias
Title: Re: Multilanguage website: menu dissapears after search and multimenu
Post by: Boudi on April 07, 2008, 02:32:36 PM
Yes Matthias,

I downloaded it and it gave me the same result, the menu dissapears.

I would like to learn from the mistake I make why it's not working for me.

I think I'm pretty sure that I did something wrong with the show_menu2 param's in my previous message.

#Update#

After some backyard screaming and strong coffee I checked the code again and deleted SM2_ROOT in the show_menu2.

Now it works like a charm!

Thank you for your time and answers.
Title: Re: Multilanguage website: menu dissapears after search and multimenu #NOT solved#
Post by: Boudi on April 08, 2008, 05:15:49 PM
How cruel can this world be  :cry:

Just of a sudden...my multilanguage website where I was working on does not work correctly any more.

I struggled for 3 full weeks to run a multilangual website. And now, after 3 weeks, spending more than 150 hours I'm back to where the problem began.

The problem that I'm running into constantly is the simple fact that when I do a search the submenu dissapears.

I did everything you can think of. Did a fresh install with WB 2.7, read the help page for multilanguage website thousands of times, entered just every show_menu2 combination that I could think of, checked the help in the forum, checked numberous templates and more....but still no luck.

Now, it's clear for me that i'm not able to solve this issue any more by myself. Can anyone please finish my suffering and spend some time to help me with this neverending story? When needed url + login is available in pm.

I think the problem is in the show_menu2:

Code: [Select]
<?php show_menu2(0SM2_ROOT+1SM2_ALLSM2_ALL|SM2_CURRTREEfalse"\n</li>"falsefalsefalse, &#39;<ul id="header_menu" class="menu">&#39;); ?>
PLease help. Thank you.  :oops:
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 10, 2008, 01:39:48 PM
A few days further, still no luck. I ran out of options.

Still the same problem: On a multilanguage website when doing a search the submenu dissapears.

I checked the doc http://code.jellycan.com/files/show_menu2-README.txt (http://code.jellycan.com/files/show_menu2-README.txt) from the show_menu2 and came out with a code that seems to me the most logic one:

Code: [Select]
<?php show_menu2(0SM2_ROOT+1SM2_CURRSM2_ALL|SM2_CURRTREEfalse); ?>
(sm2_root+1 = starting 1 level beneath the root | sm2_curr = starts with the current page level | sm2_all = all levels are displayed | sm2_currtree = leave out the other menus from the other languages)

My question to ANYONE who can give me the solution or has made a successfull multilanguage website with a good working search function: can you please share the show_menu2 code or help me get rid of the things I do wrong?

I'm working on this for a few weeks now and I would like to go further with the build of the website and the deadline of it.

Thank you

Sincerly
Knert

Title: Re: Multilanguage site: submenu dissapears after search
Post by: doc on April 10, 2008, 08:10:50 PM
Hello,

you may want to try remarking line 30 in /search/index.php (only WB 2.7 or WB 2.6.x with error reporting disabled).
Code: [Select]
//$page_id = 0;
Some WB features or modules may not work as expected so you need to test your configuration. However for one client, this did the trick (using WB show_menu). Otherwise you need to touch some more WB core files which is not recommended.

Regards Christian
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 10, 2008, 10:03:14 PM
Hello Christian,

Thank you for your help.

I tried it but...no luck either. I did a fresh install, no extra modules installed (except sm2) and only changed the sm2 codes for the flags (for multilangual) and menu in the index.

I do not understand how this is possible. I tried it with lots of other templates too...same thing.

 :cry:

Title: Re: Multilanguage site: submenu dissapears after search
Post by: kct-networx on April 12, 2008, 11:45:50 AM
Hi KNERT,

what Christian wrote is the solution for show_menu, not for show_menu2!
Remarking the $page_id = 0 in /search/index.php solved the problem in my case (show_menu).

Regards,
Markus
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 13, 2008, 12:01:38 AM
Hello Markus,

Thanks for notifying.

My problem is still there. Help would be highly appreciated.
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 14, 2008, 08:59:17 PM
Hi,
Someone on this forum came up with a possibillity that may be my server (which is a professional hosting company) is not configured well in order to let the multilanguage website run well. How small this chance would be, I'd considered it so I asked a friend who owns a internet designcompany If I could use a piece of his server to test the multilanguage website.

Unfortenately it ended with the same troubles that I'm facing for over weeks and weeks now.

Is there someone, who runs a multilanguage website, willing to share his WB template so I can test it on my server? Or at least, wants to share the show_menu2 codes that generates the flags and menu?

Thank you in advance
Knert

Title: Re: Multilanguage site: submenu dissapears after search
Post by: doc on April 14, 2008, 09:26:42 PM
Hello,

this is what we are using on the multilingual WB Help project site for the left navigation menu:
Code: [Select]
<?php 
show_menu2
(0SM2_ROOT+1SM2_START+1SM2_TRIM|SM2_PRETTY, &#39;<li><a &#39; ."[if(class=menu-current){class=\"menu_current\" }]" .&#39;href="[url]" target="[target]">[menu_title]</a>&#39;, "</li>", "<ul>","</ul>", false, &#39;<ul>&#39;); 
?>

Regards Christian
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 15, 2008, 08:26:54 PM
Thank you Christian,

But what I see now in the HELP section is exact the same thing as my problem: choose a language, watch the menu on the left, do a search and the menu dissapears. And that's my issue all this time. I would like the menu to stay intact when I do a search.

Sincerley
Knert.
Title: Re: Multilanguage site: submenu dissapears after search
Post by: doc on April 15, 2008, 08:53:11 PM
Hello,

uups you are right, forgot that we have switched to show_menu2.

You can write a feature request in the Code Snippets thread (search for show_menu2) or you could send a PM to brofield, the author of show_menu2 and ask if he can provide a fix for the page_id == 0 problem coming along with the WB search feature.

Regards Christian
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 15, 2008, 09:39:59 PM
So after all it was not my fault  :roll:

I sent Brofield a PM. I hope he is able to fix this issue.

When there's a fix I'll let it know.

Sincerley
Knert
Title: Re: Multilanguage site: submenu dissapears after search
Post by: brofield on April 18, 2008, 04:52:56 AM
Have you added the referrer field to the search settings page as stated here:
http://projects.WebsiteBaker.org/websitebaker2/ticket/327

1. Settings
2. Show advanced settings
3. Find the Search Settings -> Header
4. add this input field immediately following the <form> open tag
<input type="hidden" name="referrer" value="[REFERRER_ID]" />

It all works for me at sm2test. See a sample search here...
http://code.jellycan.com/sm2test/search/index.php?string=foo&submit=Search&referrer=5

There may be more to it depending on the multilanguage stuff you are doing.

Brodie
Title: Re: Multilanguage site: submenu dissapears after search
Post by: brofield on April 18, 2008, 05:20:16 AM
After doing this, try updating to this version of the sm2 include file. The changes in this revision are a test only and it may not be the real version. Basically, this uses the referrer page ID as the current page ID when we don't have a current page (i.e. after a search, the menu still considers you to be on the same page as when you started the search). Not sure if this is what is really desired though.

http://showmenu2.googlecode.com/svn-history/r11/trunk/include.php
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 18, 2008, 10:09:55 AM
Thank you Brofield for taking the time to check it out. Unfortenately the answer is: not working.

What I did:

- fresh install wb2.7
- enabled page languages in adv. settings
- enabled intro page in adv. settings
- installed SM2 4.5 mod
- installed ALLCSS2
- created the language structure
- ONLY changed 2 lines of code within the index.php of the ALLCSS2 template:

flags:
Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_STARTfalse" [a]<img src=" .WB_URL .  "/media/flags/[menu_title].gif border=0 />[/a] ", &#39;&#39;, &#39;&#39;, &#39;&#39;, false, &#39;&#39;, 0); ?>
menu:
Code: [Select]
<?php 
show_menu2
(0SM2_ROOT+1SM2_START+1SM2_TRIM|SM2_PRETTY, &#39;<li><a &#39; ."[if(class=menu-current){class=\"menu_current\" }]" .&#39;href="[url]" target="[target]">[menu_title]</a>&#39;, "</li>", "<ul>","</ul>", false, &#39;<ul>&#39;); 
?>

- implemented the : <input type="hidden" name="referrer" value="[REFERRER_ID]" />
- changed the include.php

Result: [link removed]

Sincerely,
Knert
Title: Re: Multilanguage site: submenu dissapears after search
Post by: brofield on April 18, 2008, 10:11:38 AM
So what is it supposed to be showing?
I see nothing but as far as I know, that is what I am supposed to see.
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 18, 2008, 10:12:34 AM
When you do a search, the menu is dissapearing.  :|

When you want I can pm you the logindata?
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Luckyluke on April 18, 2008, 12:01:02 PM
Hi,

I have something in common. And that in 2 cases. My site also contains 2 languages: (NL and EN).

Example how something can obtain:

1: visit www.kisstory.be
2: Select a language, English for example
3: Select guestbook
4: Select sign guestbook
5: well, here you see the menu change. Suddenly, EN or NL (Dutch) as a main menu  :?

For this test I enabled the search capabilities (I will turn it off in some days). If you are looking for something and press search then the menu disappears, only the main menu is visible. A similar case as Knert.

I have no solution for this. The search is normally turned off on my site. And I can live with the problem of the guest book, But it is not a pretty sight.
And for the record: my template doesn't use MENU2 !!!

Grtz,
Luc
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 21, 2008, 09:14:17 PM
Hello,


I have a question, Is sir Brofield still on this topic, trying to solve it?   :-)

Besides that I would like to hear from other multilanguage users if they have this problem or not.

Hope 2 hear from you  :-)

Sincerely,
Knert
Title: Re: Multilanguage site: submenu dissapears after search
Post by: brofield on April 22, 2008, 05:11:24 AM
Fixed.

In class.frontend.php, function get_page_details(), add the following line:

     // Page ID
     define('PAGE_ID', $this->page['page_id']);
+   define('REFERRER_ID', PAGE_ID);

(Note that this change isn't strictly necessary, but I feel that it is better to have it as it makes the necessary template code a little simpler. Simpler is always better. See below)

In Settings -> Show advanced settings -> Search Settings -> Header, add this input field immediately following the <form> open tag.

     <input type="hidden" name="referrer" value="[REFERRER_ID]" />

In the template, add the following input field immediately following the search <form> open tag.

     <input type="hidden" name="referrer" value="<?php echo REFERRER_ID; ?>" />

If the class.frontend.php is not modified, it can still be done with the code:

     <input type="hidden" name="referrer" value="<?php echo defined('REFERRER_ID') ? REFERRER_ID : PAGE_ID; ?>" />

Upgrade to the latest show_menu2 version 2.6

     http://code.jellycan.com/show_menu2/


NOTE: would you please test with these changes and verify for me that it is fixed (I've tested on 2.7 for multi-language sites, and 2.6.7 for a normal site).

B
Title: Re: Multilanguage site: submenu dissapears after search
Post by: Boudi on April 22, 2008, 10:43:18 AM
Hi Brofield,

First off all...thank you for taking the time to try to solve this issue. I really appreciate it!

Specs:

- WB 2.7
- Allcss2 template

I did exactly what you wrote and it works like a charm!  :lol: :lol:

The menu stays intact like It should be! Great stuff! So nice to see it works after weeks of stress  :roll:

I will now test it in combination with other mods like anynews, multiple menu's etc.
If I have results about that I will put them here right away!

Thank again for helping me (and us) out!  :-) :-)
Title: Re: Multilanguage site: submenu dissapears after search
Post by: doc on April 22, 2008, 07:09:12 PM
Hello Brofield,

tested the latest version of show_menu2 (v4.60) on an existing WB 2.6.7 multi-lingual site: http://help.WebsiteBaker.org/
Everything works as it should (also tested with WB 2.7), thanks for providing a working solution.

Have updated the show_menu2 (http://addons.WebsiteBaker.org/pages/modules/code-snippets.php) module on the addons repository with your latest version.

Thanks for your contribution.
Regards Christian
Title: Re: Multilanguage site: submenu dissapears after search #SOLVED#
Post by: gucci on May 14, 2008, 01:02:06 PM
Hallo Brofield,

I had the same problem like Knert.
Now, the menu stays intact when I click on search and the results are displayed.
But when I click on one of the results all div containers above the div container who includes the search (in index.php of my template) disappear.

I use wb 2.7 with showmenu2 (version 4.6), multilingual site.

Code: [Select]
<?php show_menu2(0SM2_ROOT+1SM2_ALLSM2_CURR+1|SM2_CURRTREEfalsefalsefalsefalsefalse, &#39;<ul id="header_menu" class="menu">&#39;); ?>
Is this a problem of my template or a showmenue2 problem?

Sincerely

gucci
Title: Re: Multilanguage site: submenu dissapears after search #SOLVED#
Post by: brofield on May 16, 2008, 12:28:54 AM
Your parameters to the function look wrong. The flags are definitely wrong.

B
Title: Re: Multilanguage site: submenu dissapears after search #SOLVED#
Post by: Ivanov on September 11, 2010, 04:35:07 PM
I found a solution that satisfy me.
I wanted to show the main navigation menu (no parents, just what the menu looks like on the home page of current language).
So if I start searching from page on English, I want on the search results page to see the menu like I am on the English home (start, root) page.
So, the solution about show_menu is:
1. Open the framework/class.frontend.php
2. Search for...
Code: [Select]
if ($this->menu_start_level>0) {
$key_array=array_keys($this->page_trail);
if (isset($key_array[$this->menu_start_level-1])) {
$real_start=$key_array[$this->menu_start_level-1];
$this->menu_parent=$real_start;
$this->menu_start_level=0;
} else {
return;
}

3. Replace it with...
Code: [Select]
if (isset($key_array[$this->menu_start_level-1])) {
$real_start=$key_array[$this->menu_start_level-1];
$this->menu_parent=$real_start;
$this->menu_start_level=0;
} else {
$get_language_root = $database->query("select `page_id` from `pages` where `parent` = '0' and `language` = '".LANGUAGE."'");
$language_root = $get_language_root->fetchRow();
$this->menu_parent = $language_root['page_id'];
$this->menu_start_level=0;
}


For show_menu2 the solution is ...
1. Open modules/show_menu2/include.php
2. Search for...
Code: [Select]
   if (count($wb->page) == 0 && defined('REFERRER_ID') && REFERRER_ID > 0) {
        global $database;
        $sql = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '".REFERRER_ID."'";
        $result = $database->query($sql);
        if ($result->numRows() == 1) {
            $wb->page = $result->fetchRow();
        }
        unset($result);
    }
3. Than replace it with...
Code: [Select]
if (count($wb->page) == 0 && ((defined('REFERRER_ID') && REFERRER_ID > 0) || PAGE_ID == 0)) {
global $database;
if(defined('REFERRER_ID') && REFERRER_ID > 0) {
$select_page_id = REFERRER_ID;
}
else {
$get_language_root = $database->query("select `page_id` from `pages` where `parent` = '0' and `language` = '".LANGUAGE."'");
$language_root = $get_language_root->fetchRow();
$select_page_id = $CURR_PAGE_ID = $language_root['page_id'];
}
$sql = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '".$select_page_id."'";
$result = $database->query($sql);
if ($result->numRows() == 1) {
$wb->page = $result->fetchRow();
}
unset($result);
    }
Title: Re: Multilanguage site: submenu dissapears after search #SOLVED#
Post by: crnogorac081 on September 11, 2010, 05:30:39 PM
looks neat, maybe to include in core ?

cheers
Title: Re: Multilanguage site: submenu dissapears after search
Post by: mr-fan on October 19, 2010, 07:49:07 PM
When you do a search, the menu is dissapearing.  :|

When you want I can pm you the logindata?

hi boudi,

was there a solution for this....i've got the same issue on a multilanguage site with more than one menu....

kind regards
martin
Title: Re: Multilanguage site: submenu dissapears after search #SOLVED#
Post by: crnogorac081 on November 16, 2010, 09:20:52 PM
I have the same issue here, using SM2 on wb.281..

I tried solutions from all posts here but still no solution...damn...