Padgoi Posted June 10, 2008 Share Posted June 10, 2008 Ok, so I have this php code that tracks external referrals: <? $domain = 'YourDomain.com'; $file = "referral_tracker.html"; $ref = $_SERVER['HTTP_REFERER']; $thisDomain = strpos($ref, $domain); if ($thisDomain === false) { if ($ref == '') { $ref = 'UnknownLocation'; } $saveRef = true; } else { $saveRef = false; } if ($saveRef == true) { $to = $ref; $fp = fopen($file, "r"); $gf = fread($fp, filesize($file)); fclose ($fp); $arr = explode("<br />", $gf); $n = ""; foreach ($arr as $line) { $line = trim($line); if ($line != "") { $sub = explode(" ", $line); if ($to == $sub[0]) { $tracked = true; $sub[1]++; } $n .= $sub[0] . " " . $sub[1] . "<br />"; } } if ($tracked != true) { $n .= $to . " 1<br />"; } $fp = fopen($file, "w"); fputs($fp, $n, strlen($n)); fclose($fp); } ?> I want to put this html into the script so that it looks organized: <div style='border: 3px dotted #0af; font-family: Tahoma; padding: 20px; padding-top: 0; font-size: 12px; background-color: #fafafa; margin: 50px;'><p><h2>REFERERERS (NEWEST FIRST)</h2></p> I tried putting that into the referral_tracker.html file but whenever a new referral is added, the div style information is reset. Can anyone help me with this, I would be very appreciative. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/ Share on other sites More sharing options...
Padgoi Posted June 10, 2008 Author Share Posted June 10, 2008 Can anyone please help with this? Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561705 Share on other sites More sharing options...
hansford Posted June 10, 2008 Share Posted June 10, 2008 have php echo out the div Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561707 Share on other sites More sharing options...
Padgoi Posted June 10, 2008 Author Share Posted June 10, 2008 hansford, I'm not sure you understood what I was asking for. I want to put that Div INSIDE the PHP function so that the html page displays that div style. Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561715 Share on other sites More sharing options...
Padgoi Posted June 10, 2008 Author Share Posted June 10, 2008 Can anyone please help me with this, I'd be very appreciative. Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561727 Share on other sites More sharing options...
kenrbnsn Posted June 10, 2008 Share Posted June 10, 2008 Don't be so impatient. It's only been an hour since you posted your question. Ken Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561729 Share on other sites More sharing options...
Padgoi Posted June 10, 2008 Author Share Posted June 10, 2008 Sorry about that, I kinda thought that it wouldn't get answered the further it got down the page and I really need a little help with this. Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561732 Share on other sites More sharing options...
kenrbnsn Posted June 10, 2008 Share Posted June 10, 2008 If it hasn't been answered in a few hours you can always bump it back to the top. Ken Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561735 Share on other sites More sharing options...
ibolui Posted June 10, 2008 Share Posted June 10, 2008 is this what you are looking for? $div = <<< EOQ your div here EOQ; echo $div ; Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561741 Share on other sites More sharing options...
hansford Posted June 10, 2008 Share Posted June 10, 2008 maybe im not understanding you. You have some information that you want placed bewteen a <div></div>? $content = 'your information'; echo "<div style='blah">" . $content . "</div>"; Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561743 Share on other sites More sharing options...
tippy_102 Posted June 10, 2008 Share Posted June 10, 2008 Replace $n = ""; With this: $n = "<div style='border: 3px dotted #0af; font-family: Tahoma; padding: 20px; padding-top: 0; font-size: 12px; background-color: #fafafa; margin: 50px;'><p><h2>REFERERERS (NEWEST FIRST)</h2></p> Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561749 Share on other sites More sharing options...
Padgoi Posted June 10, 2008 Author Share Posted June 10, 2008 Thank you so much for your help tippy, that worked perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561782 Share on other sites More sharing options...
hansford Posted June 10, 2008 Share Posted June 10, 2008 yeah tippy thanks so much for letting this moron finally "get it". You will never become a good web programmer having other people do all the work for you. Quote Link to comment https://forums.phpfreaks.com/topic/109500-solved-help-putting-html-into-small-php-code/#findComment-561812 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.