PHP Help!

change
if ($screen != "")

to

if (isset($screen) && $screen != false && !empty(trim($screen)) && $screen != NULL && $screen != "")

No dice...that just made the sidebar disappear altogether.
 
I don't know... From the <div> tag earlier $screen == "" but it doesn't work...

if (isset($screen) && $screen != "") should cover the basis then. I'm going to bed.

Good luck... :dunno:
 
I've got to get some sleep, but maybe this problem is more complicated than I thought.

If you want (whoever), you can download the theme here: http://www.web2feel.com/scarlett-theme/ (it's free).

Take a look, and then PM me with a price-quote on what it would cost me to make it do what I'm asking for.

Don't work on it until I've accepted your quote, as I don't want to have to pay 4 different people to fix one problem.
 
Nope, now nothing appears in that block...
Code:
<div id="postlist">

<ul class="spy">
<?php $my_query = new WP_Query('orderby=rand'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post();?>
<?php $screen = get_post_meta($post->ID, 'screen', $single = true); 

if (strlen(trim($screen)) > 1)
{?>
<li>
<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $screen; ?>&h=60&w=100&zc=1" alt=""/>

<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="fcats"><?php the_category(', '); ?> </div> 
<div class="auth"> Posted by <?php the_author(); ?> </div> 

</li>
<?php
}
?>

<?php endwhile; ?>

</ul>
</div>
<div class="clear"></div>
this?
 
I've got to get some sleep, but maybe this problem is more complicated than I thought.

If you want (whoever), you can download the theme here: http://www.web2feel.com/scarlett-theme/ (it's free).

Take a look, and then PM me with a price-quote on what it would cost me to make it do what I'm asking for.

Don't work on it until I've accepted your quote, as I don't want to have to pay 4 different people to fix one problem.
 
@Born2Hack <- Nope, same thing. It just turns into a big gray block with nothing at all in it.
 
Code:
<div id="postlist">

<ul class="spy">
<?php $my_query = new WP_Query('orderby=rand'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post();?>
<?php if(strlen($screen = get_post_meta($post->ID, 'screen', $single = true)) > 5) { ?>
<li>
<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $screen; ?>&h=60&w=100&zc=1" alt=""/> 

<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="fcats"><?php the_category(', '); ?> </div> 
<div class="auth"> Posted by <?php the_author(); ?> </div> 

</li>
<?php } ?>
<?php endwhile; ?>

</ul>
</div>
<div class="clear"></div>
I dloaded the theme and this is where I could get to, featlist.php
If this doesn't work I will try and install the theme and then do it if I get time.
 
Last edited:
@Born2Hack -> Not sure if you're closer to a solution or further away.

Your previous two posts made it so that NOTHING appeared there. This most recent one, the horizontal bars that normally have the post info in them, actually appear (and move like they are supposed to). However, there is nothing in them...they are completely blank.

If a post that had an image associated with "screen" appears in it though, everything looks normal (but only for that one, the other bars are still blank).
 
@Born2Hack -> Not sure if you're closer to a solution or further away.

Your previous two posts made it so that NOTHING appeared there. This most recent one, the horizontal bars that normally have the post info in them, actually appear (and move like they are supposed to). However, there is nothing in them...they are completely blank.

If a post that had an image associated with "screen" appears in it though, everything looks normal (but only for that one, the other bars are still blank).

I edited the code in the above post. I misplaced a tag. Try it again.
 
I edited the code in the above post. I misplaced a tag. Try it again.

Nope, now it's back to a blank box again (completely blank, no horizontal bars or anything.)
 
Give this a try.
Code:
<div id="postlist">

<ul class="spy">
<?php $my_query = new WP_Query('orderby=rand'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post();?>

<?php $screen = get_post_meta($post->ID, 'screen', $single = true); 

if(preg_match("/http/",$screen))
{?>
<li>
<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $screen; ?>&h=60&w=100&zc=1" alt=""/>

<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="fcats"><?php the_category(', '); ?> </div> 
<div class="auth"> Posted by <?php the_author(); ?> </div> 

</li>
<?php
}
?>
<?php endwhile; ?>

</ul>
</div>
<div class="clear"></div>
 
Last edited:
Born2Hack has gotten this taken care of for me, looks awesome! Thanks again! Money sent.
 
echo "<div class="bhw_test">";

needs to be

echo "<div class=\"bhw_test\">";

Need to escape the " so it doesn't end the string prematurely.

You can also do ?> <div class="bhw_test"> <?php to bounce from php to html

Thanks for the correction. That was the last thing I wrote before I went to sleep. :(

FYI, empty() returns true for null values, too.
 
For future reference I have solved problems like you were running into by simply doing the following:

if(trim($screen)){


Trim will remove any whitespace and then php will eval it to false unless there is some meaningful data like the image path.
 
Back
Top