Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


if logic that figures into it  a minumum string length

Posted on 2008-11-10
Medium Priority
Last Modified: 2012-05-05

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\"" : "";
                                $url = "index.php?page=$page&amp;subpage=" . $value['link'];
                                $active = ($subpage == $value['link']) ? "class=\"active\"" : "";
                        $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'])):
                                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";
                echo "</ul>\n";

Open in new window

Question by:phillystyle123
LVL 82

Accepted Solution

hielo earned 1000 total points
ID: 22924014
<li " . ( (strlen($value['link']) < 4) ? "style=\"padding:0 2px 0 2px;\"": "").">

Open in new window


Author Closing Comment

ID: 31515163
thanks hielo! - sorry for the delay

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question