2 oser Sep 28, 2005 16:38
![](http://www.gravatar.com/avatar/0ddddd8fc3afd8e718b7a38c357a53ae?size=80&default=https%3A%2F%2Fforums.b2evolution.net%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1659823855)
You'll have to excuse me if I end up sounding like an idiot. I'm trying to code my own hack into b2evo and this is my first attempt at it.
Basically, I have an imageblog, and I added a new column to my evo_posts table to keep track of the urls of each image that I post in it. The idea is that I can pull that raw url out and use it as an image in my skin. I worked through the pain of actually being able to insert values into the new field in my database, and a quick query shows me that i've been successful.
Now I'm having a problem getting that info out of the database.
Here's my code so far, and please tell me if you need more info:
_class_item.php
...
//inside the constructor
$this->urlimage = $db_row->post_urlimage;
...
//my function which should return the value pulled from the db
function getImageURL(){
$urlimage = $this->urlimage;
echo $urlimage;
}
_main.php
...
<?php $saved_Blog = $Blog; $saved_blog = $blog; //hax
$blog = 2; unset($Blog); //select my imageblog
echo "<div id=\"thePic\">";
$BlogBList = & new ItemList( $blog, '', '', '', '', '', array(), '', 'DESC', '', '', '', '', '', '', '', '', '', '1', 'posts' );
//get the latest post in the form of an ItemList (Please don't make fun of me for doing this!)
$Item = $BlogBList->get_item(); //pull out that item
echo "<img src=\"" , $Item->getImageURL() , "\" alt=\"WebOser Front Page Image\" />";
//call the getImageURL() function, which should return $this->imageurl pulled from the database, but ends up empty for some reason
echo "</div>";
echo "<div id=\"theCaption\">";
echo 'Title: ' , $Item->title() , ' | Category: ' , $Item->main_category();
echo "</div>";
$blog = $saved_blog; $Blog = $saved_Blog; //unhax
?>
...
What gets me is that I know $Item contains the correct post, as other values I call from it appear correctly. And I know, from the query I'm running on the table that the value is being placed into the post_urlimage field. I'm just missing a connection somewhere.
Please help? :oops:
Stupid Oser figured out his own problem...finally...
I didn't think to look in _class_itemlist for the code that actually contains the SQL statement to pull that data from the table.
I added my new field to this line:
and it seems to work. All it needs is a little tweaking to get the value to display on my edit pages, and I should be in business. =)