Recent Topics

1 Feb 25, 2005 19:46    

I have been messing with this code for hours (I am not all that hot with php :}) and I cannot figure out what is causing this parse error. I have tried stripping it down to bare bones and it still doesn't work for me. I know I am missing something simple and it's killing me! Any help would be much appreciated.

http://drydens.tornpaperbag.com/index.php?blog=2

<?php if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' ); ?>
<html> 
<! --- original design by Ashley Dryden of  --- http://design.tornpaperbag.com ---- 02-21-2005 --- !>
<head><meta http-equiv="Content-Type" content="text/html; charset=<?php locale_charset() ?>" />
<title>DRYDENS | tornpaperbag.com</title>
<base href="<?php skinbase(); // Base URL for this skin. You need this to fix relative links! ?>" />
<meta name="generator" content="b2evolution <?php echo $b2_version ?>" />
<LINK REL="STYLESHEET" TYPE="text/css" HREF="http://drydens.tornpaperbag.com/skins/longdistance/style.css">
</head>
<body>
<center><table class="main" cellpadding=0 cellspacing=0><tr>
<td colspan="2" class="maintop"><IMG alt="" src="main.jpg" border=0></td>
<tr>
<td class="mainleft"><div class="navtop"> &nbsp;&nbsp;navigation</div><div class="navcenter">
     <b>Blogs</b><br>
     &nbsp;&nbsp;&nbsp; <a href="http://drydens.tornpaperbag.com/index.php?blog=1">Everyone</a> [<A href="mailto:drydens@tornpaperbag.com">@</a>]<br>
     &nbsp;&nbsp;&nbsp; <a href="http://drydens.tornpaperbag.com/index.php?blog=4">Jim</a> [<A href="mailto:jim@tornpaperbag.com">@</a>]<br>
     &nbsp;&nbsp;&nbsp; <a href="http://drydens.tornpaperbag.com/index.php?blog=5">Sherry</a> [<A href="mailto:sherry@tornpaperbag.com">@</a>]<br>
     &nbsp;&nbsp;&nbsp; <a href="http://drydens.tornpaperbag.com/index.php?blog=3">Boone</a> [<A href="mailto:boone@tornpaperbag.com">@</a>]<br>
     &nbsp;&nbsp;&nbsp; <a href="http://drydens.tornpaperbag.com/index.php?blog=2">Ashley</a> [<A href="mailto:ashley@tornpaperbag.com">@</a>]
     
     <b>Categories</b><br>
      <php $Item->categories(); ?>
     </div>
     
    <div class="navbottom"><a href="http://design.tornpaperbag.com" target=_blank>design</a> | <a href="http://tornpaperbag.com" target=_blank>host</a> | <a href="http://b2evolution.net" target="_blank">b2</a></div>
<br><br>

<div class="navtop"> &nbsp;&nbsp;<b>about</b></div><div class="navcenter">
This blog follows the lives of four family members recently seperated by quite a few miles of highway. In an effort to share their everyday lives together, this collaborative journal was establishedso that the Dryden family could share stories, pictures and more.<br><br>The Drydens are: Jim (the dad), Sherry (the mom), Boone (the son), and Ashley (the daughter-in-law). </div>
<div class="navbottom"></div></td>
<td class="mainright">
<div>
<IMG class=avatar src="<?php $Item->Author->prefered_name(); ?>.gif" border=1 alt="avatar">
<div class="contenttop"><b><?php $Item->title(); ?></b><br><small><?php $Item->Author->url('<?php $Item->Author->prefered_name(); ?>'); ?> : <?php $Item->categories(); ?></small></div>
<div class="contentcenter"><br>&nbsp;<?php $Item->content(); ?><br>&nbsp;<br>&nbsp;</div>
<div class="contentbottom"><a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php echo T_('Permalink') ?></a> posted on <?php $Item->date(); ?> at <?php  $Item->time(); ?> | <?php $disp_comments = 1; $disp_comment_form = 1; ?> </div>
<br><br><br></div>

</td>
</tr>
</table></center>
</body>
</html>

2 Feb 25, 2005 20:07

line 34 says what? (nm edb got it) :)

3 Feb 25, 2005 20:23

The specific error you are getting

Fatal error: Call to a member function on a non-object in /home/adryden/public_html/drydens/skins/longdistance/_main.php on line 34

is coming from trying to get $Item->Author->prefered_name() when you don't have any $Item selected or identified. Basically, your entire posts loop is missing.

Quick-cut at a solution:

<div>
<IMG class=avatar src="<?php $Item->Author->prefered_name(); ?>.gif" border=1 alt="avatar">
<div class="contenttop"><b><?php $Item->title(); ?></b><br><small><?php $Item->Author->url('<?php $Item->Author->prefered_name(); ?>'); ?> : <?php $Item->categories(); ?></small></div>
<div class="contentcenter"><br>&nbsp;<?php $Item->content(); ?><br>&nbsp;<br>&nbsp;</div>
<div class="contentbottom"><a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php echo T_('Permalink') ?></a> posted on <?php $Item->date(); ?> at <?php  $Item->time(); ?> | <?php $disp_comments = 1; $disp_comment_form = 1; ?> </div>
<br><br><br></div>


All that needs to be replaced with the posts loop from what used to be _main.php. In the custom skin it'll be identified with a long comment line indicating "start of main area" then about 50 lines later "end of main area". Throw the regular posts loop in then tweak it to do the avatar thing you want and whatever classes you want to use.

4 Feb 25, 2005 20:40

You guys are amazing. Fast and efficient. Going to go fix it now.

Thanks again :D
Ashley

5 Feb 25, 2005 20:44

First you are missing the first "?" in the followig line:


<php $Item->categories(); ?>

Secondly I don't think your script is semantically what you want (just a guess). Looking at your site it looks like you want a list of categories in the side navigation. But the code is getting the categories of an $Item (which is not initialized and is why the script is broken). What you want is a list of categories for the blog not a sigle item (who knows maybe you do). If you have access to the "custom" skin which is the default for new b2evo installs have a look at the _main.php. In that file are examples of how to initialize $Item (in other words the php code to get and loop over the blog entries) and how to get the categories for the blog.

By the way if your interested in a possible way of building skins without (read ZERO) php in your layout have a look at my post [url=http://forums.b2evolution.net/viewtopic.php?t=3252] here [/url]


Form is loading...