PHP - Meta Keyword, Title And Description - Duplicate Problem
On the index page of http://www.sportskevesti.co i have the meta tags of Title, Description, Keyword.... and other element, but it is necessary to show them in name of the other pages, socer, basketbal, handbal, tennis...., and there fore news spetial.
in this moment, i have this meta tag double. for example: www.sportskevesti.co/index.php Quote <meta name="title" content="Sportske Vesti"> <meta name="description" content="Najnovije sportske vesti iz Srbije i ostatka sveta. Sve na jednom mestu."> <meta name="keywords" content="sport, vesti, fudbal, tenis, kosarka, odbojka, rukomet, auto, moto, trke"> http://sportskevesti.co/index.php?opcija=vest&vest_id=60067 Quote <meta name="title" content="Sportske Vesti"> <meta name="description" content="Najnovije sportske vesti iz Srbije i ostatka sveta. Sve na jednom mestu."> <meta name="keywords" content="sport, vesti, fudbal, tenis, kosarka, odbojka, rukomet, auto, moto, trke"> <meta name="title" content="Danas je derbi!" /> <meta name="description" content="Na stadionu Crvene zvezde danas se igra ..." /> <meta name="keywords" content="danas, derbi, "/> Since I assume that this is not good for SEO optimization, how to avoid this and show only one meta per page ? Similar TutorialsHi I am trying to pull title and meta description from an URL.. To pull the URL I am using the code from http://www.dreamincode.net/code/snippet4625.htm... function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match("/\<title\>(.*)\<\/title\>/",$str,$title); return $title[1]; } } //Example: echo getTitle("http://www.cnn.com"); And to pull the meta description I am using the code from http://php.net/manual/en/function.get-meta-tags.php. // Assuming the above tags are at www.example.com $tags = get_meta_tags('http://www.cnn.com/') or die("Could not fetch meta tags"); // Notice how the keys are all lowercase now, and // how . was replaced by _ in the key. echo $tags['author']; // name echo $tags['keywords']; // php documentation echo $tags['description']; // a php manual echo $tags['geo_position']; // 49.33;-86.59 So my complete code looks like this: <html> <head> </head> <body> <?php function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match("/\<title\>(.*)\<\/title\>/",$str,$title); return $title[1]; } } //Example: echo getTitle("http://www.cnn.com"); // Assuming the above tags are at www.example.com $tags = get_meta_tags('http://www.cnn.com/') or die("Could not fetch meta tags"); // Notice how the keys are all lowercase now, and // how . was replaced by _ in the key. echo $tags['author']; // name echo $tags['keywords']; // php documentation echo $tags['description']; // a php manual echo $tags['geo_position']; // 49.33;-86.59 ?> Test! </body> </html> But it wont work... All I get is "Could not fetch meta tags".. I've tried different URLs and such but still wont work .. Anyone have an idea? This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=322718.0 Hi I have the following code, this code is suppose to get the data from the galleries table and the pages table. I think my problem is the sql statement but I'm not sure. Code: [Select] public function galleries(){ foreach($this->_params['list'] as $gallery){ $id = $gallery['id']; $name = $gallery['name']; $select = "SELECT * FROM pages, galleries WHERE pages.name = {$gallery['name']}"; $this->_params['item'] = $this->_model->get(array("pages.name = 'galleries.name'")); } the code Code: [Select] $this->_params['item'] = $this->_model->get(array("pages.name = 'galleries.name'")); works just fine with the home page and all the other pages. I have 2 galleries called gallery 1 and gallery 2, now my problem is that I need the sql to go through the galleries table look for the name and then look through the pages table and get the meta data from the same name. There is no foreign id because I only need it for the galleries and nothing else. Thank you so i set names for every pages, like $pageName = 'home'; //index page Code: [Select] if($pageName == 'categories'){ $find = "Birds & Bees"; $result = strpos($title,$find); echo '1'; }else if($pageName == 'categories'){ $find1 = "Money & Honey"; $result = strpos($title,$find1); echo '2'; } now the issue is with categories.php page, which is just one page but displays different title and according to matching title i wish to change the description but its not happening, everywhere only 1 prints, why? Hello Every one Please see my code <?php include ("includes/config.php"); $afurl = $_SERVER['REQUEST_URI']; $afurl = preg_replace('/\/+/', '', $afurl); $afurl = preg_replace('/\;+/', '', $afurl); $afurl = preg_replace('/\&+/', '', $afurl); $afurl = preg_replace('/\#+/', '', $afurl); $afurl = preg_replace('/\|+/', '', $afurl); $afurl = preg_replace('/\@+/', '', $afurl); $afurl = preg_replace('/\%5B+/', '', $afurl); $afurl = preg_replace('/\%5D+/', '', $afurl); $afurl = preg_replace('/\%27+/', '', $afurl); $afurl = preg_replace('/\%C2+/', '', $afurl); $afurl = preg_replace('/\%BB+/', '', $afurl); $afurl = preg_replace('/quot+/', '', $afurl); $afurl = preg_replace('/\%E2+/', '', $afurl); $afurl = preg_replace('/\%80+/', '', $afurl); $afurl = preg_replace('/\%93+/', '', $afurl); $afurl = preg_replace('/\$+/', 'c', $afurl); $afurl = preg_replace('/\"+/', '', $afurl); $afurl = preg_replace('/\?+/', '', $afurl); $afurl = preg_replace('/\.html+/', '', $afurl); $afurl = preg_replace('/\-+/', ' ', $afurl); $queryArray = explode(" ", $afurl); for ($i=0; $i< count($queryArray); $i++) { $keyworddd = mysql_real_escape_string($queryArray[$i]).","; echo $keyworddd; } ?>I Want Set $keyworddd at he <meta name="keywords" content="$keyworddd"> Can anyone tell me how to do this please? Hallo all, I am running a coupon website which will promote some website using coupons. I am using wordpress CMS. I would like to ask if somebody here could give me some enlightenment. I am using wordpress now and I would like everytime I post a coupon for a website like www example1. com it will automatically retrieve meta keywords value <meta name="keywords" content="perfume, fragrances, aftershave cosmetics, skin care, body, bath, beauty, products, moisturisers" /> examples. the script will automatic retrieve content from meta keywords and post it as a tag value on my posting. could anyone help me? thanks Hi there, Please forgive my ignorance as i am a noob. I have a website and the page title, keywords and description are taken from this .conf file: base = /home/websitem/public_html/worms/ url = http://www.websitemakeover.co.za/worms/ host = localhost user = websitem_worms pass = ***** data = websitem_worms subject = The Organic Grow Shop shop_email = do-not-reply@organicgrowshop.co.uk shop_name = The Organic Grow Shop domain = websitemakeover.co.uk admin_email = ron@rondarby.com subjectToClient = Your Purchase from The Organic Grow Shop subjectToAdmin = A purchase was made on the website pay_email = ron_1320155944_biz@rondarby.com pay_currency = GBP #pay_url = https://www.paypal.com/cgi-bin/webscr pay_url = https://www.sandbox.paypal.com/cgi-bin/webscr [home] title = Buy worm castings, perlite, vermiculite, clay pebbles keywords = Worm castings, perlite, guano, organic gardening, hydroponic growing media, soil mixes, plagron, bio bizz, all-mix, organic fertilisers, organic nutrients, hydroponics. description = We sell organic fertilisers, worm castings, guano, perlite, vermiculite, clay pebbles, soil enhancers and conditioners to make your own soil mixes [about] title = About Us keywords = Worm castings, perlite, guano, organic gardening, hydroponic growing media, soil mixes, plagron, bio bizz, all-mix, organic fertilisers, organic nutrients, hydroponics. description = We sell organic fertilisers, worm castings, guano, perlite, vermiculite, clay pebbles, soil enhancers and conditioners to make your own soil mixes [contact] title = Contact Us keywords = Worm castings, perlite, guano, organic gardening, hydroponic growing media, soil mixes, plagron, bio bizz, all-mix, organic fertilisers, organic nutrients, hydroponics. description = Contact The Organic Grow Shop here. An organic grow shop representative will be in touch shortly. [casting] title = Worm Castings - Buy worm castings, organic soil mix at The Organic Grow Shop. Made in the UK! Keywords = Worm castings, worm tea, worm poop for hydroponics, soil mixes, plagron bat mix, organic fertiliser, vermicompost, worm castings uk, organic soil mix cannabis, organic soil, worm cast, organic soil mix, soil mixes, organic soils, natural fertilisers. description = Worm castings - mmm, wormy goodness. We've teamed up with our local worm farm to bring your this fantastic 100% natural organic plant fertilser and soil conditioner to make your own soil mixes. [perlite] title = Perlite - Buy Perlite, Vermiculite. [cart] title = Shopping Basket [checkout] title = Details to Checkout [paypal] title = Redirect to PayPal I have tried editing it but the titles don't change?? Do i need to do something else to get this to change? Your help would be really appreciated, desperately need to get this sorted! Matt I looked for and found a similar thread, but the resulting bunny trail was specific to that OP's situation. I'll jump right to it. I've seen this done on another site, and I want to implement it the same way on another site I'm doing. Any typical page of the site will have includes files, quite a few of them nested like those little russian dolls. For instance, the about us page calls includes/header.php... <?php include("includes/header.php") ?> ...and the header.php file calls the meta information... <?php include("includes/site_titles.php") ?> <?php include("includes/site_keywords.php") ?> <?php include("includes/site_descriptions.php") ?> ...and those files have arrays... <?php $SITE_TITLES = array(); $SITE_TITLES['about_us'] = $SITE_TITLE . " About Us"; $SITE_TITLES['page2'] = $SITE_TITLE . " page2"; $SITE_TITLES['page3'] = $SITE_TITLE . " page3"; ?> ...and going back to our header.php, in the appropriate place, we echo the title and meta... <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?=$SITE_TITLES[$page]?></title> <meta name="description" content="<?php echo $SITE_DESCRIPTIONS[$page]?>" /> <meta name="keywords" content="<?php echo $SITE_KEYWORDS[$page]?>" /> ...which, when uploaded, *should* display in "view source" the correct title tag, keywords, and description. However, when I do this, I get empty tags. Am I supposed to define the site variable ($SITE)? Or am I doing something else wrong? I have the original source where I first saw this in Dreamweaver, but am unable to find a file where $SITE and all it's little buddies are defined to correspond with a file name ('about' = ("about.php"). Any help or advice is greatly appreciated. Myotch Hi Everyone, I need some help which I think should not take long to figure out but I need help with it regardless. This is through wordpress. My issue is that my navigation has categories. Like Web design, Web Marketing, and Graphic design. I downloaded All in one SEO pack and everything is great up to the point where I can't add a title to the categories. When you click on the categories in the navigation the title doesn't change to what I set it to. But the description and all other meta tags are fine. I do have: Code: [Select] <head profile="http://gmpg.org/xfn/11"> <link rel="shortcut icon" href="http://www.newmediasources.ca/images/pt-logo.png"/> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <?php wp_head(); ?> <link href="<?php bloginfo('template_directory'); ?>/style.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/ddsmoothmenu.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/prettyPhoto.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/nivo-slider.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.form.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/ddsmoothmenu.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.nivo.slider.pack.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.prettyPhoto.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/custom.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/cufon-yui.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/Museo_Slab_500_400.font.js"></script> <!-- Cufon init --> <script type="text/javascript"> <?php if(get_option('boldy_cufon')!="no"):?> Cufon.replace('h1',{hover: true})('h2',{hover: true})('h3')('.reply',{hover:true})('.more-link'); <?php endif ?> </script> <script type="text/javascript"> $(document).ready(function(){ $('#quickContactForm').ajaxForm(function(data) { if (data==1){ $('#success').fadeIn("slow"); $('#bademail').fadeOut("slow"); $('#badserver').fadeOut("slow"); $('#contact').resetForm(); } else if (data==2){ $('#badserver').fadeIn("slow"); } else if (data==3) { $('#bademail').fadeIn("slow"); } }); }); </script> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_get_archives('type=monthly&format=link'); ?> <?php //comments_popup_script(); // off by default ?> </head> in header.php so it should be okay. I tried removing the title tag thinking it will add it itself but it didn't. Any ideas? Thank you for your time. I feel like a moron asking this question as it seems to be one of the most common things done with php but I cannot find a tutorial (probably because I don't know the correct wording to search under) on this specific thing.. Anyhow. I'm spitting out a list of the Titles of my test table like so (and its working as expected): <?php $posting_sql = "SELECT * FROM postings"; $posting_results = (mysqli_query($cxn, $posting_sql)) or die("Was not able to grab the Postings!"); while($posting_row = mysqli_fetch_array($posting_results)) { echo "<li><a href='posting_details.php'>$posting_row[title]</a></li>"; } ?> Now as you can see: <a href='posting_details.php'> I am calling a new page, and that page contains this: <h2><?php echo "$posting_row[title]"; ?></h2> <p><?php echo "$posting_row[description]"; ?></p> It's no surprise it's not working (with many variations etc), but I am only familiar with using <form> GET or POST, and these of course are not form elements, so I cant seem to call them the same way. My suspicion (and from the research data I could find) is that I need to pass values in my link: <a href='posting_details.php'> ... I could not get it to work, but I was trying variations like: <a href='posting_details.php?get[title&get[description]]'> but it seems like I am screwing things up even more by doing this.. Anyhow. If anyone could show me a tutorial that covers this specifically or some suggestions on the best approach to this would be much appreciated.. Hi Friends ! I need to discuss a problem with you. When we fill a customer info form, and redirect to other page. but go back by browser's back button and resubmit the form. In this case duplicate data is inserted. Or when we refresh a page multiple data is inserted, so HOW TO AVOID this terrible problem ? Hi... Before I have no problem in using On Duplicate Key, but now i have because of using time function. Before I only have insert query: Code: [Select] $result = mysql_query("INSERT INTO regular_sum_hours(EMP_NO, Hours) SELECT EMP_NO, sec_to_time(SUM(time_to_sec(Rendered))) FROM regular_dtr_total GROUP BY EMP_NO") or die(mysql_error()); And now I think that I need to add a syntax for Update, so i revise my code: Code: [Select] $result = mysql_query("INSERT INTO regular_sum_hours(EMP_NO, Hours) SELECT EMP_NO, sec_to_time(SUM(time_to_sec(Rendered))) FROM regular_dtr_total GROUP BY EMP_NO ON DUPLICATE KEY EMP_NO = EMP_NO, Hours = sec_to_time(SUM(time_to_sec(Rendered)))") or die(mysql_error()); and I got a problem in this part: Hours = sec_to_time(SUM(time_to_sec(Rendered)))") Thank you I have problem with PHP module for meta search engine, this module takes image results from google and sends it to meta search engine as a result. But it is not working, there is a problem in PHP code witch i have no idea how to find and fix. Code: [Select] <?php class image_google { function image_google() { $this->profile = array( 'site_name' => 'Google', 'site_url' => 'http://www.google.com', 'request_url' => 'http://www.google.com/search?q=$e_qry_str&site=images&tab=wi&start='.(20*($_REQUEST['d']-1)), ); } function parse_results(&$output) { #echo $output; # debug $results = array(); if(preg_match_all('{imgurl=(.*?)&imgrefurl=(.*?)&}is',html_compress(remove_code($output)),$matches,PREG_SET_ORDER)) { $last_match = ''; foreach($matches as $r) { $result = array( 'real_url' => html_decode($r[2]), 'follow_url' => html_decode($r[1]), 'image_url' => html_decode($r[1]), 'title' => html_decode($r[1]), 'description' => html_decode($r[1]), ); array_push($results,$result); $last_match = &$r[0]; } if($last_match) { $offset = strpos($output,$last_match)+strlen($last_match); $output = substr($output,$offset); } } #var_export($results); # debug return $results; } } ?> On one of my pages I set the title like this Code: [Select] <{assign var="title" value=$people->getShow()|escape}> The problem is I want the title to say getShow and getName Tried to do it like this but I get an internal 500 error Code: [Select] <{assign var="title" value=$people->getShow()|escape}$people->getName()|escape}> How can I make this work? Thanks in advance I've got this code Code: [Select] <{assign var="title" value=$people->getTitle()|cat:" "|cat:$people->getName()|cat:" | Sea.com"}> How do I write some text fx. 'visit' in the beginning of the title value? Tried to do it like this Code: [Select] <{assign var="title" value=Visit $people->getTitle()|cat:" "|cat:$people->getName()|cat:" | Sea.com"}>But then I get an error. Any help mych appriciated I have here what I would refer to as doozy. I'm not sure anyone is going to be able to help as there is allot involved. The issue could be in a number of locations, I am using PHPUnit as a test suite (and this is how I have found the issue) and PHP5.4rc5. The problem could be in either, or it could be in my code. I am also using a cascading filesystem (explained here) and while I'm confident this isn't the issue. It has the potential to be involved I guess. If you need to see how this is implemented it is see he https://github.com/proem/proem/blob/develop/lib/Proem/Api/Autoloader.php#L108 I have narrowed the problem down to two classes: https://github.com/proem/proem/blob/develop/lib/Proem/Api/Chain.php & https://github.com/proem/proem/blob/develop/lib/Proem/Api/Proem.php The tests that test these classes a https://github.com/proem/proem/blob/develop/tests/lib/Proem/Tests/ChainTest.php & https://github.com/proem/proem/blob/develop/tests/lib/Proem/Tests/ProemTest.php As the code stands right now, everything is fine and all tests pass. However, I am about to start some more work on the Proem\Api\Proem class and it needs access to the Proem\Api\Chain class. To do this, I add the line "use Proem\Chain;", the code becomes: <?php /** * @namespace Proem\Api */ namespace Proem\Api; use Proem\Chain; /** * Proem\Api\Proem * * The Proem boostrap wrapper (eventually) */ class Proem { const VERSION = '0.1.0'; } As soon as I do this the tests fail with: Quote Fatal error: Cannot use Proem\Chain as Chain because the name is already in use in /home/thorpe/src/proem/lib/Proem/Api/Proem.php on line 32 If I alias the namespace ( "use Proem\Chain as C;" ) the tests pass again. The issue is I shouldn't have to use an alias here. from the manual: Quote Note: Importing rules are per file basis, meaning included files will NOT inherit the parent file's importing rules. Writing this post I have come to realise that the issue is likely that both the Chain class and the Proem class are in the same namespace yet I am trying to force the Chain class to be loaded from Proem\Chain instead of Proem\Api\Chain (this is part of the cascading filesystem setup). Anyway, if anyone has some ideas I would be grateful if you could take a look. Otherwise, it looks like I might need to do some re-shuffling. Iv'e created a ticket for this bug if anyone wan't to chip in. See here Please can someone explain to me what the keyword as mean in the context of: foreach ($row as $attribute) I am new to php and some things just need a little explaining please. I set up the following code to successfully individual items based on the id number. ?id=1 etc. However, I thought it would be simple to change to show another row so I changed all the terms to 'description'. However, if I enter ?description=abcde it shows nothing. But if I type in ?description=description is bizarrely shows everything. The only thing I can only put it down to is numbers. Does $_GET react differently react differently to numbers or does it require commas surrounding the string? <?php if( isset($_GET['description'])) $_GET['description']; $query = "SELECT * FROM productfeed WHERE description = $description LIMIT 0, 10"; $fetchdata = mysql_query($query) or die("query: $query<br>This has an error: " . mysql_error() . '<br>'); while($row = mysql_fetch_array($fetchdata)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo "<div class='productdisplayshell'> <div class='productdisplayoutline'> <div class='productborder'><center> <a href='$link' target='_blank'><img src='$image'/></a> </center> </div></div> <div class='productdescriptionoutline'> <div class='productdescriptionbox'> <a href='$link' target='_blank' >$description</a> </div> <div class='productfulldescriptionbox'>$fulldescription</div> </div> <div class='productpriceoutline'> <div class='productpricebox'> <center>&#163; $price</center> </div> <div class='productbuybutton'> <center><a href='$link' target='_blank' ><img src=/images/buybutton.png /></a></center> </div> </div> </div>"; } ?> Hi, I've been passed the below code which converts rss to php and then displays HTML. It works well. However, I've 2 issues with it: 1) I'd like to set it so only say 5 posts are shown 2) How can I truncate the description, so it only shows say 100 chars or 20 words? Any help is much appreciated. Here's the code: <?php // DO NOT EDIT BELOW THIS LINE date_default_timezone_set("GMT"); $itemArray = array(); if($text = preg_replace("/[\t\r\n]/", " ", htmlentities(@file_get_contents($rss_feed_url), ENT_QUOTES))) { while(strpos($text, "â") == true) { $text = substr($text, 0, strpos($text, "â")) ."'". substr($text, strpos($text, "â")+9, strlen($text)); } $items = explode("<item>", html_entity_decode($text)); foreach($items as $item) { $title = ""; $link = ""; $desc = ""; $pubdate = ""; $image = ""; $item = html_entity_decode($item, ENT_QUOTES); $item = preg_replace('/&(?!amp;|quot;|nbsp;|gt;|lt;|laquo;|raquo;|copy;|reg;|bul;|rsquo;|mdash;|#)/', '&', $item); $item = str_replace("<![CDATA[","", $item); $item = str_replace("]]>","", $item); if(stripos($item, "</item>") == true) { if(preg_match('|<title>(.*)</title>|', $item, $match)) { $title = $match[1]; } if(preg_match('|<pubDate>(.*)</pubDate>|', $item, $match)) { $pubdate = strtotime($match[1]); } if(preg_match('|url="(.*)|', $item, $match)) { $search = $match[1]; $imageArray = explode('"', $search); $image = $imageArray[0]; } if(preg_match('|<description>(.*)</description>|', $item, $match)) { $desc = $match[1]; $desc = strip_tags($desc); } if(preg_match('|<link>(.*)</link>|', $item, $match)) { $link = $match[1]; $link = end(explode("*", $link)); } if($title && $link && $desc) { array_push($itemArray, "$pubdate|$title|$link|$desc|$image|"); } } } } else { print "<p>Whoops! We could not connect to: <a href=\"$rss_feed_url\">$rss_feed_url</a></p>"; } if(sort($itemArray)) { foreach(array_reverse($itemArray) as $iA) { list($pubdate,$title,$link,$desc,$image) = explode("|", $iA); $timenow = time(); $difference = $timenow-$pubdate; $days = 0; $hours = 0; $minutes = 0; print "<p>"; if($hotlink_images && $image) { if($open_links_in_new_window) { print "<a class=\"thumb\" href=\"$link\" onclick=\"openInNewWindow('$link'); return false\">" . "<img src=\"$image\" alt=\"$title\"></a>"; } else { print "<a class=\"thumb\" href=\"$link\"><img src=\"$image\" alt=\"$title\"></a>"; } } if($open_links_in_new_window) { print "<a href=\"$link\" onclick=\"openInNewWindow('$link'); return false\">$title</a><br>"; } else { print "<a href=\"$link\">$title</a><br>"; } if($pubdate) { print "<span class=\"sub\">Posted "; if(sprintf("%01.0d", $difference/(60*60*24))) { $days = sprintf("%01.0d", $difference/(60*60*24)); $difference -= $days*(60*60*24); if($days > 1) { print "$days days "; } else { print "$days day "; } } if(!(sprintf("%01.0d", $difference/(60*60*24))) && sprintf("%01.0d", $difference/(60*60))) { $hours = sprintf("%01.0d", $difference/(60*60)); $difference -= $hours*(60*60); if($hours > 1) { print "$hours hours "; } else { print "$hours hour "; } } if(!(sprintf("%01.0d", $difference/(60*60*24))) && sprintf("%01.0d", $difference/60)) { $minutes = sprintf("%01.0d", $difference/60); if($minutes > 1) { print "$minutes minutes "; } else { print "$minutes minute "; } } print "ago</span><br>"; } print "$desc</p>\n<div class=\"hr\"> </div>\n"; } } ?> Thanks again |