Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Open Graph Modification

Asked Modified Viewed 3,839 times
S
SGT-TURKEY
S
.:: We have success the difficult, impossible that is just takes time ::.
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 8 threads in the forums
  • Started this discussions
asked
Junior Member

Hi everybody, a lot of social network web site are not read open graph meta tags v7 or other versions.

So I have changed some codes header.php and output_handling_includes.php.

It works no problem...

1. header.php -> addes

echo "<meta property='og:url' content='A' />\n";
echo "<meta property='og:type' content='B' />\n";
echo "<meta property='og:title' content='C' />\n";
echo "<meta property='og:description' content='D' />\n";
echo "<meta property='og:image' content='E' />\n";


2. output_handling_include.php -> added

$fusion_open_graph = array(
   "property='url'"       => $settings["siteurl"],
   "property='type'"       => "Haberler",
   "property='title'"       => $settings["sitename"],
   "property='description'" => $settings['description'],
   "property='image'"       => $settings["sitebanner"]
);

function set_graph($name, $content=""){
   global $fusion_open_graph;
   $fusion_open_graph[$name] = $content;
}


and added function handle_output($output)

   if(!empty($fusion_open_graph)){
      foreach($fusion_open_graph as $name => $content){
         $output = preg_replace("#<meta property='og:$name' content='.*' />#i", "<meta property='og:".$name."' content='".$content."' />", $output, 1);
      }
   }



USAGE:

set_graph("title","A);
set_graph("description","B");
set_graph("type","C");
set_graph("url","D");
set_graph("image","E");

this is importand modification about php-fusion v7 or other versions...
0 replies

6 posts

F
Falk
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
answered
Super Admin

Very nice addition, I will actually bring it up with Chan and see if he shares my view. If we cant use this for 9. Currently we have OG in 9 ( Not everywhere) but it is hardcoded to templates and connected to settings, to handle it with an output handler is a much better approach imho.
0 replies
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
answered
Senior Member

Very interesting! I tried this on a v7.02.07 site but it does not work for me.
Also followed this guide, http://www.fusiontr.com/forum/viewthread.php?thread_id=6041&pid=44670#post_44670

@SGT-TURKEY
Do you offer English support on fusiontr.com?
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Well, we have output handling in 9 is preoccupied with few things:

1. SEO handling - conversion of all links on buffer
2. Error page handling - conversion of all paths depending on server url in non-seo and seo mode.

Might be others as well, but I can't confirm here. Anyway, we have / might have issues with 1 & 2 items. Adding a 3rd element for this will make life difficult on top of current problems. We need all hands from the community to assist us in github in this matter. :)

----

On my opinion on OG meta , V7 don't have templates therefore it relies plenty on modifications using output handling to distort replace. In V9, you can directly edit the whole HTML. Why need to handle output? Output handling is used when you don't have access to the HTML files. See V7 forum, news .. those are uncustomizable. Preg rules are slow. I'd recommend to directly hardcode in templates if you want to override.
Edited by Chan on 12-06-2016 04:42,
0 replies
S
SGT-TURKEY
S
.:: We have success the difficult, impossible that is just takes time ::.
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 8 threads in the forums
  • Started this discussions
answered
Junior Member

Hi again...

This modification is for version 7. In version 7 do not have the Open Graph integration. That's I made some modification header.php and output_handlings_include.php

For those who want to use ( for standart templates);

1. Open header.php in themes/temaplates/ and add this codes after meta
echo "<meta property='og:url' content='A' />\n";
echo "<meta property='og:type' content='B' />\n";
echo "<meta property='og:title' content='C' />\n";
echo "<meta property='og:description' content='D' />\n";
echo "<meta property='og:image' content='E' />\n";


2. open output_handling_include.php in infusions folder and add this codes

after $fusion_page_meta lines

// Open Graph property array
$fusion_open_graph = array(
   "property='url'"       => $settings["siteurl"],
   "property='type'"       => "News, Articles, Photogallery etc...",
   "property='title'"       => $settings["sitename"],
   "property='description'" => $settings['description'],
   "property='image'"       => $settings["sitebanner"]
);

// This usage function
function set_graph($name, $content=""){
   global $fusion_open_graph;
   $fusion_open_graph[$name] = $content;
}



And add same file (output_handling_include.php) before return output in handle output function

   if(!empty($fusion_open_graph)){
      foreach($fusion_open_graph as $name => $content){
         $output = preg_replace("#<meta property='og:$name' content='.*' />#i", "<meta property='og:".$name."' content='".$content."' />", $output, 1);
      }
   }



How to use set_graph function?

in news.php, articles.php, photogallery.php or viewpage.php or forum files...


set_graph("title",$data["news_subject"]);
set_graph("description",$data["news_news"]);
set_graph("type","News - ".$data["news_cat_name"]);
set_graph("url","http://xxx.com/news.php?readmore=".$data["news_id"]."");
set_graph("image",IMAGES_N_T.$data["news_image_t2"]);



How To Use page meta ( standart php-fusion codes)

set_title("Title");
set_meta("description","your description");
set_meta("keywords","your keywords");

I can develop extended v7 mods or modification for you. I stuck to the generally fusiontr.com turkish or english language

Thank you very much.. ( I Learn php and jquery from php-fusion forums). Thanks all developer and thanks dear Nick Johns...

Merged on Jun 12 2016 at 23:04:08:

Quote

Very interesting! I tried this on a v7.02.07 site but it does not work for me.
Also followed this guide, http://www.fusiontr.com/forum/viewthread.php?thread_id=6041&pid=44670#post_44670

@SGT-TURKEY
Do you offer English support on fusiontr.com?
- by Wanabo



I you open news thread for english language, I can write to you back english... I'm online veryday at fusiontr.com
Edited by SGT-TURKEY on 12-06-2016 23:04,
0 replies
— 3 months later —
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
answered
Senior Member

is this in PHP Fusion 9 available too? we need tis .. social sharing ist veryyyyyyyyyyyyyyyyyy important today
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

We already implemented open graph since RC4 I think.
0 replies

Category Forum

SEO & SEF - 9

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 5 members

5 participants

F
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
W
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
S
S
.:: We have success the difficult, impossible that is just takes time ::.
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 8 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet