Forum

Thread tagged as: Problem, Runway, Field-Types

YouTube video output as text?

Hi,

I'm having trouble adding a youtube video to a page. I've added it into my collection using the following code:

<perch:content id="brandpage_video" type="youtube" label="YouTube URL"/>

and it displays a thumbnail below it perfectly in the Control Panel.

However when I go to the page with the code below it just shows me the URL of the youtube video in text, without actually processing it?

I must be doing something really simple, really wrong :) Any help would be great thanks. <perch:content id="brandpage_video" type="youtube" />

Chris Comben

Chris Comben 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can we see your complete template and Diagnostics Report please?

To actually embed the player you need to use:

output="embed"

Hi,

The entire template, which is a collection template is:

<style type="text/css"> body { background-image: url('<perch:content id="brand_background" />'); } </style>

<div class="container">

<div class="center">

    <p><perch:content id="brandpage_image" /></p>

    <p><perch:content id="brandpage_video" output="embed" /></p>

</div>

<div class="col-md-8 col-md-offset-2 center">
        <div class="helv15"><perch:content id="brandpage_text" html="true"/></div>
</div>

<div class="cf"></div>

<div class="center"><a href="/watches/<perch:content id="slug" />/collections"><img src="/perch/burrells/img/but_collections.png" title="Collections"></a></div>

<div class="cf"></div>

</div>

Called from:

<section>

    <?php 

        perch_collection('brands',[
            'template' => 'watch/brand.html',
            'filter' => 'slug',
            'match'  => 'eq',
            'value'  => perch_get('brand'),
            'count' => 1
        ]);

    ?>

</section>

(I'd put this in the black coding format but the 'how to mark up your post' link doesn't work)

Then the actual data is just a collection with the following relevant line:

<p><perch:content id="brandpage_video" type="youtube" label="YouTube URL"/></p>

Sadly the output=embed thing didn't work.

I thought it maybe php_curl not being activated but I'm using WAMP and it seems to be enabled.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

and the Diagnostics Report? It's really hard to help unless we can see a full picture which is why we ask for these things when you create a thread.

Sorry, I totally forgot that...

SUMMARY INFORMATION

Perch Runway: 2.8.8, PHP: 5.5.12, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (2.8.8), assets (2.8.8), categories (2.8.8)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /perch
PERCH_PATH: E:\wamp\www\perch
PERCH_CORE: E:\wamp\www\perch\core
PERCH_RESFILEPATH: E:\wamp\www\perch\resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 3M, Memory: 128M, Total max file upload: 3M
Resource folder writeable: Yes
HTTP_HOST: localhost
DOCUMENT_ROOT: E:/wamp/www/
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PERCH INFORMATION

Perch Runway: 2.8.8
Production mode: Production (100)
Installed apps: content (2.8.8), assets (2.8.8), categories (2.8.8)
DB driver: PDO
DB tables: brls_backup_plans, brls_backup_resources, brls_backup_runs, brls_categories, brls_category_counts, brls_category_sets, brls_collection_index, brls_collection_items, brls_collection_revisions, brls_collections, brls_content_index, brls_content_items, brls_content_regions, brls_navigation, brls_navigation_pages, brls_page_routes, brls_page_templates, brls_pages, brls_resource_tags, brls_resources, brls_resources_to_tags, brls_settings, brls_user_privileges, brls_user_role_privileges, brls_user_roles, brls_users
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
    );
