Topic-icon Open Graph - Objects - Tags with php

Active Subscriptions:

None
9 years 6 months ago #47873 by klox7
Hello,

is it possible to create open graph tag with php, something like image=<?php echo $item->image; ?> or can I include only via php file of template?

Regards
The topic has been locked.
Support Specialist
9 years 6 months ago #47875 by mel
You can add an Open Graph tag to any page of your site, including dynamic pages where you need PHP. Wherever HTML is generated, just add the following code:
{SCOpenGraph image=<?php echo $item->image;?>}
PHP will replace the image in the tag and then JFBConnect will parse that tag out during rendering to insert the proper Open Graph tag in the header.

I hope that helps explain, but if not, let us know.

Thanks,
Melissa
The topic has been locked.
Active Subscriptions:

None
9 years 6 months ago #47881 by klox7
Hi Melissa, thanks for answer. Yes I know I can directly insert tags in my php files. I was wondering if I can do it via Objects in admin. I have different custom templates for one component and it seems more convinient not to repeat myself in 5 different templates but to have one solution with Objects in JFBConnect.

Regards
The topic has been locked.
Support Specialist
9 years 6 months ago #47889 by mel
No, you can't do it dynamically using an object in the admin area since each page will be different and your PHP may not work on all pages.

If you're trying to add a dynamic image to an extension, we'd recommend you include the above Open Graph Easy Tag in the layout file of the extension itself, not your template file. Once you do that, you'd only have to set the tag once and not within each template. Depending on the component, you could even add the tag to a spot within the view.html.php files, which render the layout files.

I hope that helps explain,
The topic has been locked.
Active Subscriptions:

None
9 years 5 months ago #48885 by klox7

mel wrote: You can add an Open Graph tag to any page of your site, including dynamic pages where you need PHP. Wherever HTML is generated, just add the following code:

{SCOpenGraph image=<?php echo $item->image;?>}
PHP will replace the image in the tag and then JFBConnect will parse that tag out during rendering to insert the proper Open Graph tag in the header.

I hope that helps explain, but if not, let us know.

Thanks,
Melissa


I'm displaying image on my site like this <?php echo $item->fields_by_id[32]->result;?>

But if I use {SCOpenGraph image=<?php echo $item->fields_by_id[32]->result;?>} it just displays image. It does not parse the tag out during rendering. Do you have any suggestions?

Regards
The topic has been locked.
Support Specialist
9 years 5 months ago #48899 by alzander
The code you're using to display the image is creating the full HTML for displaying the image, including the <img src="..." /> tag. You'll need to determine the proper way to get the image path to the file, and not the full HTML tag.

I hope that helps clarify, but if you need anything else, just let us know.

Also, we see your subscription recently expired for JFBConnect. We hope to have you back as a subscriber soon.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 5 months ago #48937 by klox7
Hmm, now I just inserted {SCOpenGraph description=blabla} and JFBC still uses auto generated one. Is there any configuation for this?

Regarding subscription...I'll be on board as soon as some money pours in ;)
The topic has been locked.
Support Specialist
9 years 5 months ago #48941 by mel
Could you tell me what version you are using? There are a few known bugs in 6.2.2 and earlier where setting Open Graph tags via the {SCOpenGraph...} easy tag sometimes does not work; this was fixed in the 6.2.3 release.

-Melissa
The topic has been locked.
Active Subscriptions:

None
9 years 5 months ago #48942 by klox7
Yes, using Version: 6.2.2
The topic has been locked.
Support Specialist
9 years 5 months ago #48945 by mel
Could you try downloading the file at sourcecoast.com/jfbcsystem_6_2_3/jfbcsystem_v6.2.3.zip and installing in your Joomla backend to see if this helps please?

-Melissa
The topic has been locked.