1
tatane
Multimenu : link color
  • 2008/11/28 13:09

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


hello,

in MultiMenu 1.9 ,I created a standard link as follows:
Resized Image


This gives " Messages [0] "


what I want, for example when a member receive a private message that the figure "1" is in red!
exemple : "Messages [1]"


I do not know if I was clear enough

Thank you

2
trabis
Re: Multimenu : link color
  • 2008/11/28 18:50

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


file: multiMenu/blocks/block.php
Around line 168(not sure) use this:
$title preg_replace('/{pm_new}/',     ''.$new_messages.'',     $title);//hacked line
    
$title preg_replace('/{pm_readed}/',     $old_messages,     $title); 
    
$title preg_replace('/{pm_total}/',     $som,         $title); 
    
$title preg_replace('/{user_id}/',     $user_id,         $title);

3
tatane
Re: Multimenu : link color
  • 2008/11/29 8:15

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


there is no line 168 in Multimenu / blocks / block.php!!


I want to do is: when there is an MP, the figure must be marked in red or a picture like that

Resized Image
. I wrote it

Message[<font color="red">{pm_new}font>]


but even when there is no MP is the figure in red

4
ghia
Re: Multimenu : link color
  • 2008/11/29 10:38

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
there is no line 168 in Multimenu / blocks / block.php!!
Maybe it's a different version and trabis was not sure about the exact line, but you must be able to locate the other lines of the code snippet.

5
tatane
Re: Multimenu : link color
  • 2008/11/29 11:16

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


the bloc "User Menu" of XOOPS 2.0.18.2
has this kind of system! Where there is no MP, zero is black and where there is a 1 is the message in red

I looked into this block and that's what I found:
<{if $block.new_messages0}> 
       <
class="highlight" href="<{$xoops_url}>/viewpmsg.php"><{$block.lang_inbox}> 
(<
span style="color:#ff0000; font-weight: bold;"><{$block.new_messages}>span>)a
     <{else}>       
 <
a href="<{$xoops_url}>/viewpmsg.php"><{$block.lang_inbox}>a>      
 <{/if}>



how to adapt to Multimenu or in a custom block?

6
trabis
Re: Multimenu : link color
  • 2008/11/29 12:12

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi tatane, I took the above lines from usermenu! My version of multimenu is 1.8.somethinghere.

I´m not sure if is line 168 because it is not the same version and because I also did some changes there myself.
If you could post the block.php here maybe I could find the line for you.

7
tatane
Re: Multimenu : link color
  • 2008/11/29 12:21

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1



Here is the block.php of version 1.9

/**
* XOOPS - PHP Content Management System
* Copyright (c) 2001 - 2006 
*
* Module: multiMenu 1.90
* Licence : GPL
* Authors :
*           - solo (http://www.wolfpackclan.com/wolfactory)
*            - herve (http://www.herve-thouzard.com)
*            - blueteen (http://myxoops.romanais.info)
*            - DuGris (http://www.dugris.info)
*/

global $xoopsDB$xoopsUser$xoopsConfig$xoopsModule;
$myts =& MyTextSanitizer::getInstance();
$group is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$current_page $_SERVER['SCRIPT_NAME'];
$mainid '';
$rand  '';
$randlimit '';
$columns_limit 0;
$columns_limit_drop 0;
     
$block = array();
$block['css_file'] = $xoopsConfig['theme_set'];

// Check user agent (SEO). If Spider, display list style
if ( eregi"bot",     getenv("HTTP_USER_AGENT") )     || eregi"spider",     getenv("HTTP_USER_AGENT") ) || eregi"robot",     getenv("HTTP_USER_AGENT") )     || eregi"crawler"getenv("HTTP_USER_AGENT") ) ) {
    
$block['format'] = "ul";
} else {
    
$block['format'] = $options[0];
}

// General options regarding block type
$width =                 '';
$block['marquee'] =         '';
$block['columns'] =         $options[2];
$block['block_size'] =         $options[8];
$block['marquee_height'] =     $options[9];
$block['submenu_color'] =     $options[10];
$block['latency'] =         $options[11];
$block['marquee_delay'] =     $options[12];
$block['mm'] =                 $options[15];

