How to web page content dynamically sharing on google+? - google-plus

I have website content share on google+. But content sharing on static not sharing on dynamically.
<meta itemprop="name" content="<?php echo $title; ?>">
<meta itemprop="description" content="<?php echo $description; ?>">
<meta property="og:site_name" content="<?php echo $site; ?>">
<meta property="og:url" content="<?php echo $url; ?>" />
<meta itemprop="image" content="<?php echo $image_url; ?>" />
<span>Google+</span>

Related

Adding Text Information in Html Head

This could be something very simple, but I am having a hard time with this. I have to add some additional information into the heading information of a page. The issue is that the information always ends up in the body instead of heading.
Here is the sample code
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<text id="test">
//Wish to add some additional information here
tester
</text>
<title>Test Heading</title>
</head>
<body>
</body>
</html>
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Test Heading</title>
<meta name="description" content="Latest sports news and live scores from Yahoo! Eurosport UK. Complete sport coverage with Football results, Cricket scores, F1, Golf, Rugby, Tennis and more.">
<meta name="keywords" content="eurosport,sports,sport,sports news,live scores,football,cricket,f1,golf,rugby,tennis,uk,yahoo">
</head>
<body>
</body>
</html>
The customer is forcing the browser to behave like IE8; as a result, adding an xml tag in the heading works. Adding a line for IE8 compatibility did the trick for them.
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8;" />
<meta name="viewport" content="width=device-width" />
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<text id="students">
<name>Name</name>
<sCode>122</sCode>
</text>
<title>Test Heading</title>
</head>
<body>
</body>
</html>

PHP : Unidentified Index Error on File Upload

This is my code. I am getting an unidentified index error for the name of the file i.e 'userfile'. It's a very basic code but I don't get where I am going wrong.
<!DOCTYPE html>
<html>
<head>
<title>
File Upload
</title>
</head>
<body>
<h2> Your file contains : <br></h2>
<?php
$handle = fopen($_FILES['userfile']['tmp_name'], "r");
while (!feof($handle)) {
$text = fgets($handle);
echo $text, "<br/>";
}
fclose($handle);
?>
</body>
</html>
This should work to print file content
<!DOCTYPE html>
<html>
<head>
<title>
File Upload
</title>
<form name="myform" action="" method="post" enctype="multipart/form-data">
<input type="file" name="userfile"/>
<input type="submit" name="submit" value="submit">
</form>
</head>
<body>
<h2> Your file contains : <br> </h2>
<?php
$file = file_get_contents($_FILES['userfile']['tmp_name']);
echo $file;
?>
</body>
</html>

Google Plus sharing - wrong image

I'm trying to deal with a strange behavior of G+ sharing.
I wrote two lightweight HTML pages to demonstrate my problem. Those pages are almost identical except images in their bodies. On the first page, the content image is much larger that the og:image. On the second page, the content image is slightly smaller than the og:image.
First HTML page:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:title" content="Test page" />
<meta property="og:description" content="This is page for G+ strange behavior testing." />
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/wikimania2014/thumb/e/e2/Ask-Logo-Small.jpg/250px-Ask-Logo-Small.jpg" />
<title>Test page</title>
</head>
<body>
<div>
<p>Hello world!</p>
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg" />
</div>
</body>
</html>
Second HTML page:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:title" content="Test page" />
<meta property="og:description" content="This is page for G+ strange behavior testing." />
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/wikimania2014/thumb/e/e2/Ask-Logo-Small.jpg/250px-Ask-Logo-Small.jpg" />
<title>Test page</title>
</head>
<body>
<div>
<p>Hello world!</p>
<img src="http://previewcf.turbosquid.com/Preview/2014/07/05__19_56_51/01.jpg90ddaa05-e3a9-4607-b466-29ade8412934Small.jpg" />
</div>
</body>
</html>
The problem is that in the first case, G+ shows the image from the body (ignores og:image). In the second case, G+ shows og:image as expected.
I've also tried using schema microdata, but the behavior is the same.
I share pages using https://plus.google.com/share?url=PAGE_URL.
Solved! The reason was that in the second case, the og:image had smaller width than G+ requires.

Yii, new controller render does not have the same layout like default