Editor plug-ins: markitup
H1: 421aa90e079fa326b6494f812ad13e79
L1: 6fba5daa602ab4daa1ee2927bd432ed4
headerColour: #000000
content_singlePageEdit: 1
helpURL:
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.8: done
headerScheme: dark
update_runway_2.8.8: done
latest_version: 2.8.8
on_sale_version: 2.8.13
siteURL: https://localhost/
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: E:\wamp\www\perch\setup\runway\modes
PERCH_SCHEDULE_SECRET: p8x4wbcyp16vSy8G
PERCH_DB_USERNAME: perch
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: perch
PERCH_DB_PREFIX: brls_
PERCH_EMAIL_FROM: chris@comben.org.uk
PERCH_EMAIL_FROM_NAME: Chris Comben
PERCH_LOGINPATH: /perch
PERCH_PATH: E:\wamp\www\perch
PERCH_CORE: E:\wamp\www\perch\core
PERCH_RESFILEPATH: E:\wamp\www\perch\resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: Europe/London
PERCH_RWD: 1
PERCH_YOUTUBE_API_KEY: AIzaSyDR-tDiZf2h4j7-RVo5w-eMTjcpRoH-pBo
PERCH_DEBUG: 1
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: E:\wamp\www\perch\templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.5.12
Zend: 2.5.0
OS: WINNT
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $
MySQL server: 5.6.17
Extensions: Core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, wddx, xml, xmlreader, xmlwriter, apache2handler, openssl, curl, com_dotnet, fileinfo, gd, gettext, gmp, imap, mbstring, exif, mysql, mysqli, Phar, pdo_mysql, pdo_sqlite, shmop, soap, sockets, sqlite3, xmlrpc, xsl, mhash, xdebug
GD: Yes
ImageMagick: No
PHP max upload size: 64M
PHP max form post size: 3M
PHP memory limit: 128M
Total max uploadable file size: 3M
Resource folder writeable: Yes
Session timeout: 30 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
HTTP_HOST: localhost
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
HTTP_REFERER: https://localhost/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.8
HTTP_COOKIE: cmsa=1; PHPSESSID=b2s3vnv72suv20v3h67qagsm31
PATH: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
SystemRoot: C:\WINDOWS
COMSPEC: C:\WINDOWS\system32\cmd.exe
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
WINDIR: C:\WINDOWS
SERVER_SIGNATURE: <address>Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80</address>
SERVER_SOFTWARE: Apache/2.4.9 (Win64) PHP/5.5.12
SERVER_NAME: localhost
SERVER_ADDR: ::1
SERVER_PORT: 80
REMOTE_ADDR: ::1
DOCUMENT_ROOT: E:/wamp/www/
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: E:/wamp/www/
SERVER_ADMIN: admin@example.com
SCRIPT_FILENAME: E:/wamp/www/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 64873
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1442413619.819
REQUEST_TIME: 1442413619
Drew McLellan

Drew McLellan 2638 points
Perch Support

There type attribute is required - so this won't work:

<perch:content id="brandpage_video" output="embed" />

try this:

<perch:content id="brandpage_video" type="youtube" output="embed" />

Yay, sort of. I've got two big errors now:

NOTICE: UNDEFINED INDEX: WIDTH IN E:\WAMP\WWW\PERCH\ADDONS\FIELDTYPES\YOUTUBE\YOUTUBE.CLASS.PHP ON LINE 113
NOTICE: UNDEFINED INDEX: HEIGHT IN E:\WAMP\WWW\PERCH\ADDONS\FIELDTYPES\YOUTUBE\YOUTUBE.CLASS.PHP ON LINE 113

I assume this is because I've debug on?

Either way, I've got a responsive site, if I were to set width to 100% would that work?

Thanks for your help :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah - I think you need to set a pixel width and height for the embed.

<perch:content id="brandpage_video" type="youtube" output="embed" width="640" height="480" />

I've added the height and width but I still get the error. The full error is below:

 NOTICE: UNDEFINED INDEX: WIDTH IN E:\WAMP\WWW\PERCH\ADDONS\FIELDTYPES\YOUTUBE\YOUTUBE.CLASS.PHP ON LINE 113
CALL STACK
#   TIME    MEMORY  FUNCTION    LOCATION
1   0.0010  256320  {MAIN}( )   ..\START.PHP:0
2   0.0595  5139112 INCLUDE( 'E:\WAMP\WWW\PERCH\TEMPLATES\PAGES\WATCH\BRAND.PHP' )  ..\START.PHP:27
3   0.1678  5226632 PERCH_COLLECTION( ) ..\BRAND.PHP:33
4   0.1678  5226776 PERCHCONTENT_RUNWAY->GET_COLLECTION( )  ..\RUNTIME.PHP:23
5   0.1775  5290232 PERCHTEMPLATE->RENDER_GROUP( )  ..\PERCHCONTENT_RUNWAY.CLASS.PHP:467
6   0.1777  5294872 PERCHTEMPLATE->RENDER( )    ..\PERCHTEMPLATE.CLASS.PHP:98
7   0.1779  5298888 PERCHTEMPLATE->REPLACE_CONTENT_TAGS( )  ..\PERCHTEMPLATE.CLASS.PHP:176
8   0.1801  5385680 PERCHFIELDTYPE_YOUTUBE->GET_PROCESSED( )    ..\PERCHTEMPLATE.CLASS.PHP:259
Drew McLellan

