Set avatar as image_src meta tag for proper bookmarking

Need some help with the script?

Set avatar as image_src meta tag for proper bookmarking

Postby nam » Wed Jun 03, 2009 12:18 am

For proper bookmarking of any page on Facebook three meta tags are suggested by FB, "title", "description" and "image_src".

I did two of them but have problem with the 3rd one.

I want to set avatar of any story as image_src. It should look like this:

Code: Select all
<link rel="image_src" href="http://......./image.jpg" />


What I want:

Code: Select all
<link rel="image_src" href="
   <?php
    if [avatar] exists
              insert full link to avatar.
    else
            set news.gif;
    ?>
/>


Can anyone give me the proper code based on the above pseudocode?
User avatar
nam
 
Posts: 221
Joined: Sat Dec 23, 2006 9:10 pm

Postby FI-DD » Sat Jun 06, 2009 9:56 pm

In inc/show.news.php find this:
Code: Select all
$output = str_replace('{avatar-url}', $row['avatar'], $output);


and add below:
Code: Select all
$output = str_replace('{image-src}', '<link rel="image_src" href="'.($row['avatar'] != '' ? $row['avatar'] : 'news.gif').'" />', $output);


Now you should be able to use {image-src} in your template.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby nam » Sat Jun 06, 2009 10:22 pm

FI-DD wrote:In inc/show.news.php find this:
Code: Select all
$output = str_replace('{avatar-url}', $row['avatar'], $output);


and add below:
Code: Select all
$output = str_replace('{image-src}', '<link rel="image_src" href="'.($row['avatar'] != '' ? $row['avatar'] : 'news.gif').'" />', $output);


Now you should be able to use {image-src} in your template.


Thanks for great help, but I should insert it in the HEAD of the document, which is outside of the templete area. Can you write me how can I insert it in the PHP file directly.
User avatar
nam
 
Posts: 221
Joined: Sat Dec 23, 2006 9:10 pm

Postby nam » Sun Aug 09, 2009 4:33 pm

nam wrote:Thanks for great help, but I should insert it in the HEAD of the document, which is outside of the templete area. Can you write me how can I insert it in the PHP file directly.


still need some help.
User avatar
nam
 
Posts: 221
Joined: Sat Dec 23, 2006 9:10 pm

Postby DistantJ » Wed Aug 12, 2009 12:19 am

You could create a template which has nothing but {image-src} and use an include to display it in the title...

You'd have to set the ID and stuff so that it displays it on the page as well I guess.
DistantJ
 
Posts: 33
Joined: Tue Jul 29, 2008 10:27 am


Return to Help



Who is online

Users browsing this forum: No registered users and 4 guests

cron