0

I'd like to ask for a little help with this. I'll need your help with this part of code. I can't find a mistake in:

if ( (!isset($menuitem['url'])) && (isset($menuitem['tab'])) ) {
    define ("'#'.$menuitem['tab']", "'?pg=overview&table='.$menuitem['tab']");
    $menuitem['url'] = '#'.$menuitem['tab'];
}

whole code is here (same error at the bottom): http://codepad.org/tv2rHHwK

Thank you very much for your help.

The hash in url adress is necessary for me, please try to keep it on its place.

YTRaza

rici
  • 234,347
  • 28
  • 237
  • 341
YTRaza
  • 1
  • 3
  • You are mashing string concatenation and interpolation. See also [Reference - What does this error mean in PHP?](http://stackoverflow.com/q/12769982) and [PHP Parse/Syntax Errors; and How to solve them?](http://stackoverflow.com/q/18050071). Using [`define()`](http://php.net/define) for declaring a constant with leading `#` hash makes no sense there. You can't read that out afterwards easily. Just assign the url parameter string right away. – mario Jun 02 '15 at 14:41
  • Thank you for your reply, could you help me , what should I use instead of define()? Thank you very much – YTRaza Jun 02 '15 at 14:44
  • Just remove all *double* quotes `"` around the arguments in the `define(…)` call. -- (But again, I doubt this will help you much. Unless your code somewhere else unpacks the URL value using `constant("#$foobar")` this is unlikely to be useful. You haven't given enough code context for detailed advise.) – mario Jun 02 '15 at 14:47
  • Ok, I did this: define ("#.$menuitem['tab']", "?pg=overview&table=.$menuitem['tab']"); but still the same problem :( – YTRaza Jun 02 '15 at 14:54
  • Ok, I just need to get this url "?pg=overview&table=.$menuitem['tab']" into this form: "#.$menuitem['tab']". I need to work with another script, that needs to work with urls strating with # character. So, is there any another solution except define()? I'm a novice in PHP programming. Thx for your patience. – YTRaza Jun 02 '15 at 14:59
  • The whole CMS with all scripts is here: http://filipcz.ideatech.cz/chervo.zip – YTRaza Jun 02 '15 at 15:01
  • Now that's the opposite of what I told you. Remove double quotes, leave in single quotes. (Please follow the two links. Thanks.) -- You haven't explained how the second script is supposed to make the connection between #$menuitem and the temporarily kept urls. – mario Jun 02 '15 at 15:03
  • Well, I'm really sorry for confusions in my previous reply. After removing all double quotes, the script is now working. Thank you very much mario. – YTRaza Jun 02 '15 at 15:04

0 Answers0