Delete
Delete

Reputation: 429

Getting echo within echo to work together

In a little trouble with this, is they any way i can get to echo's working together see code below,

<?php $youtube_vimeo_player = get_post_meta($post->ID,'_youtube_vimeo_player',TRUE); ?>

<?php echo $video->embed(' <?php echo $youtube_vimeo_player['url']; ?> ', '', ''); ?>

I'm wanting the info brought from the vimeo_player url to be entered into the video->embed section. Any help on this would much be appreciated : )

Upvotes: 0

Views: 79

Answers (4)

ZJR
ZJR

Reputation: 9572

PHP isn't that crazy, but thanks for remembering us it could seem to.

Thou shall write:

<?php
  $youtube_vimeo_player = get_post_meta($post->ID,'_youtube_vimeo_player',TRUE);
  $url=$youtube_vimeo_player['url'];
  $video->embed($url, '', '');
?>

Educate yourself on the concept of variable, and remember, php has only one level of embedding (that is one level of <?php ... ?> — no nesting)

And believe it, it's better this way.

Upvotes: 0

Teneff
Teneff

Reputation: 32158

try it like this:

<?php $youtube_vimeo_player = get_post_meta($post->ID,'_youtube_vimeo_player',TRUE); ?>

<?php echo $video->embed( $youtube_vimeo_player['url'], '', ''); ?>

Upvotes: 2

J0HN
J0HN

Reputation: 26921

Replace

' <?php echo $youtube_vimeo_player['url']; ?> '

with

"{$youtube_vimeo_player['url']}"

You dont need echoing inside the php string. Note that { and } are the special way to embed array index, or object method call into the string, they are not present in final string.

Btw, it's sufficient to just do

echo $video->embed($youtube_vimeo_player['url'], '', ''); 

As $youtube_vimeo_player['url'] already shoud be the string

Upvotes: 1

k102
k102

Reputation: 8079

<?php echo $video->embed("'".$youtube_vimeo_player['url']."'", '', ''); ?>

Upvotes: 0

Related Questions