Multilanguage site: submenu dissapears after search #SOLVED#

crnogorac081

I have the same issue here, using SM2 on wb.281..

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

mr-fan

Quote from: 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?

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

crnogorac081

Web developer

Ivanov

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...

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...

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...
   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...
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);
   }

brofield

Your parameters to the function look wrong. The flags are definitely wrong.

B

gucci

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.

<?php show_menu2(0SM2_ROOT+1SM2_ALLSM2_CURR+1|SM2_CURRTREEfalsefalsefalsefalsefalse'<ul id="header_menu" class="menu">'); ?>

Is this a problem of my template or a showmenue2 problem?

Sincerely

gucci

doc

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 module on the addons repository with your latest version.

Thanks for your contribution.
Regards Christian

Boudi

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!  :-) :-)
...:: Bake the Unbakable ::...

brofield

#27
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

Boudi

#26
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
...:: Bake the Unbakable ::...

Luckyluke

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

Boudi

#24
When you do a search, the menu is dissapearing.  :|

When you want I can pm you the logindata?
...:: Bake the Unbakable ::...

brofield

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.

Boudi

#22
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:
<?php show_menu2(0SM2_ROOTSM2_STARTfalse" [a]<img src=" .WB_URL .  "/media/flags/[menu_title].gif border=0 />[/a] "''''''false''0); ?>

menu:
<?php 
show_menu2
(0SM2_ROOT+1SM2_START+1SM2_TRIM|SM2_PRETTY'<li><a ' ."[if(class=menu-current){class=\"menu_current\" }]" .'href="[url]" target="[target]">[menu_title]</a>'"</li>""<ul>","</ul>"false'<ul>'); 
?>


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

Result: [link removed]

Sincerely,
Knert
...:: Bake the Unbakable ::...

brofield

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

brofield

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

Boudi

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
...:: Bake the Unbakable ::...

doc

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

Boudi

#17
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.
...:: Bake the Unbakable ::...

doc

Hello,

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


Regards Christian

Boudi

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

...:: Bake the Unbakable ::...

Boudi

Hello Markus,

Thanks for notifying.

My problem is still there. Help would be highly appreciated.
...:: Bake the Unbakable ::...

kct-networx

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

Boudi

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:

...:: Bake the Unbakable ::...

doc

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).
//$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