Файл: seo2.php
Строк: 59
<?php
/*
* We need to include the class at first
*/
include_once("seo.class.php");
/*
* We also need some text to work with
* Note: We can also work with external files on the web!
*/
$text = file_get_contents("http://test.loneswan.net/text.txt");
/*
* Lets see what we can do with SeoHelper
*/
$seo = new SeoHelper();
$seo->setText($text);
$seo->setMinKeywordLength(1);
$seo->setBannedWords(array('should','helper'));
?>
<!-- This is the styling of the tag cloud. You can customize it to meet your needs. .tag-cloud is the parent element and the inner links have the class .tag-cloud -->
<style>
.tag-cloud {
width: 300px;
}
.tag-cloud a {
float: left;
padding: 3px;
margin: 3px;
background: #333;
color: white;
text-decoration: none;
}
</style>
<b>Example text:</b><br>
<p>You can seee the text is full of HTML tags, HTML entities, doubles spaces and another garbage which can appear on any website.</p>
<code><textarea rows="5" cols="100"><?php echo $seo->getText()?></textarea></code>
<br><br>
<?php
$keywords = $seo->getKeywords(12);
$desc = $seo->getDescription(150);
$seo->setTagcloudLink("http://somesubdomain.yoursite.com/somepath/keyword/<keyword>"); // you can set your own tag cloud link. <keyword> will be replaced with exact keyword. Could be usefull to fetch some articles by tag for example.
$tagcloud = $seo->getTagcloud($seo->getKeywordsArray(15));
echo '<br><b>Description:</b> '.$desc;
echo '<br><b>Keywords:</b> '.$keywords;
echo '<br><b>Tag cloud:</b><br><br>' . $tagcloud;
$pr = $seo->googlePagerank('http://google.com');
echo "<br style="clear: both"><br>Google.com pagerank is " . $pr . " while Codecanyon.net pagerank is " . $seo->googlePagerank("http://codecanyon.net");
?>.