solved Question About Debug and Datastore

derrickhand300
@derrickhand300
9 years ago
1,353 posts
I am working with the youtube/facebook share meta tags so that they pull the proper info when posting a link to youube-I have quite a bit of it finished by using the datastore and DEBUG console

Here is my problem with og image and og description
The default templates use code like this
<meta property="og:description" content="{$youtube_description}" /> 
<meta property="og:image" content="https://img.youtube.com/vi/{$youtube_id}/mqdefault.jpg" />

But when you look at the page source code these 2 pieces are not getting ANY data and are left blank in the page source code

{$youtube_description}
{$youtube_id}

When I check the datastore the information is contained in there- but when I look in the DEBUG console its not in there...how do I get it into the debug console so it will show up when I add it to a template
Sorry if my description is a little off-This is new territory for me
updated by @derrickhand300: 02/19/16 05:23:49PM
michael
@michael
9 years ago
7,740 posts
Your close.

The thing to understand is: Not all information is available everywhere.

The {debug} information shows what IS available in the location where you put the {debug}.
So if you want other information in that location that is not currently there, you need to pull it in.

The go-to function for getting stuff out of the datastore is {jrCore_list}.
You need to use {jrCore_list} to pull in the information you want, so if in the location your thinking about, there is something in the URL that correlates to the youtube video you're after, use that to get the info your needing.

If you just want a couple of things and dont want to add another file to the skins, then check this doc out:

"HowTo: use {capture} to avoid using another file for {jrCore_list} calls"
https://www.jamroom.net/the-jamroom-network/documentation/howto/1637/howto-use-capture-to-avoid-using-another-file-for-jrcore-list-calls

derrickhand300
@derrickhand300
9 years ago
1,353 posts
ok so putting the DEBUG in the meta.tpl was a mistake? I should have added it to ONE OF the youtube templates?
Ok going back to add the debug inb a new place and try...:)
( I should have been a brain surgeon- it would have been easier. I thought "webmaster" was perfect for a guy who drank to much growing up and never studied)
updated by @derrickhand300: 11/19/15 02:08:21AM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Dang it- its ALL THERE NOW! :) What a great 5 hour lesson of endless scrolling through a debug console until my vision blurred- wont forget this one! :)

Ok- so here is what I got from the debug

{$item}                        youtube_id => "AdttvLChEkw"

In the video i watched concerning $config you say to drop the smarty bracket and add a dot

so is this what I need?

{$item.youtube_id =>}

Seems like everytime I see this => there is ALWAYS something after it like ()...so I wanted to ask
updated by @derrickhand300: 11/19/15 02:15:45AM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Neither of these work
<meta property="og:image" content="http://i.ytimg.com/vi/{$item.youtube_id}/mqdefault.jpg" />
<meta property="og:image" content="http://i.ytimg.com/vi/{$item.youtube_id =>}/mqdefault.jpg" />


The first one returns this in the page source code
<meta property="og:image" content="http://i.ytimg.com/vi//mqdefault.jpg">

and the second one breaks the website
updated by @derrickhand300: 11/19/15 02:21:23AM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
What I am doing is adding all this code to a template and naming it youtube_meta.tpl
<meta property="og:url" content="{$current_url}" />
<meta property="og:type" content="movie" />
<meta property="og:title" content="{$page_title|capitalize}" /> 
<meta property="og:description" content="{$youtube_description}" /> 
<meta property="og:image" content="http://i.ytimg.com/vi/{$item.youtube_id}/mqdefault.jpg" />
<meta property="og:image:width" content="480"/>
<meta property="og:image:height" content="360"/>
<meta property="og:site_name" content="Eagle Sports Video" />
<meta property="og:updated_time" content="{$smarty.now}" />

THEN IN MY META.tpl file I am adding this

{jrCore_include template="youtube_meta.tpl"}

So the docs on adding the capture are really confusing me and the {jrCore_list} is confusing me even worse....should I be adding the template to the meta using {jrCore_list module=...? sorry man...thought I was about to get this but now Im as lost as ever
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Eventually my plan was to have 3 templates added into the meta.tpl

Youtube_Meta
Video_meta
Image_meta

Then wrap all that in some sort of if/else thing so that
if the page is youtube- it uses the youtube meta
if the page is jrVideo-it uses the jrVideo meta
and if the page is an image it uses the image meta data...
Make sense or a waste of time?
derrickhand300
@derrickhand300
9 years ago
1,353 posts
I can pay someone with PayPal to help me get this part

<meta property="og:image" content="http://i.ytimg.com/vi/{$item.youtube_id}/mqdefault.jpg" />

When I see how 1 is written and works I think I can get the rest myself

I just need the
{$item.youtube_id}
to display the youtube_id in the above url

Pls let me know if you are interested
updated by @derrickhand300: 11/19/15 11:21:41AM
brian
@brian
9 years ago
10,148 posts
Which template are you placing the debug code in? In the YouTube_Meta.tpl file? If so that should work as long as $item contains the keys for the YouTube video. However, jrCore_list always returns an _items array - so in that case if you wanted to reference the FIRST youtube video from the list you would do:

{$_items.0.youtube_id}

Arrays always start at index "0" and increment.

Not sure if that is what needed because I am not sure HOW you are getting the YouTube info, but if it is from a jrCore_list call then that's what you need.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 11/19/15 12:50:44PM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Thanks brian
I will try to explain better
I have the debug in the jryoutube_index.tpl right now
I dont think i need a list- i just need a single item
What i am after is the youtube id from a page thst contains a single youtube video player
So if you play a youtube video on my site or my profile the smarty code gets the youtube id of that video and places it in the meta tag ( where i have it in the above code)
updated by @derrickhand300: 11/19/15 01:31:56PM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
But i cant seem to make it happen
QUESTIONS
1-do i need to use the list call when i just want a single youtube id?
2-Is jryoutube_index.tpl the proper place to put the debug to get this information?
updated by @derrickhand300: 11/19/15 01:35:39PM
brian
@brian
9 years ago
10,148 posts
derrickhand300:
But i cant seem to make it happen
QUESTIONS
1-do i need to use the list call when i just want a single youtube id?

It depends - do you KNOW the youtube_id you want to use ahead of time?

Quote:
2-Is jryoutube_index.tpl the proper place to put the debug to get this information?

Do you mean the modules/jrYouTube/templates/index.tpl file?

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Yes I have debug installed in the modules/jrYouTube/templates/index.tpl file
No I dont KNOW the youtube id ahead of time...
I am trying to add this meta tag to the meta.tpl so that the meta.tpl information changes EACH TIME A NEW YT VIDEO IS LOADED

I am TRYING to rework the facebook opengraph meta data on the site which has never worked correctly on any of my JR sites...when I figure it out for this one then I can fix all 3 of my sites

Thanks!
updated by @derrickhand300: 11/19/15 05:52:04PM
derrickhand300
@derrickhand300
9 years ago
1,353 posts
Solved- BIG Thanks to Michael! I finally understand the basics to using the smarty debug console!

Tags