In my recent post: Google AdSense Now Logs Into Your Sites I mentioned that displaying a quick preview of your content might be useful in some scenarios.在我最近帖子: 现在谷歌的AdSense登录到您的网站,我提到,展示了快速预览您的内容可能是有用的一些情景。Particularly if you want to charge subscription fees for full content. I’ll illustrated with an example so you can get an idea of where to start in accomplishing this with your own sites.尤其是如果您想收取订阅费的全部内容。表明我会用一个例子,让您能够了解哪里开始完成这一与您自己的网站。The key component in making this work is the substr ($content,0,300) function.的重要组成部分,使这项工作是substr ( $内容, 0300 )的功能。You specify the length of content by declaring a start (0) and the end (300).您可以指定长度的内容,宣布启动( 0 )和结束( 300 ) 。You can then output a shortened version of $content and store it in a separate variable.然后,您就可以输出缩短为内容并将其存储在一个单独的变量。Great to use as a “preview” for your content.大使用作为一个“预览”为您的内容。Note: the number refers to the numbers of characters in the provided string, not words.注:数量指的是数字中的字符所提供的字符串,而不是言辞。
What you need to do is figure out the existing variables you’re outputting on each content page (likely found within your template).你需要做的是找出现有的变数你输出的每个内容页(可能内发现您的范本) 。This part goes beyond the scope of this article.这部分超出了本文的范围。All sites are set up with slightly differently variables and even grab content from different sources…this is not an exact science.所有网站都设立了略有不同的变量,甚至抓斗的内容从不同来源...这不是一个精确的科学。
I will assume your data is coming from a mySQL database and $id is a number that refers to a row of content in your database.我将承担您的数据是来自MySQL数据库美元和编号是一个号码,是指连续的内容在您的数据库。This first snippet shows a row being queried in preparation for it to be cut down into a preview.这是第一个片段显示,连续受到质疑,准备将其降低到一个预览。
$result=mysql_query("SELECT id,content FROM table WHERE id={$id}",$db);
This is even easier when you already have your content in a string.这是更容易当你已经有了您的内容字符串。In that case you wouldn’t have to run a query on it again.在这种情况下你就不会运行查询一遍。There are also applications in which you would want to have this preview show before you content.也有应用在您希望有此之前预览显示您的内容。In that case you would only need to integrate something like this into your templates (and yes there is more then one way to do this):在这种情况下你只需要把这样的事情到您的模板(和肯定有更多然后一个途径做到这一点) :
In my alternate configuration where visitors need to purchase access you should also change your first if statement to check if a user is logged in by doing:在我的候补配置,游客需要购买机会,你也应该改变你的第一个if语句来检查,如果用户登录在做: if(isset($go) && isset($user))如果( isset ( $去) & & isset ( $用户) )
There’s some security and usability you need to consider when implementing this which I didn’t get into.这里也有一些安全和可用性则需要考虑何时执行本,我没有进入。As shown above isset () is another very handy function in php as it allows you to set triggers in conjunction with if statements.如上所示isset ( )是另一个非常有用的功能在PHP ,因为它让您可以设定触发与if语句。This can make a webpage very dynamic.这可以使一个网页非常活跃。
Danny Cooper : I have a blog in a very rare niche, most people, around 80%, who search for it...丹尼库珀 :我有一个博客中一个非常罕见的壁龛,大多数人,约80 % ,谁搜寻...- [Go To Post]-[转到邮政]
Google Android appears to be really taking off now.谷歌机器人似乎是真的走了。http://www.androidapps.com - Lots of cool apps already. http://www.androidapps.com -许多应用程序已经降温。Maybe I'll pick one up soon.也许我会选择一个很快。
Wordpress Usability Testing Report: 2.5 - http://twurl.nl/oneas2 - Ironically I almost went to college at Ball State. WordPress的可用性测试报告: 2.5 -h ttp://twurl.nl/oneas2-具有讽刺意味的我几乎上了大学在球的国家。
Drupal 6.x to 6.6 are unusually easy. Drupal 6.x的6.6异常容易。Makes me suspicious.让我怀疑。
10 Ways To Analyze AdSense Analytics To Make More Money http://tinyurl.com/5qq7tx 10个方法来分析AdSense的分析,以赚更多的钱http://tinyurl.com/5qq7tx
A lot of changes going on with Google Analytics: http://analytics.blogspot.com.很多改变目前正在同谷歌分析: http://analytics.blogspot.com 。Some of which will be helpful in making money online =)其中一些将有助于赚钱在线= )
How Often To Post New Content On Your Website Or Blog http://tinyurl.com/58ugms多久后新的内容在您的网站或博客http://tinyurl.com/58ugms
发表评论: