ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Handling button states with PHP

June 27, 2007 9:52am

Subscribe [2]
  • #1 / Jun 27, 2007 9:52am

    spen

    13 posts

    Hello all

    I have used this method before but for some reason I cannot get it to work with EE. I will explain bit by bit and hopefully someone can offer some help.

    In the header I would add this:

    <?php
    //Set up nav strings
    $news = $proj = $excel = $who = $care = $cont = “”;
    ?>

    On the Projects page, I would add this at the top of the page but after the header:
    <?php $proj = “thisPage”; ?>

    In the link on the navigation, I would add:
    <a class=”<?php echo $proj ?>”>Projects</a>

    Weirdly, EE simply states that an undeclared variable exists in the href. This works fine on a ‘traditional’ php site, but not here…any ideas?

    Failing that can anyone point me towards any EE documentation on hadnling button states?

    Many thanks

    Spen

  • #2 / Jun 27, 2007 10:31am

    silenz

    1651 posts

    Hello all
    Weirdly, EE simply states that an undeclared variable exists in the href.

    Do you get a PHP warning or how is this not working?

  • #3 / Jun 27, 2007 10:58am

    spen

    13 posts

    I don’t get an overt php error appear in the view port, but this appears in the html output:

    <li class=“projects_btn”>
    _
    </li>

    As far as I understand it the variable ‘proj’ is declared in the header…

    Cheers

    Spen

  • #4 / Jun 27, 2007 11:42am

    silenz

    1651 posts

    When I paste your forum post into a template I don’t get a notice.

    Everything works as intended apart from the missing ” here:

    News
    Projects
    ...</pre>

  • #5 / Jun 27, 2007 1:36pm

    spen

    13 posts

    I’ve rooted around thoroughly and nothing seemed to be clashing. No matter, though, as I quickly tried your URL-segment recommendation and it is exactly what I am after, so thank you very much. 😊

    Spen

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases