Fatal Error on all pages except specified

0

Hi, Bear with me... I'm new to Pods.

I've set up a pod so that my client can upload a banner, link, and alt text, then check a box to determine whether the banner should be displayed on the home page. This all seems to be working fine and dandy on the home page of the site, but all of the other pages display an error message:

"Fatal error: Call to a member function findRecords() on a non-object..."

I'm new to PHP, so I'm not sure how to debug this. Here's my function:

<pre>function promo_banner() { if(is_front_page()) $Record = new Pod('homepagebanner'); $Record->findRecords('id DESC', 1, "t.bannerdisplay='1'"); echo $Record->showTemplate('home_banner'); }</pre>

Any suggestions?

Thanks, Melanie

asked Jun 10 '10 at 10:11

melanie

6

add comment
enter at least 15 characters

2 Answers

2

You just have an error in your PHP logic, that's all. The IF statement needs to contain all the other statements:

function promo_banner() {
    if(is_front_page()) {
        $Record = new Pod('homepagebanner');
        $Record->findRecords('id DESC', 1, "t.bannerdisplay='1'");
        echo $Record->showTemplate('home_banner');
    }
}

answered Jun 11 '10 at 8:03

clarinetlord

456

add comment
enter at least 15 characters
0

Ooooops! Thanks! That solved it.

answered Jun 11 '10 at 11:43

melanie

6

add comment
enter at least 15 characters