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.
Sign In
Not a member yet? Click here to register.
Forgot Password?
Navigation

Open Graph Modification

Last updated on 9 years ago
S
SGT-TURKEYJunior Member
Posted 9 years ago
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...
F
FalkSuper Admin
Posted 9 years ago
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.
W
WanaboSenior Member
Posted 9 years ago
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?
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.
C
ChanSuper Admin
Posted 9 years ago
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, 9 years ago
S
SGT-TURKEYJunior Member
Posted 9 years ago
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, 9 years ago
C
CatzenjaegerSenior Member
Posted 9 years ago
is this in PHP Fusion 9 available too? we need tis .. social sharing ist veryyyyyyyyyyyyyyyyyy important today
C
ChanSuper Admin
Posted 9 years ago
We already implemented open graph since RC4 I think.
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
You cannot set up a bounty in this discussion thread.
Moderator: Support Team
Users who participated in discussion: Falk, Catzenjaeger, Wanabo, Chan, SGT-TURKEY