drupalfun.com
Php help
Hi all, i'm new and I'have early buyed the community guide
I’m writing to you only for 3 things that I can’t do.
The first is the code for a sidebar block who give an instant link to “My account”
<?php
global $user;
$myuid= $user->uid;
$node= content_profile_load(profile, $myuid);
$profileid= $node->nid;
$myimage=theme_image(’sites/default/files/myprofile.jpg’);
print l($myimage, ’node/’.$node->
nid, array(’html’ => true))
?>
But when I create a new drupal block and I put the code inside it tells me:
Parse error: syntax error, unexpected T_DEFAULT in C:\xampp\htdocs\community\includes\common.inc(1648) : eval()'d code on line 6
The second problem starts at chapter 5.1.1
You wrote
We can now add a field, called Pictures, to our newly created content type
(fig 5.2):
• Type: image.
• Location: album/[uid]
Location means path?
Because when I configure the field I don’t have a label location and I’ve putted album[uid] in Path
The third problem is with the Views block that’s called “Photogallery”
When I copy your code:
<?php global $user;
$idn1=$user->uid; //my userid
$id2= arg(1); //my contentprofileid
$mynode= content_profile_load(profile, $idn1);
$id1= $mynode->nid;
//check if the user is looking at his own gallery:
if($id1==$id2){
//If so: display add link
echo ’Add your pictures here!’;
}
else
//if not:
{
echo "This user has no picture gallery uploaded.";
}
?>
The view returns me this error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\community\includes\common.inc(1648) : eval()'d code on line 9
Can you please help me? Because because I don’t know what I’m doing bad.
Thx a lot.
Related Questions
Responses
2. Same problem here
This code
<?php
global $user;
$myuid= $user->uid;
$node= content_profile_load(profile, $myuid);
//profile above=the name of our content type
$profileid= $node->nid;
print l(’My profile’,’node/’.$profileid);
//l() is a function provided by Drupal that creates a link.
//l(link display text, path after main path)
?>
generates this error after placing on a block
Parse error: syntax error, unexpected T_STRING in /home/pinoygam/public_html/drupal/includes/common.inc(1648) : eval()'d code on line 4
am i missing something?
3. same solution! retype all the
same solution!
retype all the single quotes.
4. wow thanks i got it hahaha.
wow thanks i got it hahaha.
6. Panels 3
Do we know if this works at all with Panels 3 in Drupal 6.9? I think I have followed all the steps correctly but my photo gallery block always displays "This user has no picture gallery uploaded" regardless of whether or not I am viewing my own profile. Also the "View my profile" from the Photo Gallery back to the profile is also not working either - the link displays on the top of the page and only links back to node/.
It makes me wonder if the content_profile_load function works properly with Panels 3...
Any thoughts?
Any and all help would be greatly appreciated - this has been a great instructional guide and well worth the money I spent on it!
Thanks...
7. content_profile_load is a
content_profile_load is a function from the Content Profile module, it should have nothing to do with Panels 3.
You can test the code, to see what happens:
Try checking your variables, by putting at the very end of your code:
echo $myuid;
echo $profileid;
8. late notice
Hi! Although this is a lil bit late, when calling content_profile_load(); be sure to put profile in quotes like this 'profile' and also eventually replace profile by the actual name of your content type. For example in my case it was student_profile.


1. did you copy/paste code? if
did you copy/paste code?
if you did ( that's what I see! )
change
echo ’Add your pictures here!’;
to
echo 'Add your pictures here!';
do you see the difference? ’ v/s '
retype all the single quotes.