forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: grantson on June 21, 2010, 03:49:48 pm

Title: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 21, 2010, 03:49:48 pm
Hi Guys

nearly have this working now just need one final piece of the puzzle

gallery is here www.magicmirrorphoto.co.uk/gallery

I now have the meta tags in place on teh displayimage.php page and all works as it should if the gallery is freely browsable
when I set guest users to only be able to see thumbnails the share button gets the correct link but displays magicmirror-login as the page title and does not pick up the thumbnail

what i some help with is knowing which bit of login.php to add the code to inject the meta tag and also how to convert the path to the image from the pid

as always any assistance greatly appreciated
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: Joachim Müller on June 21, 2010, 03:55:36 pm
Use a plugin to inject the meta tag into each and every page. Editing all core files is baaaaad. The proper plugin hook would be page_meta (http://documentation.coppermine-gallery.net/en/dev_plugin_hooks.htm#plugin_hooks_filename_page_meta). Post what you have got for details if you need help. Posting a reference to the facebook api specs might help as well.
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 21, 2010, 04:06:17 pm
Thanks Joachim

the facebook button uses a link www.facebook.com/share.php?u=<url>
then scans teh page for 3 meta tags to fill out its info

<meta name="title" content="title" />
<meta name="description" content="description " />
<link rel="image_src" href="thumbnail_image" / >

i will have a read through the plugin documentation (& probably php manuals) and see what i can do
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 22, 2010, 11:26:39 am
well after all that it doesnt work anyway

I was eventually able to add a couple of lines to joe's custom descriptions plugin which added the 3 lines (statically for a test image admittedly) but alas when I click the button it just posts a link to the login page :(

back to the drawing board
 
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 22, 2010, 02:47:40 pm
Ahha, breakthrough

create a page with the meta tags in the header & then a meta redirect tag

Code: [Select]
<head>
<meta http-equiv="Pragma" content="no-cache" />
<meta name="title" content="<?php echo $pgTitle ?>" />
<meta name="description" content="<?php echo $pgDesc ?> " />
<link rel="image_src" href="<?php echo $thumbUrl ?>" />
<meta HTTP-EQUIV="REFRESH" content="0; url=<?php echo $redirectUrl ?>">
</head>

sofar have only tested this with statically assigned info but facebook picks up the correct title and thumbnail
when the link is clicked the user is redirected to the login page and then to the correct image

I have been studying the display image.php page but am at a loss as to how the Current_Pic_Data[] array is filled
is there a function that does this or do i need to manually populate variables from the database using mysql queries

I cant belive something that looked so simple on the outset is frying so many braincells  ???
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: Joachim Müller on June 22, 2010, 03:55:04 pm
Why don't you post a link to the facebook API for a start...
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 22, 2010, 05:37:45 pm
im going by the list of required meta tags from the developer wiki page

http://wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags (http://wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags)

as I say i now have a partial solution which works but in order to make it dynamic i need to know how to populate the $CURRENT_PIC_DATA[]
so that i can pass the pid as a variable to the intermediate page.

Title: Re: facebook button & dynamic meta tags adding to login page
Post by: papukaija on June 23, 2010, 02:30:01 pm
Why don't you post a link to the facebook API for a start...

And why not test the Facebook plugin (http://forum.coppermine-gallery.net/index.phptopic,60893.msg301962.html#msg301962) from the cpg1.4 board? You probably just need to edit the plugin's configuratione.php to get rid of the version number warning. Details about the edit here (http://documentation.coppermine-gallery.net/en/dev_plugin_api.htm#plugin_api_tutorial_firsthere) and here (http://documentation.coppermine-gallery.net/en/plugins.htm#plugin_manager_install).
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 23, 2010, 04:04:00 pm
Thats what I have done
ive been tweeking it to get it to work properly

ie post a link to the gallery page instead of direct to the image which is what that one does

guess im just going to need to write a php script to query the coppermine database
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: Joachim Müller on June 23, 2010, 06:37:15 pm
You probably just need to edit the plugin's configuratione.php to get rid of the version number warning.
That's bad advice. If things were that easy, we wouldn't have bothered to come up with the version warning in the first place. Every non-trivial plugin needs to be re-written and will not work by just manipulating the version checking routine.

There already is a twitter plugin for cpg1.5.x: flf_zwitscher - Twitter plugin for coppermine (http://forum.coppermine-gallery.net/index.php/topic,63988.0.html)
Title: Re: facebook button & dynamic meta tags adding to login page
Post by: grantson on June 25, 2010, 10:28:44 pm
solved :)

link button points to a new page called shareout.php

shareout.php is populated with dynamic metas and then redirets to displayimage.php

see here :)
http://forum.coppermine-gallery.net/index.php/topic,65697.0.html (http://forum.coppermine-gallery.net/index.php/topic,65697.0.html)