For the life of me, I can't find the answer to this. I've seen it on the forum one time, but I can't find it doing numerous searches.
What I'm trying to do is create a dynamic highlighting menu for blogs. I can't figure out the code or string so that:
<li <?php if (blog_id=3) { echo " id=\"current\""; } ?>>
Does anyone remember the function that displays the blog-id? Thanks!
You forgot the dollar sign. It's $blog_id.
Hope this helps,
-drmike
Dr.Mike,
That does put me in the right direction, but I'm still stuck. I found in another thread to use <?php global $blog_id; echo $blog_id; ?>
, which will echo me the blog_id (good), but I'm having problems completing the second part of the string to say that if it outputs a certain number to apply id=current to it.
Have you changed if statement to ($blog_id=3) though?
also be careful, = should be == in an if statement , otherwise you're setting the variable ;-)
Well this is what I got:
<li<?php if ($blog_id==2) { echo " id=\"current\""; } ?>>
It still doesn't display the id="current" when I'm on blog #2.
Got it, I'm an idiot, the correct code should be:
<li<?php global $blog_id; if ($blog_id==2) { echo " id=\"current\""; } else { }; ?>>
Thanks all!
peiqinglong, thanks for posting the final working code.
I needed the exact same functionality, worked perfectly!
Cheers.