php - I want a like button that contains custom parameters, how can I do that? -
i want insert facebook button page: <div class="fb-like" data-href="http://www.site.com/news/b_news.php" data-send="false" data-layout="box_count" data-width="450" data-show-faces="true"></div>
i want pass custom parameters every single article have. example, have index.php?function=news&id=33
, , whenever article id 33, want article's title , image liked page's image , title appearing on facebook. know these meta tags, static pages, since i've got 1 in website , meta tags should this: <meta content="'.$new['id'].'" property="og:description"></meta>
i'm fetching description data array, database. how can solve this?
just set meta tags dynamically (pseudo-code below):
// controller // default values $view->meta_title = 'hello'; $view->meta_image = 'http://image'; $article = model_article($id) if ($article->loaded()) { $view->meta_title = $article->title $view->meta_image = $article->image_url(); } // view <html> <meta property="og:title" content="<?php echo $meta_title ?>"> <meta property="og:image" content="<?php echo $meta_image ?>"> <!--.......-->
Comments
Post a Comment