Link to home
Start Free TrialLog in
Avatar of phillystyle123
phillystyle123Flag for United States of America

asked on

if logic that figures into it a minumum string length

hi

the attached code works great -

<li " . ($value['link']=="faqs" ? "style=\"padding:0 2px 0 2px;\"": "").">

says that if the parameter is "faqs" add padding to the <li>

i'm wondering if there's a way to do this but instead of ($value['link']=="faqs"  being the parameter, some sort of miniumum string length serving as the parameter instead like:


<li " . (stringlenth<4 characters ? "style=\"padding:0 2px 0 2px;\"": "").">

function showMenu ( $menu_array, $toplevel, $page, $subpage ) {
                global $d, $ak;
                
                //Display the top level elements.
                echo "<ul>\n";
                foreach($menu_array as $key => $value):
                        if ($toplevel):
                                $url = "index.php?page=" . $value['link'];
                                $active = ($page == $value['link']) ? "class=\"active\"" : "";
                        else:
                                $url = "index.php?page=$page&amp;subpage=" . $value['link'];
                                $active = ($subpage == $value['link']) ? "class=\"active\"" : "";
                        endif;
                        $target = menus::getTarget($value['target'], $url);
 
                        //If user is logged in, change login page link to read logout
                        if (count($_SESSION['clientuser']) && strcmp(strtolower($value['link']), 'sign_in') == 0)
                                $value['title'] = 'Logout';
 
                        //Do not show item if it is restricted in access and user is not logged in.
                        if ($value['restricted'] && !count($_SESSION['clientuser'])):
                        else:
                                echo "\t<li " . ($value['link']=="faqs" ? "style=\"padding:0 2px 0 2px;\"": "")."><a href=\"" . menus::checksef($url) . "\" $target $active tabindex=\"" . $ak->tabindex($key) . "\">". $value['title'] ."</a></li>\n";
                        endif;
                endforeach;
                echo "</ul>\n";
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of phillystyle123

ASKER

thanks hielo! - sorry for the delay