[support] Inserting php block snippet into a standard node
Neil: esl-lounge.com
neil at esl-lounge.com
Fri May 4 21:09:09 UTC 2007
I'm getting exactly the same problem with that code too. Getting the
information to show (in this case, just a simple e-mail address) is not the
problem. I got that bit working with my original code. The problem is that
the content stops at the point in the page where I post the php snippet.
Everything before it shows and nothing after it.
Why would that be? It's in standard php tags and the input format is php
too.
----- Original Message -----
From: "Jason Flatt" <drupal at oadaeh.net>
To: <support at drupal.org>
Sent: Friday, May 04, 2007 2:49 PM
Subject: Re: [support] Inserting php block snippet into a standard node
> On Friday May 4 2007 3:30 am, Neil: esl-lounge.com wrote:
>> I am creating a dynamic newsletter using the simplenews module and php
>> block snippets. I've got the overall mechanics working well.
>>
>> I create the newsletter, say /newsletter/05-may-07 which has standard
>> header and footer text which goes out to every person. Then my idea is to
>> insert location-based content into it so that Jane from Texas sees "Last
>> five members from Texas", "Last five posts from Houston", "Five members
>> who
>> go to your school" and so on. Chris from London would see different
>> content.
>>
>> The problem I've hit though is that when I insert the block snippet into
>> the node, choose PHP as input format and press "Submit", none of the
>> content below the snippet shows. Here is my snippet:
>>
>> <?php
>> global $user;
>> $result=db_query("SELECT dru_users.uid, dru_users.init FROM dru_users
>> WHERE
>> (dru_users.uid = $user->uid)"); while ($u = db_fetch_object($result)) {
>> $items[]=l($u->init, "user/" . $u->uid);
>> }
>> return theme('item_list',$items);
>> ?>
>>
>> This is just a test snippet to test the concept....in a block, it shows
>> the
>> current user's e-mail address. It also does this in a node, but as I say,
>> the rest of the content below this code doesn't come through.
>>
>> Any idea what the problem is?
>
> Try it this way:
>
> <?php
> global $user;
> $result=db_query("SELECT uid, init FROM dru_users WHERE dru_users.uid =
> %s",
> $user->uid);
>
> while ($u = db_fetch_object($result)) {
> $items[]=l($u->init, "user/" . $u->uid);
> }
>
> return theme('item_list',$items);
> ?>
>
> I'm assuming your database tables have a prefix, thus the "dru_" before
> the "users" in the table name.
>
> BTW, sorry about the other post. I meant to close it and sent it instead.
>
> --
> Jason Flatt
> http://www.oadaeh.net/
> Father of Six: http://www.flattfamily.com/ (Joseph, 13; Cramer, 11;
> Travis,
> 9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005)
> Linux User: http://www.kubuntu.org/
> Drupal Fanatic: http://drupal.org/
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
More information about the support
mailing list