i dont get why the new controller im making which is rendering a file in an action does not seem to have the same layout in content like yii generates automatically, the site/index, just like contact and about have their content a bit centered in the content, like some padding or margin, but when i make a new controller, it does look the same, looks a bit ugly being stick to the line where the content begins.
heres the new controller im making:
<?php
class ToolsController extends CController
{
// -----------------------------------------------------------
// Uncomment the following methods and override them if needed
/*
public function filters()
{
// return the filter configuration for this controller, e.g.:
return array(
'inlineFilterName',
array(
'class'=>'path.to.FilterClass',
'propertyName'=>'propertyValue',
),
);
}
public function actions()
{
// return external action classes, e.g.:
return array(
'action1'=>'path.to.ActionClass',
'action2'=>array(
'class'=>'path.to.AnotherActionClass',
'propertyName'=>'propertyValue',
),
);
}
*/
public function actionIndex()
{
$this->render('index');
}
}
and its just rendering this:
<h1>hello</h1>
im missing something?
sorry heres the layout:
<?php /* #var $this Controller */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<!-- blueprint CSS framework -->
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/dist/css/bootstrap.css">
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>
<body>
<div class="container" id="page">
<div id="header">
<div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div>
</div><!-- header -->
<div id="mainmenu">
<?php $this->widget('zii.widgets.CMenu',array(
'htmlOptions'=>array('class'=>'nav nav-pills'),
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
array('label'=>'Contact', 'url'=>array('/site/contact')),
array('label'=>'Tools', 'url'=>array('/tools/index')),
),
)); ?>
</div><!-- mainmenu -->
<?php if(isset($this->breadcrumbs)):?>
<?php $this->widget('zii.widgets.CBreadcrumbs', array(
'links'=>$this->breadcrumbs,
)); ?><!-- breadcrumbs -->
<?php endif?>
<?php echo $content; ?>
<div class="clear"></div>
<div id="footer">
Copyright © <?php echo date('Y'); ?> by My Company.<br/>
All Rights Reserved.<br/>
<?php echo Yii::powered(); ?>
</div><!-- footer -->
</div><!-- page -->
</body>
</ht
ml>
Quick fix is:
public $layout='//layouts/myLayout';
Pretty sure you can also set it in the Base Controller also

How can you add Rich Pins Meta Tags for Bigcommerce?

I'd like to enable my Bigcommerce website for Rich Pins in Pinterest. What are the appropriate meta tags to do this?
The above is incorrect, it should actually be as follows:
<meta property="og:type" content="product" />
<meta property="og:price:amount" content="%%GLOBAL_ProductPrice%%" />
<meta property="og:price:currency" content="USD" />
<meta property="og:availability" content="in stock"/>
Below are the rich pins meta tags that you can put it in your Bigcommerce template
File. product.html
just after %%Panel.HTMLHead%%
<meta property="og:type" content="product" />
<meta property="product:price:amount" content="%%GLOBAL_RetailPrice%%"/>
<meta property="product:price:currency" content="AUD" />
<meta property="og:availability" content="in stock"/>
All others tags are already provided from BigCommerce Template
in HTMLhead.html file
%%GLOBAL_AdditionalMetaTags%%
But if something is missing here is the full list you can use in addition to above.
<meta property="og:site_name" content="YOURSITE.COM" />
<meta property="og:title" content="%%GLOBAL_ProductName%%" />
<meta property="og:url" content="%%PageContent%%" />
<meta itemprop="description" content="%%ProductDescription%%" />
<meta property="og:image" content="%%GLOBAL_ThumbImageURL%%"/>
Unfortunately, neither will work if you load additional products on your page, for example with "Related" or "Recently Viewed" blocks as it will load the last product on the page as the product price.
Instead you can use the Schema.org Semantic Markup option instead.
The following code at the bottom of my productdetails.html page passed the Pinterest validator.
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="%%GLOBAL_ProductName%%" />
<meta itemprop="image" content="%%GLOBAL_ThumbImageURL%%" />
<meta itemprop="description" content="%%Page.MetaDescription%%">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="%%GLOBAL_ProductPrice%%">
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="availability" itemtype="http://schema.org/ItemAvailability" content="http://schema.org/InStock" />
</div>
</div>