Jump to content

PHP Newbie Question for Undefined Object


morigeau

Recommended Posts

Hello,

I am having a super difficult time with this one. I'm very new to PHP and am trying my very best to figure out these problems on my own, but am not quite there yet. If anybody can help I would appreciate it very much. Here are the details...I am using a script for thumbs up and thumbs down. I placed the script include(""); at the very top of my index.php file and included the correct CSS links and everything else that was included and it works fine and I get no errors. However, there is another file that I am using that I would like this script to show up in so what I did is the exact same thing within this file as I did with the index.php file I used i.e. include(""); to reference the php file script and I included all the CSS and script files, same as I did with the index.php, only now no matter what I do I get the following error on the front of my Web page...

 

Fatal error: Call to a member function setup() on a non-object in tmpl:///home/content.../plugins/system/socialengine/uikit/story/tmpl/story_list_item.php on line 8

 

on line 8 this is the php code that I am using

 

<?php $thumbsup->setup('story_thumbs', 'mini-thumbs', array('align' => 'right'))->render() ?>

 

this is the same code that I used in the index.php only in the index.php I get no error? I'm not sure what the difference is. How come in index.php the object is ok, but in story_list_item.php the object is undefined? It's the same code same idea. Anyways any help would be awesome I love learning about these things, but sometimes they can be frustrating. Thanks for reading.

 

Cheers,

David

Link to comment
Share on other sites

This is a bit hard to tell without seeing the full code from both your story_list_item.php and your index.php... You probably should post those two files or attach them to a post. One idea... is your index file and story_list_item file in different directories? If so, have you updated your include to use the correct path?

Link to comment
Share on other sites

Hello,

I have since corrected the problem by removing all the script code from the file and moving it to a separate PHP file. Now I just PHP include, the PHP file I created with the script code, in another file and it shows up without the error. Thank you so much for your help above.

 

Please ignore the file attachments as they do not apply anymore.

 

Cheers,

David

index.php

story_list_item.php

config.php

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...