Drew McLellan 2638 points
Perch Support

Boom. Ok, let me take a look at it and get back to you.

Could it be because I'm still on 2.8.8 ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

How about if you change output="embed" to output="player" ?

It removes the error, but sadly it just turns the video into text of the youtube link again.

Drew McLellan

Drew McLellan 2638 points
Perch Support

As in, it displays the YouTube video URL?

Yeah, it just shows the address effectively, eg:

https://www.youtube.com/watch?v=pCClM

Drew McLellan

Drew McLellan 2638 points
Perch Support

Hmm. Are you on the latest version of the YouTube field type?

I believe so, I only downloaded it a day or two ago.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Hmm. I can't reproduce that. You're a little behind in your Runway version - can you update?

Updated to .13 now and I still have the errors sadly :(

NOTICE: UNDEFINED INDEX: WIDTH IN E:\WAMP\WWW\PERCH\ADDONS\FIELDTYPES\YOUTUBE\YOUTUBE.CLASS.PHP ON LINE 113
CALL STACK
#   TIME    MEMORY  FUNCTION    LOCATION
1   0.0023  258272  {MAIN}( )   ..\START.PHP:0
2   0.1230  3987904 INCLUDE( 'E:\WAMP\WWW\PERCH\TEMPLATES\PAGES\WATCH\BRAND.PHP' )  ..\START.PHP:31
3   0.2386  4620296 PERCH_COLLECTION( ) ..\BRAND.PHP:33
4   0.2386  4620440 PERCHCONTENT_RUNWAY->GET_COLLECTION( )  ..\RUNTIME.PHP:23
5   0.2484  4684048 PERCHTEMPLATE->RENDER_GROUP( )  ..\PERCHCONTENT_RUNWAY.CLASS.PHP:467
6   0.2485  4688688 PERCHTEMPLATE->RENDER( )    ..\PERCHTEMPLATE.CLASS.PHP:101
7   0.2487  4692736 PERCHTEMPLATE->REPLACE_CONTENT_TAGS( )  ..\PERCHTEMPLATE.CLASS.PHP:179
8   0.2533  4779576 PERCHFIELDTYPE_YOUTUBE->GET_PROCESSED( )    ..\PERCHTEMPLATE.CLASS.PHP:281
( ! ) NOTICE: UNDEFINED INDEX: HEIGHT IN E:\WAMP\WWW\PERCH\ADDONS\FIELDTYPES\YOUTUBE\YOUTUBE.CLASS.PHP ON LINE 114
CALL STACK
#   TIME    MEMORY  FUNCTION    LOCATION
1   0.0023  258272  {MAIN}( )   ..\START.PHP:0
2   0.1230  3987904 INCLUDE( 'E:\WAMP\WWW\PERCH\TEMPLATES\PAGES\WATCH\BRAND.PHP' )  ..\START.PHP:31
3   0.2386  4620296 PERCH_COLLECTION( ) ..\BRAND.PHP:33
4   0.2386  4620440 PERCHCONTENT_RUNWAY->GET_COLLECTION( )  ..\RUNTIME.PHP:23
5   0.2484  4684048 PERCHTEMPLATE->RENDER_GROUP( )  ..\PERCHCONTENT_RUNWAY.CLASS.PHP:467
6   0.2485  4688688 PERCHTEMPLATE->RENDER( )    ..\PERCHTEMPLATE.CLASS.PHP:101
7   0.2487  4692736 PERCHTEMPLATE->REPLACE_CONTENT_TAGS( )  ..\PERCHTEMPLATE.CLASS.PHP:179
8   0.2533  4779576 PERCHFIELDTYPE_YOUTUBE->GET_PROCESSED( )    ..\PERCHTEMPLATE.CLASS.PHP:281

The video is displaying fine below btw, its just I have these error messages above it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you still using embed ?