2013-04-19 1 views
0

MODx Evo 1.0.9 사용. 나는 템플릿에 유튜브 비디오 타이틀을 가져 오기 위해 다음 코드를 사용하는 것을 시도하고있다 :스 니펫에 TV 값 전달 (MODx Evo)

위의 코드에서
<?php 
$code = "<<<Youtube Video ID>>>"; 
$video_feed = file_get_contents("http://gdata.youtube.com/feeds/api/videos?v=2&q=".$code."&max-results=1&fields=entry(title)&prettyprint=true"); 
$video_obj = simplexml_load_string($video_feed); 
$video_str = $video_obj->entry->title; 
$output = $video_str; 
return $output; 
?> 

, 내가 $code 변수에 TV에서 YouTube 동영상 ID를 전달하고자합니다. [*youtubeID*]을 사용하면 작동하지 않습니다. 해결 방법은 무엇입니까?

답변

0

은 레보처럼 아무것도 작동하는 경우 다음 유튜브 ID는 전달 된 변수로 또는 scriptPrperty로 사용할 수 있습니다, 당신의 조각에서 다음

[[!MySnippetName? &youTubeId='456']] 

:

<?php 
$code = $youTubeId; 
//or 
$code = $scriptPropertes('youTubeId);//might have to check this one. 
+0

감사 숀. 그게 효과가 있었어. :) – Santosh