1

I want to use some thumbshots generated images inside a WP loop, and the code looks like this:

if (!$thumbnail && wpbdp_get_option('use-default-picture'))
    $thumbnail = 'http://images.thumbshots.com/image.aspx?cid=xxxxxxxxxx&v=1&w=283&url=URLHERE';

URLHERE is generated by this:

How to replace the URLHERE thing with the output (outputs and URL) of:

<?php echo wpbusdirman_the_listing_meta('single'); ?>

I am very bad at php.

Thanks,

4
  • 1
    What does doesn't work means? Commented Sep 28, 2012 at 18:36
  • may need to assign the output to a variable, or at least figure out what that is doing/returning. $output=wpbusdirman_the_listing_meta('single'); echo $output; Commented Sep 28, 2012 at 18:36
  • Dave, that is returning a URL. Commented Sep 28, 2012 at 18:41
  • I edited the question to understand better my problem. Commented Sep 28, 2012 at 19:05

2 Answers 2

1
$thumbnail = 'http://images.thumbshots.com/image.aspx?cid=HIPFHapOLHw%3d&v=1&w=283&url='.urlencode(wpbusdirman_the_listing_meta('single'));
Sign up to request clarification or add additional context in comments.

1 Comment

It looks like a typo- he put a "$" on the urlencode. Try removing it?
0

URL encode the returned value!! You're putting a URL into a URL- if you don't URLEncode it, you're asking for more than a little trouble. I believe it's as simple as:

<?php echo urlencode(wpbusdirman_the_listing_meta('single')); ?>

:)

4 Comments

Thanks a lot but how do I put that in my code: if (!$thumbnail && wpbdp_get_option('use-default-picture')) $thumbnail = 'images.thumbshots.com/…'; - instead oh the yahoo thingy.
You could literally insert the code snippet I posted where your "URLHERE" is, or, alternatively (and much cleaner) you could assign it to a variable and insert the variable: <? $imageURL = urlencode(wpbusdirman_the_listing_meta('single')); And then $thumbnail = 'images.thumbshots.com/…';
This is what I did and somehow it doesn't work.. if (!$thumbnail && wpbdp_get_option('use-default-picture')) $imageURL = urlencode(wpbusdirman_the_listing_meta('single')); $thumbnail = 'images.thumbshots.com/…';
If you're putting a variable inside a string and expect it to be read as a variable, the string must use double quotes. using single quotes will insert the literal value (in this case $imageURL) . You want to use "images.......$imageURL" instead of 'images....$imageURL'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.