if     (
$options[1] != "all" )     {$where "hide = 1 AND submenu = ".$options[1]."";} else {$where "hide = 1";}
if     (
$options[0] == "scrollist")     {$block['marquee'] = 'behavior="scroll" direction="up"'$block['format'] = "ul";}
if     (
$options[0] == "slidelist")     {$block['marquee'] = 'behavior="slide" direction="up"'$block['format'] = "ul";}
if     (
$options[0] == "picscroll" ) {$block['marquee'] = 'behavior="scroll" direction="up"';}

if (
$options[0] == 'menu'
 
OR $options[0] == 'ul'
 
OR $options[0] == 'ol'
 
OR $options[0] == 'scrollist'
 
OR $options[0] == 'slidelist' )
{
$align 'align="absmiddle" ';} else { $align''; }

// Random function
if ($options[0] != "droplist" or $options[0] != "selectlist") {
    
$randresult $xoopsDB -> queryF"    SELECT COUNT(*) FROM " .$xoopsDB->prefix("multimenu") . $options[15] . " WHERE $where");
    list( 
$total )=$xoopsDB->fetchRow($randresult);
}

if     (
$options[13]) {
    
$randlimit $options[14];
    
$total $total-1-$randlimit;
    
$rand  rand(0,$total);
}

///////////////////////// Create Links /////////////////////////
// SQL query
$sql =     "SELECT id, pid, groups, link, submenu, title, target, imageurl, weight
        FROM "
.$xoopsDB->prefix('multimenu').$options[15]."
        WHERE 
$where
        ORDER BY "
.$options[3];

$result $xoopsDB->queryF($sql ,$randlimit ,$rand);

while ( 
$myrow $xoopsDB->fetchArray($result) ) {

    
// Group access
    
$groups explode(" ",$myrow['groups']);
    if (
count(array_intersect($group,$groups)) > 0) {

        
// Sub link Display
        
if ( $myrow['link'] ) { $link $myrow['link']; } else { $link ''; }

            if (
$options[16]) { // Contextual menu
                
if ( empty($xoopsModule) ) {
                    if ( 
$myrow['submenu'] == ) {
                        
$mainid $myrow['id'];
                    }
                } else {
                    switch (
$myrow['submenu']) {
                    case 
0:
                        if ( 
eregi"/".$xoopsModule->getVar('dirname')."/"$myrow['link'] )) {
                            
$mainid $myrow['id'];
                        }
                        break;
                    case 
3:
                        if ( 
eregi"/".$xoopsModule->getVar('dirname')."/"$myrow['link'] )) {
                            
$mainid $myrow['id'];
                        }
                        break;
                    case 
4:
                           
$mainid $myrow['id'];
                        break;
                    }
                }

                
// Test : link is sub of a main link and do we display it
                
if (  $myrow['pid'] == $mainid ) {
                    
$block['contents'][] = multimenu_makelink($options$myrow);
                }
                
// Test : link is sub of a main link and do we display it

            
} else { // Not contextual menu
                
if ( !empty($xoopsModule) && eregi"/".$xoopsModule->getVar('dirname')."/"$myrow['link'] ) && ( $myrow['submenu'] < || $myrow['submenu'] > ) ) {
                    
$mainid $myrow['id'];
                }

                
// Test : link is sub of a main link and do we display it
                
if ( $myrow['pid'] == $mainid && ( $myrow['submenu'] == ) || ( $myrow['submenu'] != ) ) {
                    
$block['contents'][] = multimenu_makelink($options$myrow);
                }
                
// Test : link is sub of a main link and do we display it

            
// end Contextual menu or Not contextual menu
    
// Groups
}

return 
$block;


?>

8
trabis
Re: Multimenu : link color
  • 2008/11/29 12:33

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


multimenu_makelink($options, $myrow);

Can you find this function for me and paste it here? Thanks!

9
tatane
Re: Multimenu : link color
  • 2008/11/29 12:42

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


sorry, I is not understood, I find this function where?

10
trabis
Re: Multimenu : link color
  • 2008/11/29 12:51

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

tatane wrote:
sorry, I is not understood, I find this function where?


I don´t know, maybe in multimenu/include/functions.php or whatever. Maybe you could point me where to download the module.

Login

Who's Online

326 user(s) are online (274 user(s) are browsing Support Forums)


Members: 0


Guests: 326


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits