WordPress.org

Ready to get started?Download WordPress

Forums

PHP question - Menu text based on url (4 posts)

  1. threadkiller
    Member
    Posted 9 years ago #

    What I'd like to do is get rid of the calendar and put a little bit of advertising into the menu. But what type of advertising (AdSense, small buttons to affiliate merchants, etc.) depends on what kind of page it is - what is to the right of index.php in the URL.
    - Main page (... index.php)
    - Archive (... index.php?m=200405)
    - Permanent link to any specific topic (... index.php?p=1)
    - Category postings (... index.php?cat=1)
    Suggestions?

  2. lamb
    Member
    Posted 9 years ago #

    if ((!$m) && (!$p) && (!$cat)) { do this }
    else if ($m) { do this }
    else if ($p) { do this }
    else if ($cat) { do this }

  3. threadkiller
    Member
    Posted 9 years ago #

    Cool - thanks! ( I didn't realize that $m/$p/$cat were variables, I guess I might try reading the documentation next time!)

  4. Anonymous
    Unregistered
    Posted 9 years ago #

    Note, you should really use `$_GET[m], $_GET[p] and $_GET[cat] as if you are running a newer version of php global variables maybe turned off. If not's it's still sensible to use them... (The PHP manual page that talks about this in details)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.