showing where users are

Posted on 2008-11-08
Last Modified: 2013-12-13
im trying to show where users are on my forum.. just like this

*   PHP Freaks Forums > * PHP Coding >  * PHP Help >  * Start new topic

and i want it to be in just 1 file... so far i have this

<a href="">runningprofiles forums</a> > <?php echo $forum; ?> > topic

with the topic i only want the link to show if they are on certain pages in my website.. so here are a few following examples


could i make an if statement to somehow check if the user is viewing that page
Question by:runnerjp
    LVL 39

    Expert Comment

    by:Roger Baklund
    I'm not sure if I understand, but something like this:

    $page = $_REQUEST['page'];
    $forumpages = array('message','post','reply');
      $forum = '<a href="/members/index.php?page='.$page.'">'.$page.'</a>';
    else $forum = '';

    ...and then use the $forum variable like in your example above.

    Author Comment

    ok i did something like this..

    $show = array('message','post','reply');
    if(in_array($_GET['page'],$show)) {
        echo 'foo';

    but cant i do something like

    if($_GET['page']= post) {
        echo 'foo';
    elseif($_GET['page']= message) {
        echo 'bar';
    LVL 39

    Expert Comment

    by:Roger Baklund
    Yes... but you must use quotes and double ==:

    if($_GET['page'] == 'post')

    What about this:
    $show = array(
      'message' => 'bar',
      'post' => 'foo',
      'reply' => 'foobar'
    if(in_array($_GET['page'],array_keys($show))) {
      echo $show[ $_GET['page'] ];

    Open in new window


    Author Comment

    that works great... could i add something like  'message' => '$messageid'

    so that the message title would come up?

    LVL 39

    Accepted Solution

    Yes, but then you would NOT use the single quotes, because $messageid is a variable: 'message' => $messageid

    This only works if the $messageid variable contains the title... :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    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 is …
    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 dynamically set the form action using jQuery.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now