0

Using the thumbsup script to generate ratings for various things. Here is the current code:

echo ThumbsUp::item($reviewid)->template('mini_thumbs2')->format('{UP} out of {TOTAL} people found this review helpful')

I'm trying to add the text review_ before $reviewid. No matter what I try, Dreamweaver will stop showing errors, but the variable doesn't pass through. Last thing I tried is:

echo ThumbsUp::item('review_$reviewid')->template('mini_thumbs2')->format('{UP} out of {TOTAL} people found this review helpful')
2
  • 6
    I'd accept at least 5 of your answers to your other 6 questions... Commented Sep 14, 2011 at 22:58
  • Can you post the code for format() (from ThumbsUp::item)? Commented Sep 14, 2011 at 22:58

3 Answers 3

3

Have you tried using double quotes? Variables (and this is the rule for Perl too) won't interpolate into strings unless you use double quotes.

//                  v- double quotes-v
echo ThumbsUp::item("review_$reviewid")->template('mini_thumbs2')->format('{UP} out of {TOTAL} people found this review helpful')

Alternatively, you could use string concatenation to do the same thing:

echo ThumbsUp::item('review_' . $reviewid)-> ...
Sign up to request clarification or add additional context in comments.

Comments

2

I would recommend you escape variables with curly brackets, as this approach allows you to use object variables, example:

echo ThumbsUp::item("review_{$reviewid}")->template('mini_thumbs2')->format('{UP} out of {TOTAL} people found this review helpful');

Comments

0

Variables are not expanded within '', only within "".

echo ThumbsUp::item("review_$reviewid")->template('mini_thumbs2')->format('{UP} out of {TOTAL} people found this review helpful');

Comments

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.