This object is in archive! 
Adding Open Graph to Responses
Okay so this is a two parter, first is a feature suggestion, second is a question on how to write these variables. So I decided to put it under Idea, please change it to Question if you think it necessary.
I am creating Open Graph meta tags for the different templates in UR. Right now I am working on response.phtml. I have not gotten very far digging through the source code. Here is where I am:
- <meta property="og:site_name" content=""/>
- <meta property="og:title" content="" />
- <meta property="og:url" content=""/>
- <meta property="og:type" content="article"/>
- <meta property="og:description" content="" />
- <meta property="og:image" content="<?php echo ($this->settings->system->general->site_logo->value) ? $this->baseUrl('/public/files/logo/' . $this->settings->system->general->site_logo->value) : $this->imageSrc('branding/logo.png', null, false) ?>" />
- <meta property="article:published_time" content="2014-10-10">
- <meta property="article:section" content="">
- <?php foreach($this->activeResponse->getTags() as $tag):?>
- <meta property="article:tag" content="<?php echo $this->escape($tag)?>">
- <?php endforeach?>
What I need help with is how do I echo the Community Title, Response Title, Response URL, Response Description, Date Created (not relative, but YYYY-MM-DD), and Category (primary, or first)
This will also allow me to write the meta tags for main.phtml:
- <meta property="og:site_name" content=""/>
- <meta property="og:type" content="website"/>
- <meta property="og:image" content="<?php echo ($this->settings->system->general->site_logo->value) ? $this->baseUrl('/public/files/logo/' . $this->settings->system->general->site_logo->value) : $this->imageSrc('branding/logo.png', null, false) ?>" />
And for profile.phtml:
- <meta property="og:site_name" content=""/>
- <meta property="og:type" content="profile">
- <meta property="og:title" content="<?php echo $this->activeResponse->getAuthor() ?>" />
- <meta property="og:url" content="<?php echo $this->url(array('user_id' => $this->activeUser->id), 'profile')?>" />
- <meta property="og:image" content="<?php echo ($this->settings->system->general->site_logo->value) ? $this->baseUrl('/public/files/logo/' . $this->settings->system->general->site_logo->value) : $this->imageSrc('branding/logo.png', null, false) ?>" />
Thanks!
Ken
Hello, Ken.
As I understand you need to get response creation datetime in MySQL format.
So, this is solution:
If you need to get response categories use the following snippet:
Hello, Ken.
As I understand you need to get response creation datetime in MySQL format.
So, this is solution:
If you need to get response categories use the following snippet:
Okay, great start! Can you please tell me how to render these variables to the screen?
Community Title, Response Title, Response URL, Response Description
Thank you!
Okay, great start! Can you please tell me how to render these variables to the screen?
Community Title, Response Title, Response URL, Response Description
Thank you!
The following code should be used inside controller action:
You can pass data to template by using $this->view->yourVar = 'yourVal';
The following code should be used inside controller action:
You can pass data to template by using $this->view->yourVar = 'yourVal';
Replies have been locked on this page!