Jump to content

j.taylor

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by j.taylor

  1. The variable in question contains the full url of the referring page. I was trying to determine if the string contained within that variable was a url from my own domain or was from another site. (=/= was shorthand for "does not equal"). I've done some more work and it now works perfectly. The only trouble now is that code seems horribly bloated. I've went from two lines of code in my very first menu to 9 lines in the code I posted earlier and now to this crazyness: <?php if(strstr($link,'oceandots') && (isset($sub))){ echo "<div id=\"menu_large\">\n"; echo "<ul>\n"; gmv_menu(); echo "<li><a href=\"$link\">$place</a> > </li>\n"; echo "<li>location map</li>\n"; echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; } elseif (strstr($link,'oceandots') && (is_null($sub))){ echo "<div id=\"menu_large\">\n"; echo "<ul>\n"; gmv_menu(); echo "<li>location map</li>\n"; echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; } elseif(strstr($link,'oceandots') === false && (isset($sub))){ echo "<div id=\"menu_large\">\n"; echo "<ul>\n"; echo "<li>$place ></li>\n"; echo "<li>location map</li>\n"; echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; } elseif(strstr($link,'oceandots') === false && (is_null($sub))){ echo "<div id=\"menu_large\">\n"; echo "<ul>\n"; echo "<li>$place ></li>\n"; echo "<li>location map</li>\n"; echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; } ?> As I said at the top, this works and the problem I had no longer exists. But I can't help but feel I've taken an awfully long-winded approach to do something relatively straightforward.
  2. Almost working. Cool, thanks. I can get it to work if $variable = "the URL of the page that called the map page". However, since $variable is just $_SERVER['HTTP_REFERER'] I'm wondering if I can make make it work when $varible =/= "my domain"? You can see the problem here - note that the second item in the menu is "forums" (that comes from the directory that this forum page resides in and not from my site), which is why I'm looking to just print out the map title instead. Same story with the third menu item.
  3. I have a menu that looks something like this: <div id="menu"> <ul> <?php gmv_menu(); ?> <?php if (isset($sub)) { echo "<li><a href=\"$link\">$location</a> > </li>\n"; echo "<li>map</li>\n"; } else { echo "<li>map</li>\n"; } ?> </ul> </div> Works fine as is. What I'm trying to do also, however, is wrap the whole thing in another if-else so that none of that code gets executed if the variable $link does not contain a certain string. Everything I try results in errors or incorrectly nested code (mainly because I don't know what I'm doing). Not even sure if my current approach is the best one. As some background info: This code is part of a breadcrumb menu which kinda becomes useless when the page is linked to from another domain since it uses ['HTTP_REFERER'] to contruct part of the breadcrumb. So, when $link = "someotherdomain" I'd like to not build the breadcrumb menu and just print out the name of another variable instead. Hope that makes sense? Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.